[PATCH][GOLD] Treat R_ARM_PREL31 as a function call in Target_arm::Scan::get_reference_flags
Doug Kwan (關振德)
dougkwan@google.com
Wed Dec 8 02:25:00 GMT 2010
Hi,
This patch fixes a number of test breakage in which R_ARM_PREL31
relocations point to weak symbols of personality routines in ARM
unwind tables. The existing code does not general PLTs for references
from R_ARM_PREL31 and ultimately it causes tests to crash on ARM. The
patch was tested on armv7l-linux-gnueabi in qemu.
-Doug
2010-12-07 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
like function call relocations.
-------------- next part --------------
Index: gold/arm.cc
===================================================================
RCS file: /cvs/src/src/gold/arm.cc,v
retrieving revision 1.128
diff -u -u -p -r1.128 arm.cc
--- gold/arm.cc 11 Nov 2010 10:43:30 -0000 1.128
+++ gold/arm.cc 8 Dec 2010 02:07:24 -0000
@@ -7646,7 +7646,6 @@ Target_arm<big_endian>::Scan::get_refere
case elfcpp::R_ARM_THM_MOVW_BREL:
case elfcpp::R_ARM_GOTOFF32:
case elfcpp::R_ARM_GOTOFF12:
- case elfcpp::R_ARM_PREL31:
case elfcpp::R_ARM_SBREL31:
return Symbol::RELATIVE_REF;
@@ -7659,6 +7658,10 @@ Target_arm<big_endian>::Scan::get_refere
case elfcpp::R_ARM_THM_JUMP6:
case elfcpp::R_ARM_THM_JUMP11:
case elfcpp::R_ARM_THM_JUMP8:
+ // R_ARM_PREL31 is not used to relocate call/jump instructions but
+ // in unwind tables. It may point to functions via PLTs.
+ // So we treat it like call/jump relocations above.
+ case elfcpp::R_ARM_PREL31:
return Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF;
case elfcpp::R_ARM_GOT_BREL:
More information about the Binutils
mailing list