arm: Support pac_key_* register operand for MRS/MSR in Armv8.1-M Mainline
[binutils-gdb.git] / gold / compressed_output.h
blob201071221bca8fd8a59b64ff24e18bd2a234fdae
1 // compressed_output.h -- compressed output sections for gold -*- C++ -*-
3 // Copyright (C) 2007-2024 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 // MA 02110-1301, USA.
23 // We support compressing .debug_* sections on output. (And,
24 // potentially one day, other sections.) This is a form of
25 // relaxation. This file adds support for merging and emitting the
26 // compressed sections.
28 #ifndef GOLD_COMPRESSED_OUTPUT_H
29 #define GOLD_COMPRESSED_OUTPUT_H
31 #include <string>
33 #include "output.h"
35 namespace gold
38 class General_options;
40 // Read the compression header of a compressed debug section and return
41 // the uncompressed size.
43 extern uint64_t
44 get_uncompressed_size(const unsigned char*, section_size_type);
46 // Decompress a compressed debug section directly into the output file.
48 extern bool
49 decompress_input_section(const unsigned char*, unsigned long, unsigned char*,
50 unsigned long, int, bool, elfcpp::Elf_Xword);
52 // This is used for a section whose data should be compressed. It is
53 // a regular Output_section which computes its contents into a buffer
54 // and then postprocesses it.
56 class Output_compressed_section : public Output_section
58 public:
59 Output_compressed_section(const General_options* options,
60 const char* name, elfcpp::Elf_Word flags,
61 elfcpp::Elf_Xword type)
62 : Output_section(name, flags, type),
63 options_(options)
64 { this->set_requires_postprocessing(); }
66 protected:
67 // Set the final data size.
68 void
69 set_final_data_size();
71 // Write out the compressed contents.
72 void
73 do_write(Output_file*);
75 private:
76 // The options--this includes the compression type.
77 const General_options* options_;
78 // The compressed data.
79 unsigned char* data_;
80 // The new section name if we do compress.
81 std::string new_section_name_;
84 } // End namespace gold.
86 #endif // !defined(GOLD_COMPRESSED_OUTPUT_H)