From 6ffe9a1ba36f3a896ae323e35a207b6451e8f7f9 Mon Sep 17 00:00:00 2001 From: Jiong Wang Date: Wed, 19 Aug 2015 11:18:25 +0100 Subject: [PATCH] [AArch64][4/6] LD support TLSLD move/add relocation types 2015-08-19 Jiong Wang bfd/ 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. ld/testsuite/ * 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. --- bfd/ChangeLog | 14 +++++++++ bfd/elfnn-aarch64.c | 12 +++++++ bfd/elfxx-aarch64.c | 12 +++++++ ld/testsuite/ChangeLog | 31 +++++++++++++++++++ ld/testsuite/ld-aarch64/aarch64-elf.exp | 14 +++++++++ ld/testsuite/ld-aarch64/emit-relocs-523.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-523.s | 11 +++++++ ld/testsuite/ld-aarch64/emit-relocs-524.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-524.s | 11 +++++++ ld/testsuite/ld-aarch64/emit-relocs-525.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-525.s | 11 +++++++ .../ld-aarch64/emit-relocs-526-overflow.d | 4 +++ .../ld-aarch64/emit-relocs-526-overflow.s | 10 ++++++ ld/testsuite/ld-aarch64/emit-relocs-526.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-526.s | 10 ++++++ ld/testsuite/ld-aarch64/emit-relocs-527.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-527.s | 10 ++++++ .../ld-aarch64/emit-relocs-528-overflow.d | 4 +++ .../ld-aarch64/emit-relocs-528-overflow.s | 11 +++++++ ld/testsuite/ld-aarch64/emit-relocs-528.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-528.s | 11 +++++++ ld/testsuite/ld-aarch64/emit-relocs-87.d | 8 +++++ ld/testsuite/ld-aarch64/emit-relocs-87.s | 10 ++++++ .../ld-aarch64/emit-relocs-88-overflow.d | 5 +++ .../ld-aarch64/emit-relocs-88-overflow.s | 10 ++++++ ld/testsuite/ld-aarch64/emit-relocs-88.d | 8 +++++ ld/testsuite/ld-aarch64/emit-relocs-88.s | 10 ++++++ ld/testsuite/ld-aarch64/emit-relocs-89.d | 8 +++++ ld/testsuite/ld-aarch64/emit-relocs-89.s | 10 ++++++ .../ld-aarch64/emit-relocs-90-overflow.d | 5 +++ .../ld-aarch64/emit-relocs-90-overflow.s | 11 +++++++ ld/testsuite/ld-aarch64/emit-relocs-90.d | 8 +++++ ld/testsuite/ld-aarch64/emit-relocs-90.s | 11 +++++++ 33 files changed, 322 insertions(+) create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-523.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-523.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-524.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-524.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-525.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-525.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-526-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-526-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-526.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-526.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-527.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-527.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-528-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-528-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-528.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-528.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-87.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-87.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-88-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-88-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-88.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-88.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-89.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-89.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-90-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-90-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-90.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-90.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index efef958851..a106380823 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2015-08-19 Jiong Wang + + 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 * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 6051108342..eb79922ac5 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -174,11 +174,17 @@ || (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 \ @@ -5183,8 +5189,14 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, *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); diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index dbb134aa6b..82c6ec9fcb 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -249,6 +249,7 @@ _bfd_aarch64_elf_put_addend (bfd *abfd, 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: @@ -291,6 +292,9 @@ _bfd_aarch64_elf_put_addend (bfd *abfd, 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: @@ -318,6 +322,8 @@ _bfd_aarch64_elf_put_addend (bfd *abfd, 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); @@ -400,8 +406,14 @@ _bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type r_type, 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; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index edf5b7a6cc..d838cac800 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,34 @@ +2015-08-19 Jiong Wang + + * 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 * ld-aarch64/emit-relocs-530.s: New testcase. diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index bb8f4c2396..b8e801f550 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -68,6 +68,12 @@ run_dump_test "weak-undefined" 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" @@ -119,6 +125,14 @@ run_dump_test "emit-relocs-309-low-bad" 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" diff --git a/ld/testsuite/ld-aarch64/emit-relocs-523.d b/ld/testsuite/ld-aarch64/emit-relocs-523.d new file mode 100644 index 0000000000..d2d719d6b5 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-523.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-523.s b/ld/testsuite/ld-aarch64/emit-relocs-523.s new file mode 100644 index 0000000000..b2c4e5c9c0 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-523.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 65536 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 65536 +v2: + .word 0xcafecafe + + .text + movk x29, #:dtprel_g2:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-524.d b/ld/testsuite/ld-aarch64/emit-relocs-524.d new file mode 100644 index 0000000000..d15b015aeb --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-524.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-524.s b/ld/testsuite/ld-aarch64/emit-relocs-524.s new file mode 100644 index 0000000000..58480b8bd7 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-524.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 65536 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 65536 +v2: + .word 0xcafecafe + + .text + movk x29, #:dtprel_g1:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-525.d b/ld/testsuite/ld-aarch64/emit-relocs-525.d new file mode 100644 index 0000000000..6588062011 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-525.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-525.s b/ld/testsuite/ld-aarch64/emit-relocs-525.s new file mode 100644 index 0000000000..b52595ea86 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-525.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 65536 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 65536 +v2: + .word 0xcafecafe + + .text + movk x17, #:dtprel_g1_nc:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-526-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-526-overflow.d new file mode 100644 index 0000000000..7a29afb9c0 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-526-overflow.d @@ -0,0 +1,4 @@ +#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' .* diff --git a/ld/testsuite/ld-aarch64/emit-relocs-526-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-526-overflow.s new file mode 100644 index 0000000000..28e953ff0a --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-526-overflow.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 65536 +v2: + .word 0xcafecafe + + .text + movk x17, #:dtprel_g0:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-526.d b/ld/testsuite/ld-aarch64/emit-relocs-526.d new file mode 100644 index 0000000000..ed432d6069 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-526.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-526.s b/ld/testsuite/ld-aarch64/emit-relocs-526.s new file mode 100644 index 0000000000..321646855b --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-526.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .word 0xdeaddead +v2: + .word 0xcafecafe + + .text + movk x17, #:dtprel_g0:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-527.d b/ld/testsuite/ld-aarch64/emit-relocs-527.d new file mode 100644 index 0000000000..a546cd8ac2 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-527.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-527.s b/ld/testsuite/ld-aarch64/emit-relocs-527.s new file mode 100644 index 0000000000..04dc37c3d9 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-527.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .word 0xdeaddead +v2: + .word 0xcafecafe + + .text + movk x17, #:dtprel_g0_nc:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-528-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-528-overflow.d new file mode 100644 index 0000000000..ed754ff6d2 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-528-overflow.d @@ -0,0 +1,4 @@ +#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' .* diff --git a/ld/testsuite/ld-aarch64/emit-relocs-528-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-528-overflow.s new file mode 100644 index 0000000000..1a3645fbbf --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-528-overflow.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 16777216 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 16777216 +v2: + .word 0xcafecafe + + .text + add x20, x9, #:dtprel_hi12:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-528.d b/ld/testsuite/ld-aarch64/emit-relocs-528.d new file mode 100644 index 0000000000..ee2797f071 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-528.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-528.s b/ld/testsuite/ld-aarch64/emit-relocs-528.s new file mode 100644 index 0000000000..6e6a0b480b --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-528.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 40960 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 40960 +v2: + .word 0xcafecafe + + .text + add x20, x9, #:dtprel_hi12:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-87.d b/ld/testsuite/ld-aarch64/emit-relocs-87.d new file mode 100644 index 0000000000..dce85b6ae5 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-87.d @@ -0,0 +1,8 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-87.s b/ld/testsuite/ld-aarch64/emit-relocs-87.s new file mode 100644 index 0000000000..5d1162e87a --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-87.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .word 0xdeaddead +v2: + .word 0xcafecafe + + .text + movk x21, #:dtprel_g1:v1 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-88-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-88-overflow.d new file mode 100644 index 0000000000..cedf505c32 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-88-overflow.d @@ -0,0 +1,5 @@ +#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' .* diff --git a/ld/testsuite/ld-aarch64/emit-relocs-88-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-88-overflow.s new file mode 100644 index 0000000000..a4e526589b --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-88-overflow.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 65536 +v2: + .word 0xcafecafe + + .text + movk x21, #:dtprel_g0:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-88.d b/ld/testsuite/ld-aarch64/emit-relocs-88.d new file mode 100644 index 0000000000..a6f6320879 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-88.d @@ -0,0 +1,8 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-88.s b/ld/testsuite/ld-aarch64/emit-relocs-88.s new file mode 100644 index 0000000000..cd5eda2536 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-88.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .word 0xdeaddead +v2: + .word 0xcafecafe + + .text + movk x21, #:dtprel_g0:v1 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-89.d b/ld/testsuite/ld-aarch64/emit-relocs-89.d new file mode 100644 index 0000000000..33cf0cc7c9 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-89.d @@ -0,0 +1,8 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-89.s b/ld/testsuite/ld-aarch64/emit-relocs-89.s new file mode 100644 index 0000000000..b4d135c0ab --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-89.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .word 0xdeaddead +v2: + .word 0xcafecafe + + .text + movk x21, #:dtprel_g0_nc:v1 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-90-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-90-overflow.d new file mode 100644 index 0000000000..f5f65b518d --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-90-overflow.d @@ -0,0 +1,5 @@ +#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' .* diff --git a/ld/testsuite/ld-aarch64/emit-relocs-90-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-90-overflow.s new file mode 100644 index 0000000000..e10298d617 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-90-overflow.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 16777216 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 16777216 +v2: + .word 0xcafecafe + + .text + add w20, w9, #:dtprel_hi12:v2 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-90.d b/ld/testsuite/ld-aarch64/emit-relocs-90.d new file mode 100644 index 0000000000..d6ef58bae3 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-90.d @@ -0,0 +1,8 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-90.s b/ld/testsuite/ld-aarch64/emit-relocs-90.s new file mode 100644 index 0000000000..e60f9ba839 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-90.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 409600 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 409600 +v2: + .word 0xcafecafe + + .text + add w20, w9, #:dtprel_hi12:v2 -- 2.34.1