From 2fd9ae7a1d02f2c5660a36a870285ce5b85fdc7a Mon Sep 17 00:00:00 2001 From: Doug Kwan Date: Sat, 27 Feb 2010 00:36:49 +0000 Subject: 2010-02-26 Doug Kwan * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs. (Target_arm::scan_reloc_section_for_stubs): Instead of calling scan_reloc_for_stub, do all processing of R_ARM_V4BX here. * options.cc (General_options::General_options): Initialize member fix_v4bx_. * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout and rm_no_fix_v4bx.stdout (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o, arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking, arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules. (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking and arm_no_fix_v4bx. * Makefile.in: Regenerate. * testsuite/arm_fix_v4bx.s: New file. * testsuite/arm_fix_v4bx.sh: Ditto. --- gold/arm.cc | 59 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 31 deletions(-) (limited to 'gold/arm.cc') diff --git a/gold/arm.cc b/gold/arm.cc index 136fed6..dde2d08 100644 --- a/gold/arm.cc +++ b/gold/arm.cc @@ -9880,30 +9880,6 @@ Target_arm::scan_reloc_for_stub( const Arm_relobj* arm_relobj = Arm_relobj::as_arm_relobj(relinfo->object); - if (r_type == elfcpp::R_ARM_V4BX) - { - const uint32_t reg = (addend & 0xf); - if (this->fix_v4bx() == General_options::FIX_V4BX_INTERWORKING - && reg < 0xf) - { - // Try looking up an existing stub from a stub table. - Stub_table* stub_table = - arm_relobj->stub_table(relinfo->data_shndx); - gold_assert(stub_table != NULL); - - if (stub_table->find_arm_v4bx_stub(reg) == NULL) - { - // create a new stub and add it to stub table. - Arm_v4bx_stub* stub = - this->stub_factory().make_arm_v4bx_stub(reg); - gold_assert(stub != NULL); - stub_table->add_arm_v4bx_stub(stub); - } - } - - return; - } - bool target_is_thumb; Symbol_value<32> symval; if (gsym != NULL) @@ -10094,15 +10070,36 @@ Target_arm::scan_reloc_section_for_stubs( continue; } + // Create a v4bx stub if --fix-v4bx-interworking is used. if (r_type == elfcpp::R_ARM_V4BX) { - // Get the BX instruction. - typedef typename elfcpp::Swap<32, big_endian>::Valtype Valtype; - const Valtype* wv = reinterpret_cast(view + offset); - elfcpp::Elf_types<32>::Elf_Swxword insn = - elfcpp::Swap<32, big_endian>::readval(wv); - this->scan_reloc_for_stub(relinfo, r_type, NULL, 0, NULL, - insn, NULL); + if (this->fix_v4bx() == General_options::FIX_V4BX_INTERWORKING) + { + // Get the BX instruction. + typedef typename elfcpp::Swap<32, big_endian>::Valtype Valtype; + const Valtype* wv = + reinterpret_cast(view + offset); + elfcpp::Elf_types<32>::Elf_Swxword insn = + elfcpp::Swap<32, big_endian>::readval(wv); + const uint32_t reg = (insn & 0xf); + + if (reg < 0xf) + { + // Try looking up an existing stub from a stub table. + Stub_table* stub_table = + arm_object->stub_table(relinfo->data_shndx); + gold_assert(stub_table != NULL); + + if (stub_table->find_arm_v4bx_stub(reg) == NULL) + { + // create a new stub and add it to stub table. + Arm_v4bx_stub* stub = + this->stub_factory().make_arm_v4bx_stub(reg); + gold_assert(stub != NULL); + stub_table->add_arm_v4bx_stub(stub); + } + } + } continue; } -- cgit v1.1