S/390: z13 use GNU attribute to indicate vector ABI
[deliverable/binutils-gdb.git] / gold / compressed_output.h
CommitLineData
9a0910c3
ILT
1// compressed_output.h -- compressed output sections for gold -*- C++ -*-
2
b90efa5b 3// Copyright (C) 2007-2015 Free Software Foundation, Inc.
9a0910c3
ILT
4// Written by Ian Lance Taylor <iant@google.com>.
5
6// This file is part of gold.
7
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.
12
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.
17
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.
22
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.
27
28#ifndef GOLD_COMPRESSED_OUTPUT_H
29#define GOLD_COMPRESSED_OUTPUT_H
30
31#include <string>
9a0910c3
ILT
32
33#include "output.h"
9a0910c3
ILT
34
35namespace gold
36{
37
38class General_options;
39
a2e47362
CC
40// Read the compression header of a compressed debug section and return
41// the uncompressed size.
42
43extern uint64_t
44get_uncompressed_size(const unsigned char*, section_size_type);
45
46// Decompress a compressed debug section directly into the output file.
47
48extern bool
49decompress_input_section(const unsigned char*, unsigned long, unsigned char*,
50 unsigned long);
51
96803768
ILT
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.
9a0910c3 55
96803768 56class Output_compressed_section : public Output_section
9a0910c3
ILT
57{
58 public:
96803768 59 Output_compressed_section(const General_options* options,
2ea97941
ILT
60 const char* name, elfcpp::Elf_Word flags,
61 elfcpp::Elf_Xword type)
62 : Output_section(name, flags, type),
96803768
ILT
63 options_(options)
64 { this->set_requires_postprocessing(); }
9a0910c3
ILT
65
66 protected:
9a0910c3
ILT
67 // Set the final data size.
68 void
69 set_final_data_size();
70
96803768 71 // Write out the compressed contents.
9a0910c3
ILT
72 void
73 do_write(Output_file*);
74
75 private:
96803768
ILT
76 // The options--this includes the compression type.
77 const General_options* options_;
78 // The compressed data.
126f3ece 79 unsigned char* data_;
96803768 80 // The new section name if we do compress.
9a0910c3
ILT
81 std::string new_section_name_;
82};
83
84} // End namespace gold.
85
86#endif // !defined(GOLD_COMPRESSED_OUTPUT_H)
This page took 0.302311 seconds and 4 git commands to generate.