This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] Arm local fuction symbols
- From: Paul Brook <paul at nowt dot org>
- To: binutils at sourceware dot org
- Date: Tue, 9 May 2006 17:09:37 +0100
- Subject: [patch] Arm local fuction symbols
[I originally sent this patch a while ago, but messed up the To: address, so
it may have been missed]
The Arm EABI says that relocations against local symbols may only be
substituted for a different symbol if neither of the symbols has type
STT_FUNC, both are Arm functions or both are Thumb functions.
This means relocations against function symbols must not be converted into
relocations against section symbols.
The patch below tweaks arm_fix_adjustable to achieve this.
Tested with cross to arm-none-eabi.
Ok?
Paul
2005-04-01 Paul Brook <paul@codesourcery.com>
* config/tc-arm.c (arm_fix_adjustable): Return 0 for function symbols.
Index: gas/config/tc-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/config/tc-arm.c,v
retrieving revision 1.252
diff -u -p -r1.252 tc-arm.c
--- gas/config/tc-arm.c 21 Mar 2006 22:52:06 -0000 1.252
+++ gas/config/tc-arm.c 1 Apr 2006 13:04:46 -0000
@@ -12575,9 +12575,9 @@ arm_fix_adjustable (fixS * fixP)
#endif
#ifdef OBJ_ELF
-/* Relocations against Thumb function names must be left unadjusted,
- so that the linker can use this information to correctly set the
- bottom bit of their addresses. The MIPS version of this function
+/* Relocations against function names must be left unadjusted,
+ so that the linker can use this information to generate interworking
+ stubs. The MIPS version of this function
also prevents relocations that are mips-16 specific, but I do not
know why it does this.
@@ -12594,6 +12594,10 @@ arm_fix_adjustable (fixS * fixP)
if (fixP->fx_addsy == NULL)
return 1;
+ /* Preserve reloactions against symbols with function type. */
+ if (symbol_get_bfdsym (fixP->fx_addsy)->flags & BSF_FUNCTION)
+ return 0;
+
if (THUMB_IS_FUNC (fixP->fx_addsy)
&& fixP->fx_subsy == NULL)
return 0;