From 07c9aa07cdcf00eff8e186f3ca1779e5e3ffdb75 Mon Sep 17 00:00:00 2001 From: Jiong Wang Date: Wed, 19 Aug 2015 11:26:56 +0100 Subject: [PATCH] [AArch64][6/6] LD support TLSLD load/store relocation types 2015-08-19 Jiong Wang bfd/ * 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. ld/testsuite/ * 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. --- bfd/ChangeLog | 15 ++++++++++ bfd/elfnn-aarch64.c | 16 +++++++++++ bfd/elfxx-aarch64.c | 16 +++++++++++ ld/testsuite/ChangeLog | 28 +++++++++++++++++++ ld/testsuite/ld-aarch64/aarch64-elf.exp | 12 ++++++++ .../ld-aarch64/emit-relocs-531-overflow.d | 4 +++ .../ld-aarch64/emit-relocs-531-overflow.s | 11 ++++++++ ld/testsuite/ld-aarch64/emit-relocs-531.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-531.s | 10 +++++++ ld/testsuite/ld-aarch64/emit-relocs-532.d | 9 ++++++ ld/testsuite/ld-aarch64/emit-relocs-532.s | 17 +++++++++++ .../ld-aarch64/emit-relocs-533-overflow.d | 4 +++ .../ld-aarch64/emit-relocs-533-overflow.s | 11 ++++++++ ld/testsuite/ld-aarch64/emit-relocs-533.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-533.s | 10 +++++++ ld/testsuite/ld-aarch64/emit-relocs-534.d | 9 ++++++ ld/testsuite/ld-aarch64/emit-relocs-534.s | 17 +++++++++++ .../ld-aarch64/emit-relocs-535-overflow.d | 4 +++ .../ld-aarch64/emit-relocs-535-overflow.s | 11 ++++++++ ld/testsuite/ld-aarch64/emit-relocs-535.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-535.s | 10 +++++++ ld/testsuite/ld-aarch64/emit-relocs-536.d | 9 ++++++ ld/testsuite/ld-aarch64/emit-relocs-536.s | 17 +++++++++++ .../ld-aarch64/emit-relocs-537-overflow.d | 4 +++ .../ld-aarch64/emit-relocs-537-overflow.s | 11 ++++++++ ld/testsuite/ld-aarch64/emit-relocs-537.d | 7 +++++ ld/testsuite/ld-aarch64/emit-relocs-537.s | 12 ++++++++ ld/testsuite/ld-aarch64/emit-relocs-538.d | 9 ++++++ ld/testsuite/ld-aarch64/emit-relocs-538.s | 19 +++++++++++++ 29 files changed, 323 insertions(+) create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-532.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-532.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-534.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-534.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-536.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-536.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537.s create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-538.d create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-538.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4edf56d95dd..dcd0e88b65e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,18 @@ +2015-08-19 Jiong Wang + + * 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 * reloc.c (BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 083bb0fdab2..9935308bee7 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -180,6 +180,14 @@ || (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 \ @@ -5312,6 +5320,14 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, 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: diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index 82c6ec9fcb9..34bd1a69022 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -276,6 +276,14 @@ _bfd_aarch64_elf_put_addend (bfd *abfd, 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 @@ -409,6 +417,14 @@ _bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type r_type, 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: diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index d838cac8002..dbf7358aa7f 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,31 @@ +2015-08-19 Jiong Wang + + * 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 * ld-aarch64/emit-relocs-87.s: New testcase. diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index b8e801f550a..cbbe6a91477 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -136,6 +136,18 @@ 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" +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" diff --git a/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d new file mode 100644 index 00000000000..e22c7a4a2be --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d @@ -0,0 +1,4 @@ +#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' .* diff --git a/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s new file mode 100644 index 00000000000..812548a40f9 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 4096 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 4096 +v2: + .word 0xcafecafe + + .text + ldrsb x22, [x1, #:dtprel_lo12:v2] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-531.d b/ld/testsuite/ld-aarch64/emit-relocs-531.d new file mode 100644 index 00000000000..588f127e25f --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-531.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-531.s b/ld/testsuite/ld-aarch64/emit-relocs-531.s new file mode 100644 index 00000000000..2888cddfe01 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-531.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .word 0xdeaddead +v2: + .word 0xcafecafe + + .text + ldrsb x21, [x8, #:dtprel_lo12:v2] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-532.d b/ld/testsuite/ld-aarch64/emit-relocs-532.d new file mode 100644 index 00000000000..f5f49b8407f --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-532.d @@ -0,0 +1,9 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-532.s b/ld/testsuite/ld-aarch64/emit-relocs-532.s new file mode 100644 index 00000000000..d8ef35ff444 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-532.s @@ -0,0 +1,17 @@ + .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] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d new file mode 100644 index 00000000000..528693b245f --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d @@ -0,0 +1,4 @@ +#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' .* diff --git a/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s new file mode 100644 index 00000000000..9a9cbccc05d --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 4096 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 4096 +v2: + .word 0xcafecafe + + .text + ldrsh x2, [x17, #:dtprel_lo12:v2] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-533.d b/ld/testsuite/ld-aarch64/emit-relocs-533.d new file mode 100644 index 00000000000..09b3d11cb5d --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-533.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-533.s b/ld/testsuite/ld-aarch64/emit-relocs-533.s new file mode 100644 index 00000000000..9238ed26424 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-533.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .word 0xdeaddead +v2: + .word 0xcafecafe + + .text + ldrsh x11, [x7, #:dtprel_lo12:v2] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-534.d b/ld/testsuite/ld-aarch64/emit-relocs-534.d new file mode 100644 index 00000000000..e2fa478794f --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-534.d @@ -0,0 +1,9 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-534.s b/ld/testsuite/ld-aarch64/emit-relocs-534.s new file mode 100644 index 00000000000..4265046ac47 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-534.s @@ -0,0 +1,17 @@ + .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] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d new file mode 100644 index 00000000000..882edf4c8f6 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d @@ -0,0 +1,4 @@ +#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' .* diff --git a/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s new file mode 100644 index 00000000000..33e632fb15a --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 4096 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 4096 +v2: + .word 0xcafecafe + + .text + ldrsw x2, [x17, #:dtprel_lo12:v2] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-535.d b/ld/testsuite/ld-aarch64/emit-relocs-535.d new file mode 100644 index 00000000000..32766bfbe91 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-535.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-535.s b/ld/testsuite/ld-aarch64/emit-relocs-535.s new file mode 100644 index 00000000000..0b83a2aebfa --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-535.s @@ -0,0 +1,10 @@ + .global v1 + .global v2 + .section .tdata,"awT",%progbits +v1: + .word 0xdeaddead +v2: + .word 0xcafecafe + + .text + ldrsw x1, [x19, #:dtprel_lo12:v2] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-536.d b/ld/testsuite/ld-aarch64/emit-relocs-536.d new file mode 100644 index 00000000000..862208a80e5 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-536.d @@ -0,0 +1,9 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-536.s b/ld/testsuite/ld-aarch64/emit-relocs-536.s new file mode 100644 index 00000000000..cb7d3d8409d --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-536.s @@ -0,0 +1,17 @@ + .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] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d new file mode 100644 index 00000000000..3ad6b2a2854 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d @@ -0,0 +1,4 @@ +#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' .* diff --git a/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s new file mode 100644 index 00000000000..a9903c3692d --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s @@ -0,0 +1,11 @@ + .global v1 + .size v1, 4096 + .global v2 + .section .tdata,"awT",%progbits +v1: + .zero 4096 +v2: + .word 0xcafecafe + + .text + ldr x12, [x13, #:dtprel_lo12:v2] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-537.d b/ld/testsuite/ld-aarch64/emit-relocs-537.d new file mode 100644 index 00000000000..82cc9bbbb42 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-537.d @@ -0,0 +1,7 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-537.s b/ld/testsuite/ld-aarch64/emit-relocs-537.s new file mode 100644 index 00000000000..00f9de35f84 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-537.s @@ -0,0 +1,12 @@ + .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] diff --git a/ld/testsuite/ld-aarch64/emit-relocs-538.d b/ld/testsuite/ld-aarch64/emit-relocs-538.d new file mode 100644 index 00000000000..dffde2337d1 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-538.d @@ -0,0 +1,9 @@ +#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 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-538.s b/ld/testsuite/ld-aarch64/emit-relocs-538.s new file mode 100644 index 00000000000..4822dd3a647 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-538.s @@ -0,0 +1,19 @@ + .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] -- 2.30.2