ARM uClinux branch veneers

Paul Brook paul@codesourcery.com
Tue Mar 20 20:19:00 GMT 2007


uClinux executabes are created by linking a static binary (using absolute 
addressing) with --emit-relocs, and using the relocations to tell the OS 
loader how to relocate the boundary. The compiler generated branch veneers 
don't have any relocations, so elf2flt/uclinux doesn't know to relocate them.

The patch below adds a new ld option to generation of PIC sequences for 
ARM->Thumb interworking veneers.  Normally this only happens when generating 
a shared library or PIE.

Other possible solutions to this problem are to hack elf2flt to magically 
recognise veneers and fix them up (ugly and fragile), or to output 
relocations for the veneers (hard).

I considered creating a uclinux specific linker emulation. However the 
commandline option is conceivably useful in other circumstances, so I didn't 
bother.

Tested on arm-none-eabi and arm-uclinux-uclibceabi.
Applied to head.

Paul

2007-03-20  Paul Brook  <paul@codesourcery.com>

	ld/
	* emultempl/armelf.em (pic_veneer): New variable.
	(PARSE_AND_LIST_PROLOGUE): Add OPTION_PIC_VENEER.
	(PARSE_AND_LIST_ARGS_CASES): Ditto.
	(PARSE_AND_LIST_LONGOPTS): Add "pic-veneer".
	(PARSE_AND_LIST_OPTIONS): Ditto.
	* ld.texinfo: Document --pic-veneer.

	ld/testsuite/
	* ld-arm/arm-elf.exp (ld-arm/arm-elf.exp): Add arm-pic-veneer.
	* ld-arm/arm-pic-veneer.d: New test.
	* ld-arm/arm-pic-veneer.s: New test.

	bfd/
	* bfd-in.h (bfd_elf32_arm_set_target_relocs): Update prototype.
	* bfd-in2.h: Regenerate.
	* elf32-arm.c (elf32_arm_link_hash_table): Add pic_veneer.
	(record_arm_to_thumb_glue): Use globals->pic_veneer.
	(elf32_arm_create_thumb_stub): Ditto.
	(bfd_elf32_arm_set_target_relocs): Set globals->pic_veneer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.pic_veneer
Type: text/x-diff
Size: 8107 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20070320/5881db96/attachment.bin>


More information about the Binutils mailing list