diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2020-10-02 11:08:19 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-10-02 11:08:19 +0100 |
commit | 7026832e52cff026f877616ac0033c7bb8d1df6f (patch) | |
tree | f51aba6d7c5928bdf994047762182a07ba7a6627 /bfd | |
parent | 048fde1ef43843aa67e9ac30829e0d30f019a7dd (diff) | |
download | gdb-7026832e52cff026f877616ac0033c7bb8d1df6f.zip gdb-7026832e52cff026f877616ac0033c7bb8d1df6f.tar.gz gdb-7026832e52cff026f877616ac0033c7bb8d1df6f.tar.bz2 |
Allow note sections to be discarded when they are linked to another discarded secction.
PR 26681
bfd * elflink.c (bfd_elf_gc_sections): Do not arbitrarily keep note
sections which are linked to another section.
ld * testsuite/ld-elf/pr26681.s: New test.
* testsuite/ld-elf/pr26681.d: New test driver.
* testsuite/ld-elf/pr26681.l: New test output.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elflink.c | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 317c0d3..623cb8a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-10-02 H.J. Lu <hongjiu.lu@intel.com> + + PR 26681 + * elflink.c (bfd_elf_gc_sections): Do not arbitrarily keep note + sections which are linked to another section. + 2020-09-28 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com> * cpu-arm.c: (processors) Add Cortex-X1. diff --git a/bfd/elflink.c b/bfd/elflink.c index b693729..e23d189 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -14102,7 +14102,8 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) || (elf_section_data (o)->this_hdr.sh_type == SHT_FINI_ARRAY))) || (elf_section_data (o)->this_hdr.sh_type == SHT_NOTE - && elf_next_in_group (o) == NULL ))) + && elf_next_in_group (o) == NULL + && elf_linked_to_section (o) == NULL))) { if (!_bfd_elf_gc_mark (info, o, gc_mark_hook)) return FALSE; |