aboutsummaryrefslogtreecommitdiff
path: root/gold/target.h
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2010-06-25 00:37:40 +0000
committerDoug Kwan <dougkwan@google.com>2010-06-25 00:37:40 +0000
commit8a75a161b2c2b23f87f986e186c18dc5e267753f (patch)
tree5f127328523b3a278bdbc64f2cd66e14c42e5d36 /gold/target.h
parent4f2a93bda27fb1c25aa5af9bd3cc6a30cda237cb (diff)
downloadfsf-binutils-gdb-8a75a161b2c2b23f87f986e186c18dc5e267753f.zip
fsf-binutils-gdb-8a75a161b2c2b23f87f986e186c18dc5e267753f.tar.gz
fsf-binutils-gdb-8a75a161b2c2b23f87f986e186c18dc5e267753f.tar.bz2
2010-06-25 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::can_check_for_functions_pointers): Return true. (Target_arm::section_may_have_icf_unsafe_pointers): New method definition. (Target_arm::Scan::local_reloc_may_be_function_pointer, Target_arm::Scan::global_reloc_may_be_function_pointer): Implement target hook to detect function points. (Target_arm::Scan::possible_function_pointer_reloc): New method. * icf.h (Icf::check_section_for_function_pointers): Change type of parameter SECTION_NAME to const reference to std::string. Use target hook to determine if section may have unsafe pointers. * target.h (Target::section_may_have_icf_unsafe_pointers): New method definition.
Diffstat (limited to 'gold/target.h')
-rw-r--r--gold/target.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/gold/target.h b/gold/target.h
index a0ec0b3..9f9c4f9 100644
--- a/gold/target.h
+++ b/gold/target.h
@@ -71,6 +71,20 @@ class Target
can_check_for_function_pointers() const
{ return false; }
+ // Whether a section called SECTION_NAME may have function pointers to
+ // sections not eligible for safe ICF folding.
+ virtual bool
+ section_may_have_icf_unsafe_pointers(const char* section_name) const
+ {
+ // We recognize sections for normal vtables, construction vtables and
+ // EH frames.
+ return (!is_prefix_of(".rodata._ZTV", section_name)
+ && !is_prefix_of(".data.rel.ro._ZTV", section_name)
+ && !is_prefix_of(".rodata._ZTC", section_name)
+ && !is_prefix_of(".data.rel.ro._ZTC", section_name)
+ && !is_prefix_of(".eh_frame", section_name));
+ }
+
// Return the bit size that this target implements. This should
// return 32 or 64.
int