diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-10-22 12:17:43 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-10-22 12:23:03 -0700 |
commit | bba037e0aef1f3b17cc6cf6fd041ed6110cc375a (patch) | |
tree | 6f2fad132412629daaf56228009b62eb7c9e4914 /bfd | |
parent | d236ad1955a0a6b5203bc1474b989fd9dba668f8 (diff) | |
download | gdb-bba037e0aef1f3b17cc6cf6fd041ed6110cc375a.zip gdb-bba037e0aef1f3b17cc6cf6fd041ed6110cc375a.tar.gz gdb-bba037e0aef1f3b17cc6cf6fd041ed6110cc375a.tar.bz2 |
Always keep sections marked with SEC_KEEP
SEC_KEEP check in elf_gc_sweep was missing in commit:
commit bde6f3eb6dff94cea1d471e15c6154d55d49820f
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Jan 8 01:43:23 2010 +0000
Set SEC_KEEP on section XXX for undefined __start_XXX/__stop_XXX
bfd/
2010-01-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/11133
* elflink.c (_bfd_elf_gc_mark_hook): Check section XXX for
undefined __start_XXX/__stop_XXX in all input files and set
SEC_KEEP.
This patch adds SEC_KEEP check to elf_gc_sweep.
bfd/
PR ld/19161
* elflink.c (elf_gc_sweep): Always keep sections marked with
SEC_KEEP.
ld/testsuite/
PR ld/19161
* ld-gc/gc.exp: Run pr19161 test.
* ld-gc/pr19161-1.c: New file.
* ld-gc/pr19161-2.c: Likewise.
* ld-gc/pr19161.d: Likewise.
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 e647a2b..60b79ed 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2015-10-22 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/19161 + * elflink.c (elf_gc_sweep): Always keep sections marked with + SEC_KEEP. + 2015-10-22 Hans-Peter Nilsson <hp@bitrange.com> * mmo.c (struct mmo_data_struct): New members diff --git a/bfd/elflink.c b/bfd/elflink.c index 73fe469..06df821 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -12449,7 +12449,8 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info) o->gc_mark = first->gc_mark; } - if (o->gc_mark) + /* Always keep sections marked with SEC_KEEP. */ + if (o->gc_mark || (o->flags & SEC_KEEP)) continue; /* Skip sweeping sections already excluded. */ |