This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
relocations against weak and global syms (for ARM)
- To: binutils at sources dot redhat dot com
- Subject: relocations against weak and global syms (for ARM)
- From: Harshad R Joglekar <harshad dot joglekar at wipro dot com>
- Date: Tue, 04 Sep 2001 18:25:18 +0530
- Organization: Wipro
Hi,
I am not sure if it qualifies as a bug. Anyway here goes. I tried this
with the ARM assembler (binutils 2.11.2, target arm-elf). Note that
'foo' is a weak symbol, and that the relocation entries are not
consistent.
--------- input file ---------
.text
b foo
b foo + (end - start)
.weak foo
foo:
.equ start, 0
.equ end, 0
---------- output dump -----------------
readelf -r a.out
Relocation section '.rel.text' at offset 0x234 contains 2 entries:
Offset Info Type Symbol's Value Symbol's Name
00000000 00601 R_ARM_PC24 00000008 foo
00000004 00101 R_ARM_PC24 00000000 .text
----------------------------------------
The first relocation is against 'foo' while the second is against
'.text'. So if the weak symbol 'foo' were to be overridden, the
relocation will remain unaffected. This seems to be happening because
tc_fix_adjustable() checks whether it's immediate argument is weak; it
doesn't recursively descend the expression tree.
Attempting a quick-fix, I tried a recusive algorithm, for a port I am
working on. But that leads to another problem :)
adjust_reloc_syms() rearranges a complex expression containing undefined
symbols / common symbols to a simple expression of the type "symbol
+ xxxx". But it does NOT do so for weak or global symbols. I tried
hacking symbols.c, but it didn't work for all kinds of expressions.
Is there a simpler / cleaner solution?
regards,
Harshad
----------------------------------------------------------------------------------------------------------------------
Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and
is intended for use only by the individual or entity to which it is
addressed, and may contain information that is privileged, confidential or
exempt from disclosure under applicable law. If you are not the intended
recipient or it appears that this mail has been forwarded to you without
proper authority, you are notified that any use or dissemination of this
information in any manner is strictly prohibited. In such cases, please
notify us immediately at mailto:mailadmin@wipro.com and delete this mail
from your records.
----------------------------------------------------------------------------------------------------------------------