ARM MOVW/MOVT fixes

Paul Brook paul@codesourcery.com
Sat Mar 8 01:19:00 GMT 2008


The attached patch fixes a bunch of bugs in the handling of ARM MOVW and MOVT 
relocations.  Specifically:

 - Relocation addends were being encoded incorrectly.  This was a threefold 
failure. elf32_arm_relocate_section doesn't know how to handle these. The 
bitmask in the HOWTO table is wrong, and we don't check that that bitmask is 
sane before using the simple contiguous-bits fallback.

 - elf32_arm_final_link_relocate has an off by one error.  REL addends are 16 
bits including the sign bit.

 - Copy relocations are not generated when MOVW/T relocations refer to data 
objects in shared libraries.  elf32_arm_check_relocs should only set 
needs_plt for call type relocations.

 - The assembler enforces the wrong range for relocation addends.  It looks 
like someone got confused or copy/pasted from ADD/SUB instructions.

Paul

2008-03-07  Paul Brook  <paul@codesourcery.com>

	bfd/
	* elf32-arm.c (elf32_arm_howto_table_1): Fix bitmasks for MOVW and
	MOVT relocations.
	(elf32_arm_final_link_relocate): Fix off by one MOVW/MOVT sign
	extension.
	(elf32_arm_relocate_section): Handle MOVW and MOVT
	relocations.  Improve safety check for other weird relocations.
	(elf32_arm_check_relocs): Only set h->needs_plt for branch/call
	relocations.

	gas/
	* config/tc-arm.c (md_apply_fix): Use correct offset range.

	ld/testsuite/
	* ld-arm/arm-elf.exp (armelftests): Add movw-merge and arm-app-movw.
	* ld-arm/arm-app-movw.s: New test.
	* ld-arm/arm-app.r: Update expected output.
	* ld-arm/movw-merge.d: New test.
	* ld-arm/movw-merge.s: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: text/x-diff
Size: 11154 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20080308/2e9d0a89/attachment.bin>


More information about the Binutils mailing list