aboutsummaryrefslogtreecommitdiff
path: root/ld/ChangeLog
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2017-02-23 18:16:11 +0000
committerMaciej W. Rozycki <macro@imgtec.com>2017-02-24 13:48:10 +0000
commitc9f02c3e29498fd9ecb1a9719c317c305fe509ae (patch)
tree98d242f7920db114993dd9294fe37390155f6cdb /ld/ChangeLog
parent7db2c58848ca683f3b09e687a9b012dbb49316af (diff)
downloadgdb-c9f02c3e29498fd9ecb1a9719c317c305fe509ae.zip
gdb-c9f02c3e29498fd9ecb1a9719c317c305fe509ae.tar.gz
gdb-c9f02c3e29498fd9ecb1a9719c317c305fe509ae.tar.bz2
readelf: Fix incorrect "Version definition past end of section" message
Fix a commit 74e1a04b9787 ("More fixes for reading corrupt ELF files.") `readelf --version-info' regression that caused "Version definition past end of section" to be always printed at the end, even with good section data. For example with the `mips-linux' target we get: $ cat ver_def.s .data .globl new_foo .type new_foo, %object new_foo: .symver new_foo, foo@@ver_foo $ cat ver_def.ver { global: *foo*; local: *; }; $ as -o ver_def.o ver_def.s $ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o $ readelf -V ver_def Version symbols section '.gnu.version' contains 4 entries: Addr: 000000000000007e Offset: 0x01007e Link: 2 (.dynsym) 000: 0 (*local*) 2 (ver_foo) 1 (*global*) 2 (ver_foo) Version definition section '.gnu.version_d' contains 2 entries: Addr: 0x0000000000000088 Offset: 0x010088 Link: 3 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: ver_def 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_foo Version definition past end of section $ The cause is the `if (idx + ent.vd_next <= idx)' condition introduced to ensure forward progress, which however always triggers for good version definition section data as the last entry will have its `vd_next' value set to 0. Adjust the condition then, to say `if (idx + ent.vd_next < idx)' instead and to ensure forward progress limit the number of entries processed to the size of the version definition section, removing the problematic message from output quoted above, while ensuring the original PR 17531 test case is still handled gracefully. Add a suitable test case so that we have `readelf --version-info' coverage; due to the lack of infrastructure needed to run the linker in the `binutils' test suite and limited justification to implement it add a new `readelf.exp' script to the `ld' test suite instead, intended to gather any `readelf' test cases that require the linker to be run. If ever we decide to have linker infrastructure added to the `binutils' test suite, then the script can be moved between the test suites. binutils/ * readelf.c (process_version_sections) <SHT_GNU_verdef>: Limit the number of entries processed by the section size. Don't break out of the loop if `ent.vd_next' is 0. ld/ * testsuite/ld-elf/ver_def.d: New test. * testsuite/ld-elf/ver_def.ld: New test linker script. * testsuite/ld-elf/ver_def.ver: New test version script. * testsuite/ld-elf/ver_def.s: New test source. * testsuite/ld-elf/readelf.exp: New test script.
Diffstat (limited to 'ld/ChangeLog')
-rw-r--r--ld/ChangeLog8
1 files changed, 8 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 420a9ab..5236ae8 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2017-02-24 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/ld-elf/ver_def.d: New test.
+ * testsuite/ld-elf/ver_def.ld: New test linker script.
+ * testsuite/ld-elf/ver_def.ver: New test version script.
+ * testsuite/ld-elf/ver_def.s: New test source.
+ * testsuite/ld-elf/readelf.exp: New test script.
+
2017-02-23 Maciej W. Rozycki <macro@imgtec.com>
* testsuite/ld-mips-elf/relax-jalr-n32.d: Remove `--relax'