[patch] Arm v4t Thumb shared libraries.

Paul Brook paul@codesourcery.com
Fri Aug 18 08:49:00 GMT 2006


The current arm-linux PLT sequence ends with the equivalent of

ldr pc, [ip]

This sequence is not interworking safe on armv4t hardware. To enable use of 
Thumb in shared libraries there are two options:

a) Use a new PLT sequence. Because we only have one scratch register and the 
requirements of the lazy resolver this means doubling the size of all PLT, 
entries and probably breaks prelinking.

b) Make sure that all functions exported from shared libraries are entered in 
Arm mode, inserting stubs as neccessary, thus avoiding the whole issue. This 
also means that prelinking and applications which do not use Thumb are 
uneffected.

The attached patch implements (b).  It reuses the existing infrastructure for 
generating arm->thumb stubs.

Ok?

Paul

2006-08-17  Paul Brook  <paul@codesourcery.com>

	bfd/
	* elf32-arm.c (elf32_arm_link_hash_entry): Add export_glue.
	(elf32_arm_link_hash_newfunc): Initialize export_glue.
	(record_arm_to_thumb_glue): Return stub symbol.
	(elf32_arm_create_thumb_stub): New function.
	(elf32_arm_to_thumb_stub): Use it.
	(elf32_arm_to_thumb_export_stub): New function.
	(elf32_arm_begin_write_processing): New function.
	(allocate_dynrelocs): Allocate Arm stubs.
	(elf_backend_begin_write_processing): Define.
	(elf32_arm_symbian_begin_write_processing): Remove ATTRIBUTE_UNUSED.
	Call elf32_arm_begin_write_processing.

	ld/
	* emultempl/armelf.em (arm_elf_before_allocation): Call
	gld${EMULATION_NAME}_before_allocation after setting interworking bfd.

	ld/testsuite/
	* ld-arm/arm-elf.exp (armelftests): Add armthumb-lib.so.  Add
	-use-blx to mixed-lib.so
	* ld-arm/armthumb-lib.d: New file.
	* ld-arm/armthumb-lib.sym: New file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.ld_v4t
Type: text/x-diff
Size: 13876 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060818/bf6661ca/attachment.bin>


More information about the Binutils mailing list