+2015-08-19 Jiong Wang <jiong.wang@arm.com>
+
+ * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation
+ types, including BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12,
+ BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
+ BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12,
+ BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
+ BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12,
+ BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC,
+ BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12,
+ BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC.
+ (elfNN_aarch64_final_link_relocate): Likewise.
+ * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
+ (_bfd_aarch64_elf_resolve_relocation): Likewise.
+
2015-08-19 Jiong Wang <jiong.wang@arm.com>
* reloc.c (BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12,
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21 \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PREL21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 \
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC:
case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
if (old_addend & ((1 << howto->rightshift) - 1))
return bfd_reloc_overflow;
/* Used for ldr*|str* rt, [rn, #uimm12] to provide the low order
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
+2015-08-19 Jiong Wang <jiong.wang@arm.com>
+
+ * ld-aarch64/emit-relocs-531.s: New testcase.
+ * ld-aarch64/emit-relocs-531-overflow.s: Likewise.
+ * ld-aarch64/emit-relocs-532.s: Likewise.
+ * ld-aarch64/emit-relocs-533.s: Likewise.
+ * ld-aarch64/emit-relocs-533-overflow.s: Likewise.
+ * ld-aarch64/emit-relocs-534.s: Likewise.
+ * ld-aarch64/emit-relocs-535.s: Likewise.
+ * ld-aarch64/emit-relocs-535-overflow.s: Likewise.
+ * ld-aarch64/emit-relocs-536.s: Likewise.
+ * ld-aarch64/emit-relocs-537.s: Likewise.
+ * ld-aarch64/emit-relocs-537-overflow.s: Likewise.
+ * ld-aarch64/emit-relocs-538.s: Likewise.
+ * ld-aarch64/emit-relocs-531.d: New expectation file.
+ * ld-aarch64/emit-relocs-531-overflow.d: Likewise.
+ * ld-aarch64/emit-relocs-532.d: Likewise.
+ * ld-aarch64/emit-relocs-533.d: Likewise.
+ * ld-aarch64/emit-relocs-533-overflow.d: Likewise.
+ * ld-aarch64/emit-relocs-534.d: Likewise.
+ * ld-aarch64/emit-relocs-535.d: Likewise.
+ * ld-aarch64/emit-relocs-535-overflow.d: Likewise.
+ * ld-aarch64/emit-relocs-536.d: Likewise.
+ * ld-aarch64/emit-relocs-537.d: Likewise.
+ * ld-aarch64/emit-relocs-537-overflow.d: Likewise.
+ * ld-aarch64/emit-relocs-538.d: Likewise.
+ * ld-aarch64/aarch64-elf.exp: Run new testcases.
+
2015-08-19 Jiong Wang <jiong.wang@arm.com>
* ld-aarch64/emit-relocs-87.s: New testcase.
run_dump_test "emit-relocs-529"
run_dump_test "emit-relocs-529-overflow"
run_dump_test "emit-relocs-530"
+run_dump_test "emit-relocs-531"
+run_dump_test "emit-relocs-531-overflow"
+run_dump_test "emit-relocs-532"
+run_dump_test "emit-relocs-533"
+run_dump_test "emit-relocs-533-overflow"
+run_dump_test "emit-relocs-534"
+run_dump_test "emit-relocs-535"
+run_dump_test "emit-relocs-535-overflow"
+run_dump_test "emit-relocs-536"
+run_dump_test "emit-relocs-537"
+run_dump_test "emit-relocs-537-overflow"
+run_dump_test "emit-relocs-538"
# test addend correctness when --emit-relocs specified for non-relocatable obj.
run_dump_test "emit-relocs-local-addend"
--- /dev/null
+#source: emit-relocs-531-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_LDST8_DTPREL_LO12 against symbol `v2' .*
--- /dev/null
+ .global v1
+ .size v1, 4096
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 4096
+v2:
+ .word 0xcafecafe
+
+ .text
+ ldrsb x22, [x1, #:dtprel_lo12:v2]
--- /dev/null
+#source: emit-relocs-531.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: 39801115 ldrsb x21, \[x8,#4\]
+ 10000: R_AARCH64_TLSLD_LDST8_DTPREL_LO12 v2
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .word 0xcafecafe
+
+ .text
+ ldrsb x21, [x8, #:dtprel_lo12:v2]
--- /dev/null
+#source: emit-relocs-532.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: 3980109d ldrsb x29, \[x4,#4\]
+ 10000: R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC v2
+ 10004: 398020f2 ldrsb x18, \[x7,#8\]
+ 10004: R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC v3
--- /dev/null
+ .global v1
+ .global v2
+ .size v2, 4100
+ .global v3
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .zero 4100
+v3:
+ .word 0xcafecafe
+
+ .text
+ ldrsb x29, [x4, #:dtprel_lo12_nc:v2]
+
+ # should not issue overflow error.
+ ldrsb x18, [x7, #:dtprel_lo12_nc:v3]
--- /dev/null
+#source: emit-relocs-533-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_LDST16_DTPREL_LO12 against symbol `v2' .*
--- /dev/null
+ .global v1
+ .size v1, 4096
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 4096
+v2:
+ .word 0xcafecafe
+
+ .text
+ ldrsh x2, [x17, #:dtprel_lo12:v2]
--- /dev/null
+#source: emit-relocs-533.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: 798008eb ldrsh x11, \[x7,#4\]
+ 10000: R_AARCH64_TLSLD_LDST16_DTPREL_LO12 v2
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .word 0xcafecafe
+
+ .text
+ ldrsh x11, [x7, #:dtprel_lo12:v2]
--- /dev/null
+#source: emit-relocs-534.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: 798009d6 ldrsh x22, \[x14,#4\]
+ 10000: R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC v2
+ 10004: 79a71a28 ldrsh x8, \[x17,#5004\]
+ 10004: R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC v3
--- /dev/null
+ .global v1
+ .global v2
+ .size v2, 5000
+ .global v3
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .zero 5000
+v3:
+ .word 0xcafecafe
+
+ .text
+ ldrsh x22, [x14, #:dtprel_lo12_nc:v2]
+
+ # should not issue overflow error.
+ ldrsh x8, [x17, #:dtprel_lo12_nc:v3]
--- /dev/null
+#source: emit-relocs-535-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_LDST32_DTPREL_LO12 against symbol `v2' .*
--- /dev/null
+ .global v1
+ .size v1, 4096
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 4096
+v2:
+ .word 0xcafecafe
+
+ .text
+ ldrsw x2, [x17, #:dtprel_lo12:v2]
--- /dev/null
+#source: emit-relocs-535.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: b9800661 ldrsw x1, \[x19,#4\]
+ 10000: R_AARCH64_TLSLD_LDST32_DTPREL_LO12 v2
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .word 0xcafecafe
+
+ .text
+ ldrsw x1, [x19, #:dtprel_lo12:v2]
--- /dev/null
+#source: emit-relocs-536.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: b98005d6 ldrsw x22, \[x14,#4\]
+ 10000: R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC v2
+ 10004: b9800628 ldrsw x8, \[x17,#4\]
+ 10004: R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC v3
--- /dev/null
+ .global v1
+ .global v2
+ .size v2, 16384
+ .global v3
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .zero 16384
+v3:
+ .word 0xcafecafe
+
+ .text
+ ldrsw x22, [x14, #:dtprel_lo12_nc:v2]
+
+ # should not issue overflow error.
+ ldrsw x8, [x17, #:dtprel_lo12_nc:v3]
--- /dev/null
+#source: emit-relocs-537-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_LDST64_DTPREL_LO12 against symbol `v2' .*
--- /dev/null
+ .global v1
+ .size v1, 4096
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 4096
+v2:
+ .word 0xcafecafe
+
+ .text
+ ldr x12, [x13, #:dtprel_lo12:v2]
--- /dev/null
+#source: emit-relocs-537.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: f9400520 ldr x0, \[x9,#8\]
+ 10000: R_AARCH64_TLSLD_LDST64_DTPREL_LO12 v2
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+ .word 0xdeaddead
+v2:
+ .word 0xcafecafe
+ .word 0xcafecafe
+
+ .text
+ ldr x0, [x9, #:dtprel_lo12:v2]
--- /dev/null
+#source: emit-relocs-538.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: f9400482 ldr x2, \[x4,#8\]
+ 10000: R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC v2
+ 10004: f940062e ldr x14, \[x17,#8\]
+ 10004: R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC v3
--- /dev/null
+ .global v1
+ .global v2
+ .size v2, 32768
+ .global v3
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+ .word 0xdeaddead
+v2:
+ .zero 32768
+v3:
+ .word 0xcafecafe
+ .word 0xcafecafe
+
+ .text
+ ldr x2, [x4, #:dtprel_lo12_nc:v2]
+
+ # should not issue overflow error.
+ ldr x14, [x17, #:dtprel_lo12_nc:v3]