diff options
author | Jiong Wang <jiong.wang@arm.com> | 2015-08-19 11:18:25 +0100 |
---|---|---|
committer | Jiong Wang <jiong.wang@arm.com> | 2015-08-19 16:40:18 +0100 |
commit | 6ffe9a1ba36f3a896ae323e35a207b6451e8f7f9 (patch) | |
tree | 352d08b939394f5b6749416c6e1800966d999be6 /ld | |
parent | 49df5539f9070c01128135a7d63f44b2efc4de6a (diff) | |
download | gdb-6ffe9a1ba36f3a896ae323e35a207b6451e8f7f9.zip gdb-6ffe9a1ba36f3a896ae323e35a207b6451e8f7f9.tar.gz gdb-6ffe9a1ba36f3a896ae323e35a207b6451e8f7f9.tar.bz2 |
[AArch64][4/6] LD support TLSLD move/add relocation types
2015-08-19 Jiong Wang <jiong.wang@arm.com>
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.
Diffstat (limited to 'ld')
30 files changed, 284 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index edf5b7a..d838cac 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,5 +1,36 @@ 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. diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index bb8f4c2..b8e801f 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 0000000..d2d719d --- /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 0000000..b2c4e5c --- /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 0000000..d15b015 --- /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 0000000..58480b8 --- /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 0000000..6588062 --- /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 0000000..b52595e --- /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 0000000..7a29afb --- /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 0000000..28e953f --- /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 0000000..ed432d6 --- /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 0000000..3216468 --- /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 0000000..a546cd8 --- /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 0000000..04dc37c --- /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 0000000..ed754ff --- /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 0000000..1a3645f --- /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 0000000..ee2797f --- /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 0000000..6e6a0b4 --- /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 0000000..dce85b6 --- /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 0000000..5d1162e --- /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 0000000..cedf505 --- /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 0000000..a4e5265 --- /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 0000000..a6f6320 --- /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 0000000..cd5eda2 --- /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 0000000..33cf0cc --- /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 0000000..b4d135c --- /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 0000000..f5f65b5 --- /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 0000000..e10298d --- /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 0000000..d6ef58b --- /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 0000000..e60f9ba --- /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 |