PR binutils/10924
[deliverable/binutils-gdb.git] / gold / compressed_output.h
CommitLineData
9a0910c3
ILT
1// compressed_output.h -- compressed output sections for gold -*- C++ -*-
2
91d6fa6a 3// Copyright 2007, 2008, 2009 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
96803768
ILT
40// This is used for a section whose data should be compressed. It is
41// a regular Output_section which computes its contents into a buffer
42// and then postprocesses it.
9a0910c3 43
96803768 44class Output_compressed_section : public Output_section
9a0910c3
ILT
45{
46 public:
96803768 47 Output_compressed_section(const General_options* options,
91d6fa6a
NC
48 const char* cname, elfcpp::Elf_Word cflags,
49 elfcpp::Elf_Xword ctype)
50 : Output_section(cname, cflags, ctype),
96803768
ILT
51 options_(options)
52 { this->set_requires_postprocessing(); }
9a0910c3
ILT
53
54 protected:
9a0910c3
ILT
55 // Set the final data size.
56 void
57 set_final_data_size();
58
96803768 59 // Write out the compressed contents.
9a0910c3
ILT
60 void
61 do_write(Output_file*);
62
63 private:
96803768
ILT
64 // The options--this includes the compression type.
65 const General_options* options_;
66 // The compressed data.
126f3ece 67 unsigned char* data_;
96803768 68 // The new section name if we do compress.
9a0910c3
ILT
69 std::string new_section_name_;
70};
71
72} // End namespace gold.
73
74#endif // !defined(GOLD_COMPRESSED_OUTPUT_H)
This page took 0.129569 seconds and 4 git commands to generate.