[PATCH] Add support for ARM AAPCS R_ARM_V4BX relocation type

Julian Brown julian@codesourcery.com
Fri Jan 28 15:24:00 GMT 2005


Hi,

This patch adds support for the R_ARM_V4BX relocation type to bfd and 
ld. This allows objects compiled for the ARMv4 architecture to be 
interworking-safe when linked with other objects compiled for ARMv4t, 
but also allows pure ARMv4 binaries to be built from the same ARMv4 objects.

In the latter case, the switch "--fix-v4bx" must be passed to the 
linker, which causes v4t "BX rM" instructions to be rewritten as "MOV 
PC,rM", since v4 processors do not have a BX instruction.

In the former case, the switch should not be used, and R_ARM_V4BX 
relocations are ignored.

Tested on i686-pc-linux-gnu and arm-none-eabi.

ChangeLog:

	* bfd/bin-in.h (bfd_elf32_arm_set_target_relocs): Update
	prototype.
	* bfd/bin-in2.h (bfd_elf32_arm_set_target_relocs): Update
	prototype.
	* bfd/elf32-arm.c (elf32_arm_link_hash_table): Add fix_v4bx
	flag.
	(bfd_elf32_arm_set_target_relocs): Add formal parameter fix_v4bx
	for passing flag value from ld. Set flag value in global hash
	table entry.
	(elf32_arm_final_link_relocate): Add code to implement
	R_ARM_V4BX relocation.
	* ld/emultempl/armelf.em (fix_v4bx): New variable.
	(arm_elf_create_output_section_statements): Communicate fix_v4bx
	flag value to bfd.
	(PARSE_AND_LIST_PROLOGUE): Add option token OPTION_FIX_V4BX.
	(PARSE_AND_LIST_LONGOPTS): Add option --fix-v4bx.
	(PARSE_AND_LIST_OPTIONS): Add option --fix-v4bx.
	(PARSE_AND_LIST_ARGS_CASES): Add option OPTION_FIX_V4BX.

-- 
Julian Brown
CodeSourcery, LLC
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binutils-patch-2
URL: <https://sourceware.org/pipermail/binutils/attachments/20050128/009a55f0/attachment.ksh>


More information about the Binutils mailing list