This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: strip --strip-unneeded adds back section symbols
- From: Nick Clifton <nickc at redhat dot com>
- To: Andrei Borzenkov <arvidjaar at gmail dot com>, binutils at sourceware dot org, The development of GNU GRUB <grub-devel at gnu dot org>
- Date: Mon, 1 Feb 2016 11:34:43 +0000
- Subject: Re: strip --strip-unneeded adds back section symbols
- Authentication-results: sourceware.org; auth=none
- References: <CAA91j0XasGffa+pMcjzgNTU7hUzxjwr6gGRHSxn6vhu=qG8m1g at mail dot gmail dot com>
Hi Andrei,
It appears that recent binutils (earliest version I have is 2.24)
unconditionally add back section symbols when copying sections.
Please could you file a bug report about this in the binutils bugzilla system:
https://sourceware.org/bugzilla/
I verified that filter_symbols() in strip actually removes everything
from source module, and symbol table reappears deep in call chain
initiated by copy_section(), where STT_SECTION is unconditionally
added for every present section.
Was this change intentional?
Yes and no. The change to add a section symbol to any newly created section was intentional. This is helpful for a variety of reasons, not least being able to create relocations against that symbol.
The side effect of adding a symbol when actually trying to strip unneeded symbols was unintentional, and is a bug. I have not investigated yet, but I suspect that the simplest solution will be to make strip rerun its symbol removing pass after having copied all of the sections.
Cheers
Nick