aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-02-13 14:09:48 +1030
committerAlan Modra <amodra@gmail.com>2018-02-13 22:55:49 +1030
commit6e5e9d58c1eeef5677c90886578a895cb8c164c5 (patch)
treecb2ae019115967a391262d5f9533e0fd19e7944f /ld
parentf2731e0c374e5323ce4cdae2bcc7b7fe22da1a6f (diff)
downloadgdb-6e5e9d58c1eeef5677c90886578a895cb8c164c5.zip
gdb-6e5e9d58c1eeef5677c90886578a895cb8c164c5.tar.gz
gdb-6e5e9d58c1eeef5677c90886578a895cb8c164c5.tar.bz2
PR22836, "-r -s" doesn't work with -g3 using GCC 7
This fixes the case where all of a group is removed with ld -r, the situation in the PR, and failures where part of a group is removed that contain relocs. bfd/ PR 22836 * elf.c (_bfd_elf_fixup_group_sections): Account for removed relocation sections. If size reduces to just the flag word, remove that too and mark with SEC_EXCLUDE. * elflink.c (bfd_elf_final_link): Strip empty group sections. binutils/ * testsuite/binutils-all/group-7.s, * testsuite/binutils-all/group-7a.d, * testsuite/binutils-all/group-7b.d, * testsuite/binutils-all/group-7c.d: New tests. * testsuite/binutils-all/objcopy.exp: Run them. ld/ * testsuite/ld-elf/pr22836-2.d, * testsuite/ld-elf/pr22836-2.s: New test.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/testsuite/ld-elf/pr22836-2.d7
-rw-r--r--ld/testsuite/ld-elf/pr22836-2.s7
3 files changed, 20 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 236517a..c5b35e6 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,11 @@
2018-02-13 Alan Modra <amodra@gmail.com>
+ PR 22836
+ * testsuite/ld-elf/pr22836-2.d,
+ * testsuite/ld-elf/pr22836-2.s: New test.
+
+2018-02-13 Alan Modra <amodra@gmail.com>
+
* testsuite/ld-x86-64/pr14207.d: Adjust relro p_filesz.
2018-02-07 Alan Modra <amodra@gmail.com>
diff --git a/ld/testsuite/ld-elf/pr22836-2.d b/ld/testsuite/ld-elf/pr22836-2.d
new file mode 100644
index 0000000..10133e4
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22836-2.d
@@ -0,0 +1,7 @@
+#source: pr22836-2.s
+#ld: -r -S
+#readelf: -g --wide
+
+group section \[[ 0-9]+\] `\.group' \[foo\] contains 1 section.*
+ \[Index\] Name
+ \[[ 0-9]+\] \.comment
diff --git a/ld/testsuite/ld-elf/pr22836-2.s b/ld/testsuite/ld-elf/pr22836-2.s
new file mode 100644
index 0000000..77cd83a
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22836-2.s
@@ -0,0 +1,7 @@
+ .section .debug_macro,"G",%progbits,foo
+ .long .LASF0
+.LASF0:
+ .string "__STDC__ 1"
+
+ .section .comment,"G",%progbits,foo
+ .asciz "hi"