estrip should strip __gentoo_check_ldflags__ symbol from *.o files. The main problem caused by not doing it is deceiving QA check for respectation of LDFLAGS in executables. sys-libs/glibc installs several *crt*.o files. A part of them are created using linker with -r option which is used to create *.o files (often from other *.o files). And sys-libs/glibc somehow respects LDFLAGS (at least when creating these *.o files). QA check for respectation of LDFLAGS is enabled if -Wl,--defsym=__gentoo_check_ldflags__=${some_value} is used, which adds __gentoo_check_ldflags__ symbol to these *.o files: # nm /usr/lib64/crt1.o | grep __gentoo_check_ldflags__ 0000000000000000 A __gentoo_check_ldflags__ # nm /usr/lib64/Scrt1.o | grep __gentoo_check_ldflags__ 0000000000000000 A __gentoo_check_ldflags__ # nm /usr/lib64/gcrt1.o | grep __gentoo_check_ldflags__ 0000000000000000 A __gentoo_check_ldflags__ # This __gentoo_check_ldflags__ symbol is inherited by executables (but not shared libraries), so even when they do not respect LDFLAGS, they would not be detected by QA check: # gcc -shared -fPIC -o /tmp/test_1.so -x c /dev/null # gcc -o /tmp/test_1 -x c - <<< "int main(){}" # strip -N __gentoo_check_ldflags__ /usr/lib64/Scrt1.o # gcc -shared -fPIC -o /tmp/test_2.so -x c /dev/null # gcc -o /tmp/test_2 -x c - <<< "int main(){}" # nm /tmp/test_1.so | grep __gentoo_check_ldflags__ # nm /tmp/test_2.so | grep __gentoo_check_ldflags__ # nm /tmp/test_1 | grep __gentoo_check_ldflags__ 0000000000000000 A __gentoo_check_ldflags__ # nm /tmp/test_2 | grep __gentoo_check_ldflags__ # scanelf -qyRF '#k%p' -k .dynsym /tmp/test_{1,2}{,.so} /tmp/test_1 /tmp/test_1.so /tmp/test_2 /tmp/test_2.so # scanelf -qyRF '#s%p' -s __gentoo_check_ldflags__ /tmp/test_{1,2}{,.so} /tmp/test_1 # (In this example, __gentoo_check_ldflags__ symbol is deleted from Scrt1.o before creation of test_2*.) Currently used invocation of `strip` would not strip random unneeded symbols from *.o files: # gcc -nostdlib -r -o /tmp/test_3.o -Wl,--defsym=XXXX=1234 -x c - <<< "int main(){}" # gcc -o /tmp/test_3 -Wl,--defsym=XXXX=1234 -x c - <<< "int main(){}" # nm /tmp/test_3.o | grep XXXX 00000000000004d2 A XXXX # nm /tmp/test_3 | grep XXXX 00000000000004d2 A XXXX # strip --strip-unneeded /tmp/test_3{.o,} # nm /tmp/test_3.o | grep XXXX 00000000000004d2 A XXXX # nm /tmp/test_3 | grep XXXX nm: /tmp/test_3: no symbols # nm -D /tmp/test_3 | grep XXXX #
Created attachment 577252 [details, diff] Patch
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=86f211e3a552753eb945670a39c1a3b14c3c3bd1 commit 86f211e3a552753eb945670a39c1a3b14c3c3bd1 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> AuthorDate: 2019-05-19 05:01:06 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2019-05-20 05:08:41 +0000 estrip: Strip __gentoo_check_ldflags__ symbol. Bug: https://bugs.gentoo.org/686282 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> Signed-off-by: Zac Medico <zmedico@gentoo.org> bin/estrip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)