diff options
author | Jiong Wang <jiong.wang@arm.com> | 2015-08-19 11:26:56 +0100 |
---|---|---|
committer | Jiong Wang <jiong.wang@arm.com> | 2015-08-19 16:57:38 +0100 |
commit | 07c9aa07cdcf00eff8e186f3ca1779e5e3ffdb75 (patch) | |
tree | 7db77658cc9a0d1869f7eecb356f5dfe49874383 /ld | |
parent | 4c5625238cccb048261d7ce0eb748ee5e0d67cf0 (diff) | |
download | gdb-07c9aa07cdcf00eff8e186f3ca1779e5e3ffdb75.zip gdb-07c9aa07cdcf00eff8e186f3ca1779e5e3ffdb75.tar.gz gdb-07c9aa07cdcf00eff8e186f3ca1779e5e3ffdb75.tar.bz2 |
[AArch64][6/6] LD support TLSLD load/store relocation types
2015-08-19 Jiong Wang <jiong.wang@arm.com>
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.
Diffstat (limited to 'ld')
26 files changed, 276 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index d838cac..dbf7358 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,5 +1,33 @@ 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. * ld-aarch64/emit-relocs-88.s: Likewise. * ld-aarch64/emit-relocs-88-overflow.s: Likewise. diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index b8e801f..cbbe6a9 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 0000000..e22c7a4 --- /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 0000000..812548a --- /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 0000000..588f127 --- /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 0000000..2888cdd --- /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 0000000..f5f49b8 --- /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 0000000..d8ef35f --- /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 0000000..528693b --- /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 0000000..9a9cbcc --- /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 0000000..09b3d11 --- /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 0000000..9238ed2 --- /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 0000000..e2fa478 --- /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 0000000..4265046 --- /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 0000000..882edf4 --- /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 0000000..33e632f --- /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 0000000..32766bf --- /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 0000000..0b83a2a --- /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 0000000..862208a --- /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 0000000..cb7d3d8 --- /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 0000000..3ad6b2a --- /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 0000000..a9903c3 --- /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 0000000..82cc9bb --- /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 0000000..00f9de3 --- /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 0000000..dffde23 --- /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 0000000..4822dd3 --- /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] |