* strip --strip-unneeded adds back section symbols
@ 2016-01-29 6:13 Andrei Borzenkov
2016-02-01 11:34 ` Nick Clifton
0 siblings, 1 reply; 3+ messages in thread
From: Andrei Borzenkov @ 2016-01-29 6:13 UTC (permalink / raw)
To: binutils, The development of GNU GRUB
GRUB builds most of its code as loadable ELF modules. To reduce
run-time size they are passed through "strip --strip-unneeded" (we
also do some more mangling, full code is here [3]). Recently we added
build-time module verifier to catch possible problems in toolchains
output. After that we got bug report from FreeBSD user [1] that GRUB
build started to fail. It was traced to module verifier reporting
error for one specific module. One of checks is for non-empty symbol
table and this module [2] got empty table after strip. According to
user, this happened with both
elftoolchain r3223M
GNU binutils 2.17.50 [FreeBSD] 2007-07-03
This module is actually empty placeholder that does not have any code
and data and exists only for the custom section that lists module
dependencies.
I could verify this behavior after building 2.17 (binutils-2_17 tag) from GIT.
It appears that recent binutils (earliest version I have is 2.24)
unconditionally add back section symbols when copying sections. 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? Is there any standard that requires
presence of these symbols in every ELF object? Note that these symbols
passed filter as unneeded and as GRUB developer I would rather welcome
2.17 behavior that allows us to further reduce run-time image size.
Thank you!
[1] https://savannah.gnu.org/bugs/?46986
[2] https://savannah.gnu.org/bugs/download.php?file_id=36182
[3] http://git.savannah.gnu.org/cgit/grub.git/tree/grub-core/genmod.sh.in
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strip --strip-unneeded adds back section symbols
2016-01-29 6:13 strip --strip-unneeded adds back section symbols Andrei Borzenkov
@ 2016-02-01 11:34 ` Nick Clifton
2016-02-01 11:49 ` Andrei Borzenkov
0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2016-02-01 11:34 UTC (permalink / raw)
To: Andrei Borzenkov, binutils, The development of GNU GRUB
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strip --strip-unneeded adds back section symbols
2016-02-01 11:34 ` Nick Clifton
@ 2016-02-01 11:49 ` Andrei Borzenkov
0 siblings, 0 replies; 3+ messages in thread
From: Andrei Borzenkov @ 2016-02-01 11:49 UTC (permalink / raw)
To: Nick Clifton; +Cc: The development of GNU GRUB, binutils
On Mon, Feb 1, 2016 at 2:34 PM, Nick Clifton <nickc@redhat.com> wrote:
> 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/
>
Done.
https://sourceware.org/bugzilla/show_bug.cgi?id=19547
> 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.
>
OK, so we'll need to support symbol-less modules. Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-01 13:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-29 6:13 strip --strip-unneeded adds back section symbols Andrei Borzenkov
2016-02-01 11:34 ` Nick Clifton
2016-02-01 11:49 ` Andrei Borzenkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).