This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: strip_unneeded removes to much symbols (not working) -> something new?
- To: reinhard dot jessich at telering dot at
- Subject: Re: strip_unneeded removes to much symbols (not working) -> something new?
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 21 Jun 2001 17:40:37 +0100
- Cc: binutils at gcc dot gnu dot org
- References: <01051521415800.01152@localhost.localdomain><m31ypfdqvr.fsf@north-pole.nickc.cambridge.redhat.com><01060400363400.00870@localhost.localdomain>
Hi Reinhard,
OK, I have a patch for the first problem. Or at least the first
problem as it happened for me. I did not get a seg fault inside
styp_to_sec_flags() but inside handle_COMDAT, which is helper
routine for the tidied up version of styp_to_sec_flags in the current
CVS sources.
The problem was that --strip-unneeded was removing all local
symbols, and COMDAT sections store important information in the
local symbols. Hence the patch prevents --strip-unneeded from
removing local symbols in COMDAT sections.
I have not tried to reproduce your second problem. If after
applying this patch (*) it still exists, please could you report it
to the binutils mailing list (binutils@gcc.gnu.org) along with a
step by step guide on how to reproduce it. Thanks very much.
Cheers
Nick
2001-06-21 Nick Clifton <nickc@cambridge.redhat.com>
* objcopy.c (filter_symbols): Do not strip local symbols in COMDAT
sections.
Index: binutils/objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.18
diff -p -r1.18 objcopy.c
*** objcopy.c 2001/05/30 10:46:26 1.18
--- objcopy.c 2001/06/21 16:29:42
*************** filter_symbols (abfd, obfd, osyms, isyms
*** 787,792 ****
--- 787,796 ----
keep = (strip_symbols != STRIP_DEBUG
&& strip_symbols != STRIP_UNNEEDED
&& ! convert_debugging);
+ else if (bfd_get_section (sym)->comdat)
+ /* COMDAT sections store special information in local
+ symbols, so we cannot risk stripping any of them. */
+ keep = 1;
else /* Local symbol. */
keep = (strip_symbols != STRIP_UNNEEDED
&& (discard_locals != LOCALS_ALL