Split Object into Dynobj and Relobj, incorporate elfcpp swapping changes.
[external/binutils.git] / gold / dynobj.h
1 // dynobj.h -- dynamic object support for gold   -*- C++ -*-
2
3 #ifndef GOLD_DYNOBJ_H
4 #define GOLD_DYNOBJ_H
5
6 #include "object.h"
7
8 namespace gold
9 {
10
11 // A dynamic object (ET_DYN).  This is an abstract base class itself.
12 // The implementations is the template class Sized_dynobj.
13
14 class Dynobj : public Object
15 {
16  public:
17   Dynobj(const std::string& name, Input_file* input_file, off_t offset = 0)
18     : Object(name, input_file, true, offset)
19   { }
20 };
21
22 // A dynamic object, size and endian specific version.
23
24 template<int size, bool big_endian>
25 class Sized_dynobj : public Dynobj
26 {
27  public:
28   Sized_dynobj(const std::string& name, Input_file* input_file, off_t offset,
29                const typename elfcpp::Ehdr<size, big_endian>&);
30
31   // Read the symbols.
32   void
33   do_read_symbols(Read_symbols_data*);
34
35   // Lay out the input sections.
36   void
37   do_layout(const General_options&, Symbol_table*, Layout*,
38             Read_symbols_data*);
39
40   // Add the symbols to the symbol table.
41   void
42   do_add_symbols(Symbol_table*, Read_symbols_data*);
43
44   // Return a view of the contents of a section.  Set *PLEN to the
45   // size.
46   const unsigned char*
47   do_section_contents(unsigned int shnum, off_t* plen) = 0;
48
49   // Get the name of a section.
50   std::string
51   do_section_name(unsigned int shnum);
52 };
53
54 } // End namespace gold.
55
56 #endif // !defined(GOLD_DYNOBJ_H)