[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strip --strip-unneeded adds back section symbols

From: Andrei Borzenkov
Subject: strip --strip-unneeded adds back section symbols
Date: Fri, 29 Jan 2016 09:13:48 +0300

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

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!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]