This patch implement relocation operation according to ARM EABI section
4.7.1.1
and 4.7.1.2. Trunk binutils malfunctions when linking objection files
relocating
non-4-byte aligned location with R_ARM_THM_PC8 type.
Original bfd missed following two EABI updates, as extracted from aaelf
2.08:
***
4.7.1.1 Addends and PC-bias compensation
For R_ARM_THM_PC8 the initial addend is formed by the formula (((imm + 4) &
0x3ff) - 4), where imm is the normal interpretation of the immediate field
in a Thumb LDR(3)/LDR(lliteral) instruction.
4.7.1.2
Pa is the adjusted address of the place being relocated, defined as (P &
0xFFFFFFFC).
R_ARM_THM_PC8: S + A - Pa
R_ARM_THM_ALU_PREL_11_0: ((S + A) | T) - Pa
R_ARM_THM_PC12: S + A - Pa
***
Test case not available since GAS doesn't generate these types of
relocation.
OK to trunk and 2.21/2.22?
ChangeLog:
2012-10-19 Joey Ye <joey.ye@arm.com>
* elf32-arm.c (elf32_arm_final_link_relocate,
case R_ARM_THM_ALU_PREL_11_0, case R_ARM_THM_PC12): Align address of
the place being relocated.
(elf32_arm_final_link_relocate, case R_ARM_THM_PC8): Align address
of the place being relocated and truncate addend.
(Pa): New macro.