aboutsummaryrefslogtreecommitdiff
path: root/gold/arm.cc
diff options
context:
space:
mode:
authorIgor Kudrin <ikudrin@accesssoftek.com>2016-12-19 15:23:59 -0800
committerCary Coutant <ccoutant@gmail.com>2016-12-19 15:28:28 -0800
commitee7ef219cbfbcf9217b50c4d30e719e2a6182a71 (patch)
treea10c07ee10ef2268b94eeb83f08aaa6dcefd81c2 /gold/arm.cc
parent89ede9f53b74f84febcd1c2a6db8b03f390b62ec (diff)
downloadgdb-ee7ef219cbfbcf9217b50c4d30e719e2a6182a71.zip
gdb-ee7ef219cbfbcf9217b50c4d30e719e2a6182a71.tar.gz
gdb-ee7ef219cbfbcf9217b50c4d30e719e2a6182a71.tar.bz2
Fix an internal error in the constructor of Target_arm.
gold/ * arm.cc (Target_arm::Target_arm): Move initialization code ... (Target_arm::do_select_as_default_target): ... to here. * testsuite/Makefile.am (arm_target_lazy_init): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/arm_target_lazy_init.s: New source file. * testsuite/arm_target_lazy_init.t: New linker script.
Diffstat (limited to 'gold/arm.cc')
-rw-r--r--gold/arm.cc51
1 files changed, 25 insertions, 26 deletions
diff --git a/gold/arm.cc b/gold/arm.cc
index ea20c37..d1361aa 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -2132,32 +2132,7 @@ class Target_arm : public Sized_target<32, big_endian>
target1_reloc_(elfcpp::R_ARM_ABS32),
// This can be any reloc type but usually is R_ARM_GOT_PREL.
target2_reloc_(elfcpp::R_ARM_GOT_PREL)
- {
- if (parameters->options().user_set_target1_rel())
- {
- // FIXME: This is not strictly compatible with ld, which allows both
- // --target1-abs and --target-rel to be given.
- if (parameters->options().user_set_target1_abs())
- gold_error(_("Cannot use both --target1-abs and --target1-rel."));
- else
- this->target1_reloc_ = elfcpp::R_ARM_REL32;
- }
- // We don't need to handle --target1-abs because target1_reloc_ is set
- // to elfcpp::R_ARM_ABS32 in the member initializer list.
-
- if (parameters->options().user_set_target2())
- {
- const char* target2 = parameters->options().target2();
- if (strcmp(target2, "rel") == 0)
- this->target2_reloc_ = elfcpp::R_ARM_REL32;
- else if (strcmp(target2, "abs") == 0)
- this->target2_reloc_ = elfcpp::R_ARM_ABS32;
- else if (strcmp(target2, "got-rel") == 0)
- this->target2_reloc_ = elfcpp::R_ARM_GOT_PREL;
- else
- gold_unreachable();
- }
- }
+ { }
// Whether we force PCI branch veneers.
bool
@@ -2571,6 +2546,30 @@ class Target_arm : public Sized_target<32, big_endian>
// as the default.
gold_assert(arm_reloc_property_table == NULL);
arm_reloc_property_table = new Arm_reloc_property_table();
+ if (parameters->options().user_set_target1_rel())
+ {
+ // FIXME: This is not strictly compatible with ld, which allows both
+ // --target1-abs and --target-rel to be given.
+ if (parameters->options().user_set_target1_abs())
+ gold_error(_("Cannot use both --target1-abs and --target1-rel."));
+ else
+ this->target1_reloc_ = elfcpp::R_ARM_REL32;
+ }
+ // We don't need to handle --target1-abs because target1_reloc_ is set
+ // to elfcpp::R_ARM_ABS32 in the member initializer list.
+
+ if (parameters->options().user_set_target2())
+ {
+ const char* target2 = parameters->options().target2();
+ if (strcmp(target2, "rel") == 0)
+ this->target2_reloc_ = elfcpp::R_ARM_REL32;
+ else if (strcmp(target2, "abs") == 0)
+ this->target2_reloc_ = elfcpp::R_ARM_ABS32;
+ else if (strcmp(target2, "got-rel") == 0)
+ this->target2_reloc_ = elfcpp::R_ARM_GOT_PREL;
+ else
+ gold_unreachable();
+ }
}
// Virtual function which is set to return true by a target if