Thumb interworking on untyped symbols

Paul Brook paul@codesourcery.com
Tue May 31 16:42:00 GMT 2011


The ARM EABI requires that linkers support interworking for function 
(STT_FUNC) symbols, either via veneers or by bl/blx conversion.  We already do 
this.

However for untyped symbols we blindly assume that these are ARM code.  At the 
time this was implemented it probably made sense - the EABI didn't exist and 
most of the world was ARM mode anyway.  With the advent of Thumb-2 and ARMv7-
M, likely as not this is wrong.

The EABI only requires interworking be performed for function symbols.  For 
other symbols the behavior is less clear, the EABI stating that "interworking 
for untyped symbols must be encoded directly in the object file".  By my 
reading that means we should assume the user wrote bl/blx as appropriate and 
leave well alone.

The attached patch implements this by effectively disabling veneer generation 
for symbols that do not have funciton type.

Tested on arm-none-eabi
Applied to CVS head

Paul

2011-05-31  Paul Brook  <paul@codesourcery.com>

	bfd/
	* elf32-arm.c (elf32_arm_final_link_relocate): Only do bl conversion
	for known functions.
	(elf32_arm_swap_symbol_in): Only set ST_BRANCH_TO_ARM for function
	symbols.

	include/elf/
	* arm.h (arm_st_branch_type): Add ST_BRANCH_UNKNOWN.

	ld/testsuite/
	* ld-arm/cortex-a8-far.d: Adjust expected output.
	* ld-arm/arm-call1.s: Give function symbol correct type.
	* ld-arm/arm-call2.s: Ditto.
	* ld-arm/farcall-group4.s: Ditto.
	* ld-arm/arm-elf.exp (cortex-a8-far): Define far symbols with correct
	type via assembly file.
	* ld-arm/cortex-a8-far-3.s: New file.
	* ld-arm/abs-call-1.s: Add Thumb tests
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: text/x-patch
Size: 4973 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20110531/efa603af/attachment.bin>


More information about the Binutils mailing list