https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87710
Bug ID: 87710 Summary: Explicitly mentioned libraries by -lx are not in the DT_NEEDED list Product: gcc Version: 7.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dilyan.palauzov at aegee dot org Target Milestone: --- Calling “make install” without DESTDIR after building libc-2.28 calls eventually glibc-2.28/srcribts/test-installation.pl . It creates the file test-prg7044.c with content: #include <stdio.h> #include <stdlib.h> int main(void) { printf ("Your new glibc installation seems to be ok.\n"); exit (0); } Then calls “gcc /src/glibc228/test-prg7044.c -lc -lBrokenLocale -lpthread -lcrypt -ldl -lgcc_s -lnsl -lutil -lnss_dns -lnss_compat -lmvec -lresolv -lnss_db -lm -lnss_files -lrt -lnss_hesiod -lanl -o /src/glibc228/test-prg7044“, and chechs whether „ldd test-prg7044” contains BrokenLocale. On my system the comman above invoked with -v prints: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --enable-threads=posix --enable-nls --disable-multilib --enable-interpreter --with-system-zlib --enable-libgcj-multifile --enable-languages=all --enable-targets=all --with-system-unwind --without-x --with-linker-hash-style=gnu --enable-shared --with-build-config='bootstrap-lto bootstrap-O3' Thread model: posix gcc version 7.3.1 20181013 (GCC) COLLECT_GCC_OPTIONS='-v' '-o' '/src/glibc228//test-prg7044' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.1/cc1 -quiet -v -imultiarch x86_64-linux-gnu /src/glibc228//test-prg7044.c -quiet -dumpbase test-prg7044.c -mtune=generic -march=x86-64 -auxbase test-prg7044 -version -o /tmp/ccDutEqy.s GNU C11 (GCC) version 7.3.1 20181013 (x86_64-pc-linux-gnu) compiled by GNU C version 7.3.1 20181013, GMP version 6.1.2, MPFR version 4.0.0, MPC version 1.1.0, isl version isl-0.19-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/include /usr/local/include /usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. GNU C11 (GCC) version 7.3.1 20181013 (x86_64-pc-linux-gnu) compiled by GNU C version 7.3.1 20181013, GMP version 6.1.2, MPFR version 4.0.0, MPC version 1.1.0, isl version isl-0.19-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 8ff192ae53ef780b032a40b890e7c233 COLLECT_GCC_OPTIONS='-v' '-o' '/src/glibc228//test-prg7044' '-mtune=generic' '-march=x86-64' /usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../x86_64-pc-linux-gnu/bin/as -v --64 -o /tmp/ccZTddK3.o /tmp/ccDutEqy.s GNU assembler version 2.31.51 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.31.51.20181019 COMPILER_PATH=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.1/:/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.1/:/usr/local/libexec/gcc/x86_64-pc-linux-gnu/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../x86_64-pc-linux-gnu/bin/ LIBRARY_PATH=/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../x86_64-linux-gnu/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../lib64/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib64/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../x86_64-pc-linux-gnu/lib/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-o' '/src/glibc228//test-prg7044' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.1/collect2 -plugin /usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.1/liblto_plugin.so -plugin-opt=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccLuMS4y.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /src/glibc228//test-prg7044 /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/crtbegin.o -L/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1 -L/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../x86_64-linux-gnu -L/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../x86_64-pc-linux-gnu/lib -L/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../.. /tmp/ccZTddK3.o --no-as-needed -lc -lBrokenLocale -lpthread -lcrypt -ldl -lgcc_s -lnsl -lutil -lnss_dns -lnss_compat -lmvec -lresolv -lnss_db -lm -lnss_files -lrt -lnss_hesiod -lanl -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/local/lib/gcc/x86_64-pc-linux-gnu/7.3.1/crtend.o /usr/lib/../lib64/crtn.o COLLECT_GCC_OPTIONS='-v' '-o' '/src/glibc228//test-prg7044' '-mtune=generic' '-march=x86-64' and ldd test-prg prints: linux-vdso.so.1 (0x00007ffcb77ba000) libc.so.6 => /lib64/libc.so.6 (0x00007f14efb4c000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f14efb2b000) libgcc_s.so.1 => /usr/local/lib64/libgcc_s.so.1 (0x00007f14efb12000) libnss_dns.so.2 => /lib64/libnss_dns.so.2 (0x00007f14efb0b000) libnss_compat.so.2 => /lib64/libnss_compat.so.2 (0x00007f14efb00000) libmvec.so.1 => /lib64/libmvec.so.1 (0x00007f14efad4000) libnss_db.so.2 => /lib64/libnss_db.so.2 (0x00007f14efac5000) libnss_files.so.2 => /lib64/libnss_files.so.2 (0x00007f14efab0000) libnss_hesiod.so.2 => /lib64/libnss_hesiod.so.2 (0x00007f14efaaa000) /lib64/ld-linux-x86-64.so.2 (0x00007f14efd20000) libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f14efa91000) libm.so.6 => /lib64/libm.so.6 (0x00007f14ef912000) Since libBrokenLocale and others are not listed by ldd, test-installation.pl fails. Neither -fuse-ld=gold nor -Wl,--no-as-needed do have any impact. See also https://sourceware.org/bugzilla/show_bug.cgi?id=23807 I have binutils 2.31.51.20181019 and gcc 7.3.1 20181013.