Portage reports the following QA issue when emerging x11-libs/libX11-1.6.7: * QA Notice: The following shared libraries lack NEEDED entries * /usr/lib64/libX11-xcb.so.1.0.0
Created attachment 575538 [details] info.txt emerge --info
Created attachment 575540 [details] build.log.xz
I'm not really sure what the QA warning means or how to fix it. Maybe qa@ can give me some advice?
Not sure what this is about now. I mean, it seems to says it has no DT_NEEDED entries in the ELF dynamic section (readelf -d /usr/lib64/libx11-xcb.so.1.0.0), at least except for libc. But that's to be expected - nm -D confirms it doesn't need anything but C library and it just defines 2 symbols itself.
I can't seem to reproduce this. That said, I suspect the warning is exactly about what leio said -- not having DT_NEEDED, even for libc. In other words, it sounds like something went really, really wrong on your system, for some reason.
Not having DT_NEEDED for libc.so.6 is actually valid in rare cases when given file does not use anything from libc.so.6. In x11-libs/libX11-1.6.7, results for me: $ nm -D .../libX11-xcb.so 0000000000001130 T XGetXCBConnection 0000000000001170 T XSetEventQueueOwner w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize 0000000000000000 A __gentoo_check_ldflags__ w __gmon_start__ U __stack_chk_fail $ nm -D --defined-only .../libX11-xcb.so 0000000000001130 T XGetXCBConnection 0000000000001170 T XSetEventQueueOwner 0000000000000000 A __gentoo_check_ldflags__ $ nm -D --undefined-only .../libX11-xcb.so w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize w __gmon_start__ U __stack_chk_fail So there is only 1 undefined symbol: __stack_chk_fail This symbol is defined for me in libc.so.6: $ nm -D /lib64/libc.so.6 | grep __stack_chk_fail 000000000011fa10 T __stack_chk_fail I guess that if you have USE="-ssp" for sys-libs/glibc and sys-devel/gcc, then you might get a version of libX11-xcb.so not linked against libc.so.6. Please show: emerge -ptv sys-libs/glibc sys-devel/gcc
# emerge -ptv sys-libs/glibc sys-devel/gcc These are the packages that would be merged, in reverse order: Calculating dependencies... done! [ebuild R ] sys-devel/gcc-9.1.0:9.1.0::gentoo USE="cxx nls nptl pch (pie) sanitize ssp vtv (-altivec) -d -debug -doc (-fixed-point) -fortran -go -graphite (-hardened) (-jit) (-libssp) (-multilib) -objc -objc++ -objc-gc -openmp -pgo -systemtap -test -vanilla" 0 KiB [ebuild R ] sys-libs/glibc-2.29-r2:2.2::gentoo USE="multiarch ssp -audit -caps (-cet) (-compile-locales) -doc -gd -headers-only (-multilib) -nscd -profile (-selinux) -suid -systemtap -test (-vanilla)" 0 KiB Total: 2 packages (2 reinstalls), Size of downloads: 0 KiB
Please show: nm -D /usr/lib64/libX11-xcb.so.1.0.0
$ nm -D /usr/lib64/libX11-xcb.so.1.0.0 w __cxa_finalize w __gmon_start__ w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable 0000000000001100 T XGetXCBConnection 0000000000001110 T XSetEventQueueOwner
(In reply to Francesco Turco from comment #9) > $ nm -D /usr/lib64/libX11-xcb.so.1.0.0 > w __cxa_finalize > w __gmon_start__ > w _ITM_deregisterTMCloneTable > w _ITM_registerTMCloneTable > 0000000000001100 T XGetXCBConnection > 0000000000001110 T XSetEventQueueOwner This means that, for whatever reason, this library does not have any undefined non-weak symbols (which would have to defined elsewhere at run-time in order to use this library), so no DT_NEEDED is actually needed. *** This bug has been marked as a duplicate of bug 516016 ***
The way to reproduce absence of DT_NEEDED for libc.so.6 (which results in invalid QA warning) is to use GCC 9 and -Wl,--as-needed and level of stack protection smaller than "all" (-fstack-protector-all): $ gcc-8.3.0 -fno-stack-protector -shared -fPIC -Wl,--as-needed -o test_gcc-8.3.0_no-ssp.so -x c - <<< "void x() {}" $ gcc-8.3.0 -fstack-protector -shared -fPIC -Wl,--as-needed -o test_gcc-8.3.0_ssp.so -x c - <<< "void x() {}" $ gcc-8.3.0 -fstack-protector-strong -shared -fPIC -Wl,--as-needed -o test_gcc-8.3.0_ssp-strong.so -x c - <<< "void x() {}" $ gcc-8.3.0 -fstack-protector-all -shared -fPIC -Wl,--as-needed -o test_gcc-8.3.0_ssp-all.so -x c - <<< "void x() {}" $ gcc-9.1.0 -fno-stack-protector -shared -fPIC -Wl,--as-needed -o test_gcc-9.1.0_no-ssp.so -x c - <<< "void x() {}" $ gcc-9.1.0 -fstack-protector -shared -fPIC -Wl,--as-needed -o test_gcc-9.1.0_ssp.so -x c - <<< "void x() {}" $ gcc-9.1.0 -fstack-protector-strong -shared -fPIC -Wl,--as-needed -o test_gcc-9.1.0_ssp-strong.so -x c - <<< "void x() {}" $ gcc-9.1.0 -fstack-protector-all -shared -fPIC -Wl,--as-needed -o test_gcc-9.1.0_ssp-all.so -x c - <<< "void x() {}" $ scanelf -F "%F: %n" test_gcc-8.3.0_{no-ssp,ssp,ssp-strong,ssp-all}.so FILE NEEDED test_gcc-8.3.0_no-ssp.so: libc.so.6 test_gcc-8.3.0_ssp.so: libc.so.6 test_gcc-8.3.0_ssp-strong.so: libc.so.6 test_gcc-8.3.0_ssp-all.so: libc.so.6 $ scanelf -F "%F: %n" test_gcc-9.1.0_{no-ssp,ssp,ssp-strong,ssp-all}.so FILE NEEDED test_gcc-9.1.0_no-ssp.so: test_gcc-9.1.0_ssp.so: test_gcc-9.1.0_ssp-strong.so: test_gcc-9.1.0_ssp-all.so: libc.so.6 $ nm -D test_gcc-8.3.0_{no-ssp,ssp,ssp-strong,ssp-all}.so test_gcc-8.3.0_no-ssp.so: w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize w __gmon_start__ 0000000000001118 T x test_gcc-8.3.0_ssp.so: w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize w __gmon_start__ 0000000000001118 T x test_gcc-8.3.0_ssp-strong.so: w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize w __gmon_start__ 0000000000001118 T x test_gcc-8.3.0_ssp-all.so: w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize w __gmon_start__ U __stack_chk_fail 0000000000001128 T x $ nm -D test_gcc-9.1.0_{no-ssp,ssp,ssp-strong,ssp-all}.so test_gcc-9.1.0_no-ssp.so: w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize w __gmon_start__ 0000000000001118 T x test_gcc-9.1.0_ssp.so: w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize w __gmon_start__ 0000000000001118 T x test_gcc-9.1.0_ssp-strong.so: w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize w __gmon_start__ 0000000000001118 T x test_gcc-9.1.0_ssp-all.so: w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w __cxa_finalize w __gmon_start__ U __stack_chk_fail 0000000000001128 T x So GCC 8.3.0 with -Wl,--as-needed (when -nostdlib is not used) performs linking against libc.so.6 even when created library has no undefined non-weak symbols which are defined in libc.so.6, but GCC 9.1.0 does not.