From 72d98d16ed09584660d0cbb759d90f8dfeef2343 Mon Sep 17 00:00:00 2001 From: Mickael Guene Date: Wed, 16 Dec 2015 10:09:05 +0100 Subject: [ARM] Add support for thumb1 pcrop relocations. To support thumb1 execute-only code we need to support four new relocations (R_ARM_THM_ALU_ABS_G0_NC, R_ARM_THM_ALU_ABS_G1_NC, R_ARM_THM_ALU_ABS_G2_NC and R_ARM_THM_ALU_ABS_G3_NC). These relocations allow the static linker to finalize construction of symbol address. Typical sequence of code to get address of the symbol foo is then the following : movs r3, #:upper8_15:#foo lsls r3, #8 adds r3, #:upper0_7:#foo lsls r3, #8 adds r3, #:lower8_15:#foo lsls r3, #8 adds r3, #:lower0_7:#foo This will give following sequence of text and relocations after assembly : 4: 2300 movs r3, #0 4: R_ARM_THM_ALU_ABS_G3_NC foo 6: 021b lsls r3, r3, #8 8: 3300 adds r3, #0 8: R_ARM_THM_ALU_ABS_G2_NC foo a: 021b lsls r3, r3, #8 c: 3300 adds r3, #0 c: R_ARM_THM_ALU_ABS_G1_NC foo e: 021b lsls r3, r3, #8 10: 3300 adds r3, #0 10: R_ARM_THM_ALU_ABS_G0_NC foo --- include/elf/arm.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/elf') diff --git a/include/elf/arm.h b/include/elf/arm.h index c64e788..5691118 100644 --- a/include/elf/arm.h +++ b/include/elf/arm.h @@ -230,6 +230,11 @@ START_RELOC_NUMBERS (elf_arm_reloc_type) RELOC_NUMBER (R_ARM_ME_TOO, 128) /* obsolete */ RELOC_NUMBER (R_ARM_THM_TLS_DESCSEQ ,129) + RELOC_NUMBER (R_ARM_THM_ALU_ABS_G0_NC,132) + RELOC_NUMBER (R_ARM_THM_ALU_ABS_G1_NC,133) + RELOC_NUMBER (R_ARM_THM_ALU_ABS_G2_NC,134) + RELOC_NUMBER (R_ARM_THM_ALU_ABS_G3_NC,135) + RELOC_NUMBER (R_ARM_IRELATIVE, 160) /* Extensions? R=read-only? */ -- cgit v1.1