namespace gold
{
-class General_options;
class Object;
+class Relobj;
template<int size, bool big_endian>
class Sized_relobj;
class Relocatable_relocs;
template<int size, bool big_endian>
class Relocate_info;
+class Reloc_symbol_changes;
class Symbol;
template<int size>
class Sized_symbol;
is_local_label_name(const char* name) const
{ return this->do_is_local_label_name(name); }
+ // A function starts at OFFSET in section SHNDX in OBJECT. That
+ // function was compiled with -fsplit-stack, but it refers to a
+ // function which was compiled without -fsplit-stack. VIEW is a
+ // modifiable view of the section; VIEW_SIZE is the size of the
+ // view. The target has to adjust the function so that it allocates
+ // enough stack.
+ void
+ calls_non_split(Relobj* object, unsigned int shndx,
+ section_offset_type fnoffset, section_size_type fnsize,
+ unsigned char* view, section_size_type view_size,
+ std::string* from, std::string* to) const
+ {
+ this->do_calls_non_split(object, shndx, fnoffset, fnsize, view, view_size,
+ from, to);
+ }
+
// Make an ELF object.
template<int size, bool big_endian>
Object*
off_t offset, const elfcpp::Ehdr<size, big_endian>& ehdr)
{ return this->do_make_elf_object(name, input_file, offset, ehdr); }
+ // Make an output section.
+ Output_section*
+ make_output_section(const char* name, elfcpp::Elf_Word type,
+ elfcpp::Elf_Xword flags)
+ { return this->do_make_output_section(name, type, flags); }
+
// Return true if target wants to perform relaxation.
bool
may_relax() const
// Perform a relaxation pass. Return true if layout may be changed.
bool
- relax(int pass)
+ relax(int pass, const Input_objects* input_objects, Symbol_table* symtab,
+ Layout* layout)
{
// Run the dummy relaxation pass twice if relaxation debugging is enabled.
if (is_debugging_enabled(DEBUG_RELAXATION))
return pass < 2;
- return this->do_relax(pass);
+ return this->do_relax(pass, input_objects, symtab, layout);
}
protected:
virtual bool
do_is_local_label_name(const char*) const;
+ // Virtual function which may be overridden by the child class.
+ virtual void
+ do_calls_non_split(Relobj* object, unsigned int, section_offset_type,
+ section_size_type, unsigned char*, section_size_type,
+ std::string*, std::string*) const;
+
// make_elf_object hooks. There are four versions of these for
// different address sizes and endianities.
-
+
#ifdef HAVE_TARGET_32_LITTLE
// Virtual functions which may be overriden by the child class.
virtual Object*
off_t offset, const elfcpp::Ehdr<64, true>& ehdr);
#endif
+ // Virtual functions which may be overriden by the child class.
+ virtual Output_section*
+ do_make_output_section(const char* name, elfcpp::Elf_Word type,
+ elfcpp::Elf_Xword flags);
+
// Virtual function which may be overriden by the child class.
virtual bool
do_may_relax() const
// Virtual function which may be overriden by the child class.
virtual bool
- do_relax(int)
+ do_relax(int, const Input_objects*, Symbol_table*, Layout*)
{ return false; }
+ // A function for targets to call. Return whether BYTES/LEN matches
+ // VIEW/VIEW_SIZE at OFFSET.
+ bool
+ match_view(const unsigned char* view, section_size_type view_size,
+ section_offset_type offset, const char* bytes, size_t len) const;
+
+ // Set the contents of a VIEW/VIEW_SIZE to nops starting at OFFSET
+ // for LEN bytes.
+ void
+ set_view_to_nop(unsigned char* view, section_size_type view_size,
+ section_offset_type offset, size_t len) const;
+
private:
// The implementations of the four do_make_elf_object virtual functions are
// almost identical except for their sizes and endianity. We use a template.
// used to determine unreferenced garbage sections. This procedure is
// only called during garbage collection.
virtual void
- gc_process_relocs(const General_options& options,
- Symbol_table* symtab,
- Layout* layout,
- Sized_relobj<size, big_endian>* object,
- unsigned int data_shndx,
- unsigned int sh_type,
- const unsigned char* prelocs,
- size_t reloc_count,
- Output_section* output_section,
- bool needs_special_offset_handling,
- size_t local_symbol_count,
- const unsigned char* plocal_symbols) = 0;
+ gc_process_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Sized_relobj<size, big_endian>* object,
+ unsigned int data_shndx,
+ unsigned int sh_type,
+ const unsigned char* prelocs,
+ size_t reloc_count,
+ Output_section* output_section,
+ bool needs_special_offset_handling,
+ size_t local_symbol_count,
+ const unsigned char* plocal_symbols) = 0;
// Scan the relocs for a section, and record any information
- // required for the symbol. OPTIONS is the command line options.
- // SYMTAB is the symbol table. OBJECT is the object in which the
- // section appears. DATA_SHNDX is the section index that these
- // relocs apply to. SH_TYPE is the type of the relocation section,
- // SHT_REL or SHT_RELA. PRELOCS points to the relocation data.
- // RELOC_COUNT is the number of relocs. LOCAL_SYMBOL_COUNT is the
- // number of local symbols. OUTPUT_SECTION is the output section.
+ // required for the symbol. SYMTAB is the symbol table. OBJECT is
+ // the object in which the section appears. DATA_SHNDX is the
+ // section index that these relocs apply to. SH_TYPE is the type of
+ // the relocation section, SHT_REL or SHT_RELA. PRELOCS points to
+ // the relocation data. RELOC_COUNT is the number of relocs.
+ // LOCAL_SYMBOL_COUNT is the number of local symbols.
+ // OUTPUT_SECTION is the output section.
// NEEDS_SPECIAL_OFFSET_HANDLING is true if offsets to the output
// sections are not mapped as usual. PLOCAL_SYMBOLS points to the
// local symbol data from OBJECT. GLOBAL_SYMBOLS is the array of
// pointers to the global symbol table from OBJECT.
virtual void
- scan_relocs(const General_options& options,
- Symbol_table* symtab,
+ scan_relocs(Symbol_table* symtab,
Layout* layout,
Sized_relobj<size, big_endian>* object,
unsigned int data_shndx,
bool needs_special_offset_handling,
unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr view_address,
- section_size_type view_size) = 0;
+ section_size_type view_size,
+ const Reloc_symbol_changes*) = 0;
// Scan the relocs during a relocatable link. The parameters are
// like scan_relocs, with an additional Relocatable_relocs
// parameter, used to record the disposition of the relocs.
virtual void
- scan_relocatable_relocs(const General_options& options,
- Symbol_table* symtab,
+ scan_relocatable_relocs(Symbol_table* symtab,
Layout* layout,
Sized_relobj<size, big_endian>* object,
unsigned int data_shndx,