diff options
author | Sriraman Tallam <tmsriram@google.com> | 2010-03-04 01:33:22 +0000 |
---|---|---|
committer | Sriraman Tallam <tmsriram@google.com> | 2010-03-04 01:33:22 +0000 |
commit | 0897ed3bdb8ae45b2142057223c1179036154d2d (patch) | |
tree | 0db3d5c377a366ba4689b1422367a0f6d1f09619 /gold/i386.cc | |
parent | 390a8acaa3838e084169c5dd159075cfbc178fbc (diff) | |
download | gdb-0897ed3bdb8ae45b2142057223c1179036154d2d.zip gdb-0897ed3bdb8ae45b2142057223c1179036154d2d.tar.gz gdb-0897ed3bdb8ae45b2142057223c1179036154d2d.tar.bz2 |
* i386.cc (Target_i386::can_check_for_function_pointers): New function.
(Scan::possible_function_pointer_reloc): New function.
(Scan::local_reloc_may_be_function_pointer): Change to call
possible_function_pointer_reloc.
(Scan::global_reloc_may_be_function_pointer): Ditto.
* icf.h (Icf::check_section_for_function_pointers): Change to reject
relocations in ".data.rel.ro._ZTV" section.
* testsuite/icf_safe_so_test.sh: Change to pass i386.
* testsuite/icf_safe_so_test.cc: Ditto.
* testsuite/icf_safe_test.cc: Ditto.
* testsuite/icf_safe_test.sh: Ditto.
Diffstat (limited to 'gold/i386.cc')
-rw-r--r-- | gold/i386.cc | 88 |
1 files changed, 72 insertions, 16 deletions
diff --git a/gold/i386.cc b/gold/i386.cc index eb4ef0a..e7b700c 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -64,6 +64,10 @@ class Target_i386 : public Target_freebsd<32, false> got_mod_index_offset_(-1U), tls_base_symbol_defined_(false) { } + inline bool + can_check_for_function_pointers() const + { return true; } + // Process the relocations to determine unreferenced sections for // garbage collection. void @@ -203,24 +207,27 @@ class Target_i386 : public Target_freebsd<32, false> Symbol* gsym); inline bool - local_reloc_may_be_function_pointer(Symbol_table* , Layout* , Target_i386* , - Sized_relobj<32, false>* , - unsigned int , - Output_section* , - const elfcpp::Rel<32, false>& , - unsigned int , - const elfcpp::Sym<32, false>&) - { return false; } + local_reloc_may_be_function_pointer(Symbol_table* symtab, Layout* layout, + Target_i386* target, + Sized_relobj<32, false>* object, + unsigned int data_shndx, + Output_section* output_section, + const elfcpp::Rel<32, false>& reloc, + unsigned int r_type, + const elfcpp::Sym<32, false>& lsym); + + inline bool + global_reloc_may_be_function_pointer(Symbol_table* symtab, Layout* layout, + Target_i386* target, + Sized_relobj<32, false>* object, + unsigned int data_shndx, + Output_section* output_section, + const elfcpp::Rel<32, false>& reloc, + unsigned int r_type, + Symbol* gsym); inline bool - global_reloc_may_be_function_pointer(Symbol_table* , Layout* , - Target_i386* , - Sized_relobj<32, false>* , - unsigned int , - Output_section* , - const elfcpp::Rel<32, false>& , - unsigned int , Symbol*) - { return false; } + possible_function_pointer_reloc(unsigned int r_type); static void unsupported_reloc_local(Sized_relobj<32, false>*, unsigned int r_type); @@ -1234,6 +1241,55 @@ Target_i386::Scan::unsupported_reloc_global(Sized_relobj<32, false>* object, object->name().c_str(), r_type, gsym->demangled_name().c_str()); } +inline bool +Target_i386::Scan::possible_function_pointer_reloc(unsigned int r_type) +{ + switch (r_type) + { + case elfcpp::R_386_32: + case elfcpp::R_386_16: + case elfcpp::R_386_8: + case elfcpp::R_386_GOTOFF: + case elfcpp::R_386_GOT32: + { + return true; + } + default: + return false; + } + return false; +} + +inline bool +Target_i386::Scan::local_reloc_may_be_function_pointer( + Symbol_table* , + Layout* , + Target_i386* , + Sized_relobj<32, false>* , + unsigned int , + Output_section* , + const elfcpp::Rel<32, false>& , + unsigned int r_type, + const elfcpp::Sym<32, false>&) +{ + return possible_function_pointer_reloc(r_type); +} + +inline bool +Target_i386::Scan::global_reloc_may_be_function_pointer( + Symbol_table* , + Layout* , + Target_i386* , + Sized_relobj<32, false>* , + unsigned int , + Output_section* , + const elfcpp::Rel<32, false>& , + unsigned int r_type, + Symbol*) +{ + return possible_function_pointer_reloc(r_type); +} + // Scan a relocation for a global symbol. inline void |