diff options
author | Will Newton <will.newton@linaro.org> | 2014-03-14 11:45:32 +0000 |
---|---|---|
committer | Will Newton <will.newton@linaro.org> | 2014-03-25 09:01:50 +0000 |
commit | c955de363b91edba8a92877f97b1be68357d9582 (patch) | |
tree | ec54faa2f116cfd2a1f1c65720fc92e86ab52403 /ld/testsuite/ld-aarch64 | |
parent | 3e60bf4df86f323dde4281886a355589488149aa (diff) | |
download | gdb-c955de363b91edba8a92877f97b1be68357d9582.zip gdb-c955de363b91edba8a92877f97b1be68357d9582.tar.gz gdb-c955de363b91edba8a92877f97b1be68357d9582.tar.bz2 |
bfd/elfnn-aarch64.c: Fix calculation of DT_RELASZ
The current code subtracts the size of the output section containing
relplt from RELASZ. In some cases this will be the same output
section as the dynamic relocs causing a value of zero to be output.
Calculating the size from input sections seems to make more sense.
bfd/ChangeLog:
2014-03-25 Will Newton <will.newton@linaro.org>
* elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_sections):
Set value of DT_PLTRELSZ and DT_RELASZ based on the size
of input sections rather than output sections.
ld/testsuite/ChangeLog:
2014-03-25 Will Newton <will.newton@linaro.org>
* ld-aarch64/aarch64-elf.exp: Add relasz dump test.
* ld-aarch64/relasz.d: New file.
* ld-aarch64/relasz.s: Likewise.
Diffstat (limited to 'ld/testsuite/ld-aarch64')
-rw-r--r-- | ld/testsuite/ld-aarch64/aarch64-elf.exp | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/relasz.d | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/relasz.s | 9 |
3 files changed, 29 insertions, 0 deletions
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index 32cf73a..845ea20 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -157,3 +157,5 @@ run_dump_test "ifunc-19b" run_dump_test "ifunc-20" run_dump_test "ifunc-21" run_dump_test "ifunc-22" + +run_dump_test "relasz" diff --git a/ld/testsuite/ld-aarch64/relasz.d b/ld/testsuite/ld-aarch64/relasz.d new file mode 100644 index 0000000..5cc5595 --- /dev/null +++ b/ld/testsuite/ld-aarch64/relasz.d @@ -0,0 +1,18 @@ +#source: relasz.s +#ld: -shared -Taarch64.ld +#readelf: -d +# Check that the RELASZ section has the correct size even if we are +# using a non-default linker script that merges .rela.dyn and .rela.plt +# in the output. + +Dynamic section at offset 0x[0-9a-f]+ contains 9 entries: + Tag Type Name/Value + 0x0000000000000004 \(HASH\) 0x[0-9a-f]+ + 0x0000000000000005 \(STRTAB\) 0x[0-9a-f]+ + 0x0000000000000006 \(SYMTAB\) 0x[0-9a-f]+ + 0x000000000000000a \(STRSZ\) [0-9]+ \(bytes\) + 0x000000000000000b \(SYMENT\) [0-9]+ \(bytes\) + 0x0000000000000007 \(RELA\) 0x[0-9a-f]+ + 0x0000000000000008 \(RELASZ\) 24 \(bytes\) + 0x0000000000000009 \(RELAENT\) 24 \(bytes\) + 0x0000000000000000 \(NULL\) 0x0 diff --git a/ld/testsuite/ld-aarch64/relasz.s b/ld/testsuite/ld-aarch64/relasz.s new file mode 100644 index 0000000..8c7f891 --- /dev/null +++ b/ld/testsuite/ld-aarch64/relasz.s @@ -0,0 +1,9 @@ + .text + .global func + .type func, %function +func: + adrp x0, :got:foo + ldr x0, [x0, #:got_lo12:foo] + ldr w0, [x0] + ret + .size func, .-func |