1 // target.h -- target support for gold -*- C++ -*-
3 // The abstract class Target is the interface for target specific
4 // support. It defines abstract methods which each target must
5 // implement. Typically there will be one target per processor, but
6 // in some cases it may be necessary to have subclasses.
8 // For speed and consistency we want to use inline functions to handle
9 // relocation processing. So besides implementations of the abstract
10 // methods, each target is expected to define a template
11 // specialization of the relocation functions.
24 // The abstract class for target specific handling.
32 // Return the bit size that this target implements. This should
36 { return this->size_; }
38 // Return whether this target is big-endian.
41 { return this->is_big_endian_; }
43 // Whether this target has a specific make_symbol function.
45 has_make_symbol() const
46 { return this->has_make_symbol_; }
48 // Whether this target has a specific resolve function.
51 { return this->has_resolve_; }
54 Target(int size, bool is_big_endian, bool has_make_symbol, bool has_resolve)
56 is_big_endian_(is_big_endian),
57 has_make_symbol_(has_make_symbol),
58 has_resolve_(has_resolve)
62 Target(const Target&);
63 Target& operator=(const Target&);
67 // Whether this target is big endian.
69 // Whether this target has a special make_symbol function.
70 bool has_make_symbol_;
71 // Whether this target has a special resolve function.
75 // The abstract class for a specific size and endianness of target.
76 // Each actual target implementation class should derive from an
77 // instantiation of Sized_target.
79 template<int size, bool big_endian>
80 class Sized_target : public Target
83 // Make a new symbol table entry for the target. This should be
84 // overridden by a target which needs additional information in the
85 // symbol table. This will only be called if has_make_symbol()
87 virtual Sized_symbol<size>*
91 // Resolve a symbol for the target. This should be overridden by a
92 // target which needs to take special action. TO is the
93 // pre-existing symbol. SYM is the new symbol, seen in OBJECT.
95 resolve(Symbol*, const elfcpp::Sym<size, big_endian>&, Object*)
99 Sized_target(bool has_make_symbol, bool has_resolve)
100 : Target(size, big_endian, has_make_symbol, has_resolve)
104 } // End namespace gold.
106 #endif // !defined(GOLD_TARGET_H)