aboutsummaryrefslogtreecommitdiff
path: root/gold/arm.cc
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2010-02-03 05:36:55 +0000
committerDoug Kwan <dougkwan@google.com>2010-02-03 05:36:55 +0000
commit0d31c79dad789b6e82620d842e8ba8c5d71cde88 (patch)
tree53745aa4173679af2ce2b93044a30dfa9cd45ad7 /gold/arm.cc
parentaf06b00b54e4670606c7b77bc3c2bfd807b7f0a7 (diff)
downloadgdb-0d31c79dad789b6e82620d842e8ba8c5d71cde88.zip
gdb-0d31c79dad789b6e82620d842e8ba8c5d71cde88.tar.gz
gdb-0d31c79dad789b6e82620d842e8ba8c5d71cde88.tar.bz2
2010-02-02 Doug Kwan <dougkwan@google.com>
* Makefile.am (HFILES): Add arm-reloc-property.h. (DEFFILES): New. (TARGETSOURCES): Add arm-reloc-property.cc (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT) (libgold_a_SOURCES): $(DEFFILES) * Makefile.in: Regenerate. * arm-reloc-property.cc: New file. * arm-reloc-property.h: New file. * arm-reloc.def: New file. * arm.cc: Update comments. (arm-reloc-property.h): New included header. (arm_reloc_property_table): New global variable. (Target_arm::do_select_as_default_target): New method definition. * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add arm-reloc-property to targ_extra_obj. * parameters.cc (set_parameters_target): Call Target::select_as_default_target(). * target.h (Target::select_as_default_target): New method definition. (Target::do_select_as_default_target): Same.
Diffstat (limited to 'gold/arm.cc')
-rw-r--r--gold/arm.cc47
1 files changed, 27 insertions, 20 deletions
diff --git a/gold/arm.cc b/gold/arm.cc
index 89a4149..b421a7f 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -50,6 +50,7 @@
#include "defstd.h"
#include "gc.h"
#include "attributes.h"
+#include "arm-reloc-property.h"
namespace
{
@@ -99,30 +100,25 @@ const int32_t THM2_MAX_BWD_BRANCH_OFFSET = (-(1 << 24) + 4);
// supporting Android only for the time being.
//
// TODOs:
-// - Support the following relocation types as needed:
-// R_ARM_SBREL32
-// R_ARM_LDR_SBREL_11_0_NC
-// R_ARM_ALU_SBREL_19_12_NC
-// R_ARM_ALU_SBREL_27_20_CK
-// R_ARM_SBREL31
-// R_ARM_REL32_NOI
-// R_ARM_PLT32_ABS
-// R_ARM_GOT_ABS
-// R_ARM_GOT_BREL12
-// R_ARM_GOTOFF12
-// R_ARM_TLS_GD32
-// R_ARM_TLS_LDM32
-// R_ARM_TLS_LDO32
-// R_ARM_TLS_IE32
-// R_ARM_TLS_LE32
-// R_ARM_TLS_LDO12
-// R_ARM_TLS_LE12
-// R_ARM_TLS_IE12GP
-//
+// - Implement all static relocation types documented in arm-reloc.def.
// - Make PLTs more flexible for different architecture features like
// Thumb-2 and BE8.
// There are probably a lot more.
+// Ideally we would like to avoid using global variables but this is used
+// very in many places and sometimes in loops. If we use a function
+// returning a static instance of Arm_reloc_property_table, it will very
+// slow in an threaded environment since the static instance needs to be
+// locked. The pointer is below initialized in the
+// Target::do_select_as_default_target() hook so that we do not spend time
+// building the table if we are not linking ARM objects.
+//
+// An alternative is to to process the information in arm-reloc.def in
+// compilation time and generate a representation of it in PODs only. That
+// way we can avoid initialization when the linker starts.
+
+Arm_reloc_property_table *arm_reloc_property_table = NULL;
+
// Instruction template class. This class is similar to the insn_sequence
// struct in bfd/elf32-arm.c.
@@ -2133,6 +2129,17 @@ class Target_arm : public Sized_target<32, big_endian>
int
do_attributes_order(int num) const;
+ // This is called when the target is selected as the default.
+ void
+ do_select_as_default_target()
+ {
+ // No locking is required since there should only be one default target.
+ // We cannot have both the big-endian and little-endian ARM targets
+ // as the default.
+ gold_assert(arm_reloc_property_table == NULL);
+ arm_reloc_property_table = new Arm_reloc_property_table();
+ }
+
private:
// The class which scans relocations.
class Scan