OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gold/] [compressed_output.h] - Blame information for rev 255

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 khays
// compressed_output.h -- compressed output sections for gold  -*- C++ -*-
2
 
3
// Copyright 2007, 2008, 2010 Free Software Foundation, Inc.
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>
32
 
33
#include "output.h"
34
 
35
namespace gold
36
{
37
 
38
class General_options;
39
 
40
// Read the compression header of a compressed debug section and return
41
// the uncompressed size.
42
 
43
extern uint64_t
44
get_uncompressed_size(const unsigned char*, section_size_type);
45
 
46
// Decompress a compressed debug section directly into the output file.
47
 
48
extern bool
49
decompress_input_section(const unsigned char*, unsigned long, unsigned char*,
50
                         unsigned long);
51
 
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.
55
 
56
class Output_compressed_section : public Output_section
57
{
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(); }
65
 
66
 protected:
67
  // Set the final data size.
68
  void
69
  set_final_data_size();
70
 
71
  // Write out the compressed contents.
72
  void
73
  do_write(Output_file*);
74
 
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_;
82
};
83
 
84
} // End namespace gold.
85
 
86
#endif // !defined(GOLD_COMPRESSED_OUTPUT_H)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.