2015-08-19 Jiong Wang <jiong.wang@arm.com>
+ PR ld/18276
+ * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation
+ types, including BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12,
+ BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0,
+ BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC,
+ BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1,
+ BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC,
+ BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2.
+ (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_ADD_DTPREL_HI12,
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0,
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC,
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19 \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12 \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12 \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC \
|| (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_MOVW_DTPREL_G0 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2 \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12 \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12 \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC \
*unresolved_reloc_p = FALSE;
break;
+ 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_MOVW_DTPREL_G0:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2:
value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,
signed_addend - dtpoff_base (info),
weak_undef_p);
case BFD_RELOC_AARCH64_ADD_LO12:
case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC:
case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+ 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_ADD_LO12_NC:
case BFD_RELOC_AARCH64_MOVW_G0_S:
case BFD_RELOC_AARCH64_MOVW_G1_S:
case BFD_RELOC_AARCH64_MOVW_G2_S:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2:
case BFD_RELOC_AARCH64_MOVW_G2:
case BFD_RELOC_AARCH64_MOVW_G2_NC:
case BFD_RELOC_AARCH64_MOVW_G3:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
contents = reencode_movw_imm (contents, addend);
case BFD_RELOC_AARCH64_MOVW_G2_NC:
case BFD_RELOC_AARCH64_MOVW_G2_S:
case BFD_RELOC_AARCH64_MOVW_G3:
+ 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_MOVW_DTPREL_G0:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2:
value = value + addend;
break;
2015-08-19 Jiong Wang <jiong.wang@arm.com>
+ * ld-aarch64/emit-relocs-87.s: New testcase.
+ * ld-aarch64/emit-relocs-88.s: Likewise.
+ * ld-aarch64/emit-relocs-88-overflow.s: Likewise.
+ * ld-aarch64/emit-relocs-89.s: Likewise.
+ * ld-aarch64/emit-relocs-90.s: Likewise.
+ * ld-aarch64/emit-relocs-90-overflow.s: Likewise.
+ * ld-aarch64/emit-relocs-523.s: Likewise.
+ * ld-aarch64/emit-relocs-524.s: Likewise.
+ * ld-aarch64/emit-relocs-525.s: Likewise.
+ * ld-aarch64/emit-relocs-527.s: Likewise.
+ * ld-aarch64/emit-relocs-526.s: Likewise.
+ * ld-aarch64/emit-relocs-528.s: Likewise.
+ * ld-aarch64/emit-relocs-528-overflow.s: Likewise.
+ * ld-aarch64/emit-relocs-87.d: New expectation file.
+ * ld-aarch64/emit-relocs-88.d: Likewise.
+ * ld-aarch64/emit-relocs-88-overflow.d: Likewise.
+ * ld-aarch64/emit-relocs-89.d: Likewise.
+ * ld-aarch64/emit-relocs-90.d: Likewise.
+ * ld-aarch64/emit-relocs-90-overflow.d: Likewise.
+ * ld-aarch64/emit-relocs-91.d: Likewise.
+ * ld-aarch64/emit-relocs-523.d: Likewise.
+ * ld-aarch64/emit-relocs-524.d: Likewise.
+ * ld-aarch64/emit-relocs-525.d: Likewise.
+ * ld-aarch64/emit-relocs-526.d: Likewise.
+ * ld-aarch64/emit-relocs-527.d: Likewise.
+ * ld-aarch64/emit-relocs-528.d: Likewise.
+ * ld-aarch64/emit-relocs-528-overflow.d: Likewise.
+ * ld-aarch64/aarch64-elf.exp: Run new testcases.
+
+2015-08-19 Jiong Wang <jiong.wang@arm.com>
+
* ld-aarch64/emit-relocs-530.s: New testcase.
* ld-aarch64/emit-relocs-92.s: Likewise.
* ld-aarch64/emit-relocs-530.d: New expectation file.
run_dump_test "emit-relocs-28"
run_dump_test "emit-relocs-86"
run_dump_test "emit-relocs-86-overflow"
+run_dump_test "emit-relocs-87"
+run_dump_test "emit-relocs-88"
+run_dump_test "emit-relocs-88-overflow"
+run_dump_test "emit-relocs-89"
+run_dump_test "emit-relocs-90"
+run_dump_test "emit-relocs-90-overflow"
run_dump_test "emit-relocs-92"
run_dump_test "emit-relocs-257"
run_dump_test "emit-relocs-257-be"
run_dump_test "emit-relocs-311"
run_dump_test "emit-relocs-312"
run_dump_test "emit-relocs-313"
+run_dump_test "emit-relocs-523"
+run_dump_test "emit-relocs-524"
+run_dump_test "emit-relocs-525"
+run_dump_test "emit-relocs-526"
+run_dump_test "emit-relocs-526-overflow"
+run_dump_test "emit-relocs-527"
+run_dump_test "emit-relocs-528"
+run_dump_test "emit-relocs-528-overflow"
run_dump_test "emit-relocs-529"
run_dump_test "emit-relocs-529-overflow"
run_dump_test "emit-relocs-530"
--- /dev/null
+#source: emit-relocs-523.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: f2c0001d movk x29, #0x0, lsl #32
+ 10000: R_AARCH64_TLSLD_MOVW_DTPREL_G2 v2
--- /dev/null
+ .global v1
+ .size v1, 65536
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 65536
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x29, #:dtprel_g2:v2
--- /dev/null
+#source: emit-relocs-524.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: f2a0003d movk x29, #0x1, lsl #16
+ 10000: R_AARCH64_TLSLD_MOVW_DTPREL_G1 v2
--- /dev/null
+ .global v1
+ .size v1, 65536
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 65536
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x29, #:dtprel_g1:v2
--- /dev/null
+#source: emit-relocs-525.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: f2a00031 movk x17, #0x1, lsl #16
+ 10000: R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC v2
--- /dev/null
+ .global v1
+ .size v1, 65536
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 65536
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x17, #:dtprel_g1_nc:v2
--- /dev/null
+#source: emit-relocs-526-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_MOVW_DTPREL_G0 against symbol `v2' .*
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 65536
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x17, #:dtprel_g0:v2
--- /dev/null
+#source: emit-relocs-526.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: f2800091 movk x17, #0x4
+ 10000: R_AARCH64_TLSLD_MOVW_DTPREL_G0 v2
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x17, #:dtprel_g0:v2
--- /dev/null
+#source: emit-relocs-527.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: f2800091 movk x17, #0x4
+ 10000: R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC v2
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x17, #:dtprel_g0_nc:v2
--- /dev/null
+#source: emit-relocs-528-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_ADD_DTPREL_HI12 against symbol `v2' .*
--- /dev/null
+ .global v1
+ .size v1, 16777216
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 16777216
+v2:
+ .word 0xcafecafe
+
+ .text
+ add x20, x9, #:dtprel_hi12:v2
--- /dev/null
+#source: emit-relocs-528.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+ 10000: 91002934 add x20, x9, #0xa
+ 10000: R_AARCH64_TLSLD_ADD_DTPREL_HI12 v2
--- /dev/null
+ .global v1
+ .size v1, 40960
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 40960
+v2:
+ .word 0xcafecafe
+
+ .text
+ add x20, x9, #:dtprel_hi12:v2
--- /dev/null
+#source: emit-relocs-87.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -e0 --emit-relocs
+#objdump: -dr
+#...
+.* <.text>:
+ .*: f2a00015 movk x21, #0x0, lsl #16
+ .*: R_AARCH64_P32_TLSLD_MOVW_DTPREL_G1 v1
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x21, #:dtprel_g1:v1
--- /dev/null
+#source: emit-relocs-88-overflow.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_P32_TLSLD_MOVW_DTPREL_G0 against symbol `v2' .*
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 65536
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x21, #:dtprel_g0:v2
--- /dev/null
+#source: emit-relocs-88.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -e0 --emit-relocs
+#objdump: -dr
+#...
+.* <.text>:
+ .*: f2800015 movk x21, #0x0
+ .*: R_AARCH64_P32_TLSLD_MOVW_DTPREL_G0 v1
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x21, #:dtprel_g0:v1
--- /dev/null
+#source: emit-relocs-89.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -e0 --emit-relocs
+#objdump: -dr
+#...
+.* <.text>:
+ .*: f2800015 movk x21, #0x0
+ .*: R_AARCH64_P32_TLSLD_MOVW_DTPREL_G0_NC v1
--- /dev/null
+ .global v1
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .word 0xdeaddead
+v2:
+ .word 0xcafecafe
+
+ .text
+ movk x21, #:dtprel_g0_nc:v1
--- /dev/null
+#source: emit-relocs-90-overflow.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_P32_TLSLD_ADD_DTPREL_HI12 against symbol `v2' .*
--- /dev/null
+ .global v1
+ .size v1, 16777216
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 16777216
+v2:
+ .word 0xcafecafe
+
+ .text
+ add w20, w9, #:dtprel_hi12:v2
--- /dev/null
+#source: emit-relocs-90.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -e0 --emit-relocs
+#objdump: -dr
+#...
+.* <.text>:
+ .*: 11019134 add w20, w9, #0x64
+ .*: R_AARCH64_P32_TLSLD_ADD_DTPREL_HI12 v2
--- /dev/null
+ .global v1
+ .size v1, 409600
+ .global v2
+ .section .tdata,"awT",%progbits
+v1:
+ .zero 409600
+v2:
+ .word 0xcafecafe
+
+ .text
+ add w20, w9, #:dtprel_hi12:v2