[RFA] Don't warn when using ld --wrap and code in Thumb-state on ARM
Matthew Gretton-Dann
matthew.gretton-dann@arm.com
Mon Mar 29 20:44:00 GMT 2010
Hi,
The following patch fixes an issue on ARM when compiling '__wrap_*'
functions (for use with ld's --wrap option) in Thumb state. This fixes
the two failures in ld/testsuite/ld-elf/wrap.exp. Please can someone
review and approve it.
The issue is that when the linker tries to wrap a function it assumes
the wrapper symbol (__wrap_<symbolname>) has the same symbol type as the
original symbol - STT_FUNC. However, in this case when the linker
actually sees the definition of the wrapper function it is given the
symbol type STT_ARM_TFUNC. This inconsistency between symbol types is
considered to be worthy of a warning by elf_link_add_object_symbols
(bfd/elflink.c around line 4347).
However, this change in symbol type is usually allowed for function
symbols - _bfd_elf_merge_symbol indicates this. But in this case this
hasn't been allowed because the test for both symbols being function
type symbols is done after an early exit for weak symbols.
The fix is to move the test for merging two function symbols, and so
whether to allow a symbol type change earlier in _bfd_elf_merge_symbol.
I have tested this on arm-none-linux-gnueabi, arm-none-elf,
x86_64-none-linux-gnu
Proposed ChangeLog:
2010-03-29 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* elflink.c (_bfd_elf_merge_symbol): Move test for both
symbols being a function earlier.
Thanks,
Matt
--
Matthew Gretton-Dann
Principal Engineer - Tools, PD Software
ARM Limited
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1003-symbol-type-check.patch
Type: text/x-patch
Size: 2349 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20100329/69f1a5a3/attachment.bin>
More information about the Binutils
mailing list