aboutsummaryrefslogtreecommitdiff
path: root/gold/i386.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/i386.cc')
-rw-r--r--gold/i386.cc92
1 files changed, 72 insertions, 20 deletions
diff --git a/gold/i386.cc b/gold/i386.cc
index 57e5542..82886d4 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -429,6 +429,21 @@ class Target_i386 : public Sized_target<32, false>
const unsigned char* plocal_symbols,
Relocatable_relocs*);
+ // Scan the relocs for --emit-relocs.
+ void
+ emit_relocs_scan(Symbol_table* symtab,
+ Layout* layout,
+ Sized_relobj_file<32, false>* 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_syms,
+ Relocatable_relocs* rr);
+
// Emit relocations for a section.
void
relocate_relocs(const Relocate_info<32, false>*,
@@ -485,7 +500,7 @@ class Target_i386 : public Sized_target<32, false>
// Return whether SYM is call to a non-split function.
bool
- do_is_call_to_non_split(const Symbol* sym, unsigned int) const;
+ do_is_call_to_non_split(const Symbol* sym, const unsigned char*) const;
// Adjust -fsplit-stack code which calls non-split-stack code.
void
@@ -723,12 +738,15 @@ class Target_i386 : public Sized_target<32, false>
Local_dynamic_type local_dynamic_type_;
};
- // A class which returns the size required for a relocation type,
- // used while scanning relocs during a relocatable link.
- class Relocatable_size_for_reloc
+ // A class for inquiring about properties of a relocation,
+ // used while scanning relocs during a relocatable link and
+ // garbage collection.
+ class Classify_reloc :
+ public gold::Default_classify_reloc<elfcpp::SHT_REL, 32, false>
{
public:
- unsigned int
+ // Return the size of the addend of the relocation (only used for SHT_REL).
+ static unsigned int
get_size_for_reloc(unsigned int, Relobj*);
};
@@ -2564,9 +2582,7 @@ Target_i386::gc_process_relocs(Symbol_table* symtab,
size_t local_symbol_count,
const unsigned char* plocal_symbols)
{
- gold::gc_process_relocs<32, false, Target_i386, elfcpp::SHT_REL,
- Target_i386::Scan,
- Target_i386::Relocatable_size_for_reloc>(
+ gold::gc_process_relocs<32, false, Target_i386, Scan, Classify_reloc>(
symtab,
layout,
this,
@@ -2602,8 +2618,7 @@ Target_i386::scan_relocs(Symbol_table* symtab,
return;
}
- gold::scan_relocs<32, false, Target_i386, elfcpp::SHT_REL,
- Target_i386::Scan>(
+ gold::scan_relocs<32, false, Target_i386, Scan, Classify_reloc>(
symtab,
layout,
this,
@@ -3609,8 +3624,8 @@ Target_i386::relocate_section(const Relocate_info<32, false>* relinfo,
{
gold_assert(sh_type == elfcpp::SHT_REL);
- gold::relocate_section<32, false, Target_i386, elfcpp::SHT_REL,
- Target_i386::Relocate, gold::Default_comdat_behavior>(
+ gold::relocate_section<32, false, Target_i386, Relocate,
+ gold::Default_comdat_behavior, Classify_reloc>(
relinfo,
this,
prelocs,
@@ -3627,7 +3642,7 @@ Target_i386::relocate_section(const Relocate_info<32, false>* relinfo,
// link.
unsigned int
-Target_i386::Relocatable_size_for_reloc::get_size_for_reloc(
+Target_i386::Classify_reloc::get_size_for_reloc(
unsigned int r_type,
Relobj* object)
{
@@ -3712,13 +3727,12 @@ Target_i386::scan_relocatable_relocs(Symbol_table* symtab,
const unsigned char* plocal_symbols,
Relocatable_relocs* rr)
{
- gold_assert(sh_type == elfcpp::SHT_REL);
+ typedef gold::Default_scan_relocatable_relocs<Classify_reloc>
+ Scan_relocatable_relocs;
- typedef gold::Default_scan_relocatable_relocs<elfcpp::SHT_REL,
- Relocatable_size_for_reloc> Scan_relocatable_relocs;
+ gold_assert(sh_type == elfcpp::SHT_REL);
- gold::scan_relocatable_relocs<32, false, elfcpp::SHT_REL,
- Scan_relocatable_relocs>(
+ gold::scan_relocatable_relocs<32, false, Scan_relocatable_relocs>(
symtab,
layout,
object,
@@ -3732,6 +3746,43 @@ Target_i386::scan_relocatable_relocs(Symbol_table* symtab,
rr);
}
+// Scan the relocs for --emit-relocs.
+
+void
+Target_i386::emit_relocs_scan(Symbol_table* symtab,
+ Layout* layout,
+ Sized_relobj_file<32, false>* 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_syms,
+ Relocatable_relocs* rr)
+{
+ typedef gold::Default_classify_reloc<elfcpp::SHT_REL, 32, false>
+ Classify_reloc;
+ typedef gold::Default_emit_relocs_strategy<Classify_reloc>
+ Emit_relocs_strategy;
+
+ gold_assert(sh_type == elfcpp::SHT_REL);
+
+ gold::scan_relocatable_relocs<32, false, Emit_relocs_strategy>(
+ symtab,
+ layout,
+ object,
+ data_shndx,
+ prelocs,
+ reloc_count,
+ output_section,
+ needs_special_offset_handling,
+ local_symbol_count,
+ plocal_syms,
+ rr);
+}
+
// Emit relocations for a section.
void
@@ -3750,7 +3801,7 @@ Target_i386::relocate_relocs(
{
gold_assert(sh_type == elfcpp::SHT_REL);
- gold::relocate_relocs<32, false, elfcpp::SHT_REL>(
+ gold::relocate_relocs<32, false, Classify_reloc>(
relinfo,
prelocs,
reloc_count,
@@ -3867,7 +3918,8 @@ Target_i386::do_ehframe_datarel_base() const
// get_pc_thunk function.
bool
-Target_i386::do_is_call_to_non_split(const Symbol* sym, unsigned int) const
+Target_i386::do_is_call_to_non_split(const Symbol* sym,
+ const unsigned char*) const
{
return (sym->type() == elfcpp::STT_FUNC
&& !is_prefix_of("__i686.get_pc_thunk.", sym->name()));