diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2009-01-14 21:52:49 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2009-01-14 21:52:49 +0000 |
commit | a33dafc30dd1cbe7b7659b5b15c553804abef185 (patch) | |
tree | 350f368cac04ec8894b1592431169c117b16280c /bfd/elflink.c | |
parent | adb483feb8b53555613d1165a6c6de4bdc1a5160 (diff) | |
download | binutils-gdb-a33dafc30dd1cbe7b7659b5b15c553804abef185.tar.gz |
bfd/
2009-01-14 H.J. Lu <hongjiu.lu@intel.com>
PR ld/9727
* elflink.c (elf_gc_sweep): Exclude the group section if the
first member of the section group is excluded.
ld/testsuite/
2009-01-14 H.J. Lu <hongjiu.lu@intel.com>
PR ld/9727
* ld-elf/group8.s: New.
* ld-elf/group8a.d: Likewise.
* ld-elf/group8b.d: Likewise.
* ld-elf/group9.s: Likewise.
* ld-elf/group9a.d: Likewise.
* ld-elf/group9b.d: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 29523c4614e..d2cc31a8b16 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -11397,10 +11397,21 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info) for (o = sub->sections; o != NULL; o = o->next) { - /* Keep debug and special sections. */ - if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0 - || (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0) - o->gc_mark = 1; + /* When any section in a section group is kept, we keep all + sections in the section group. If the first member of + the section group is excluded, we will also exclude the + group section. */ + if (o->flags & SEC_GROUP) + { + asection *first = elf_next_in_group (o); + o->gc_mark = first->gc_mark; + } + else if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0 + || (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0) + { + /* Keep debug and special sections. */ + o->gc_mark = 1; + } if (o->gc_mark) continue; |