https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112963
Bug ID: 112963 Summary: [14 Regression] Incorrect linking of libquadmath since r14-4863 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libquadmath Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- Since r14-4863-g538dcde872abba589b3c8a57181bd7f91018c67a libquadmath is linked incorrectly on Linux, without the required libm.so.6 DT_NEEDED entry, even when it calls libm.so.6 signgam, sqrt and on powerpc64le-linux also __sqrtieee128 entrypoints. Short reproducer reduced from libtool's testsuite on powerpc64le-linux: ( echo ' subroutine a1(res)'; echo ' integer*4 res'; echo ' res=1'; echo ' return'; echo ' end' ) > a1.f; sed 's/1/2/g' < a1.f > a2.f; ( echo ' program main'; echo ' integer*4 res'; echo ' call a1(res)'; echo ' call a2(res)'; echo ' end' ) > main2.f; rm -rf .libs; mkdir .libs; gfortran -O2 -mcpu=power8 -c a1.f -fPIC -o .libs/a1.o; gfortran -O2 -mcpu=power8 -c a2.f -fPIC -o .libs/a2.o; gfortran -O2 -mcpu=power8 -c main2.f -fPIC -o .libs/main2.o; ar cr .libs/liba1.a .libs/a1.o; ranlib .libs/liba1.a; ar cr .libs/liba2.a .libs/a2.o; ranlib .libs/liba2.a; gfortran -shared -fPIC -Wl,--whole-archive ./.libs/liba1.a ./.libs/liba2.a -Wl,--no-whole-archive -lgfortran -lm -lgcc_s -lquadmath -lm -lgcc_s -lc -lgcc_s -O2 -mcpu=power8 -Wl,-z -Wl,relro -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-soname -Wl,liba12.so.0 -o .libs/liba12.so.0.0.0; ln -sf liba12.so.0.0.0 .libs/liba12.so.0; ln -sf liba12.so.0.0.0 .libs/liba12.so; gfortran -O2 -mcpu=power8 -Wl,-z -Wl,relro -Wl,--as-needed -Wl,--build-id=sha1 -o .libs/main .libs/main2.o ./.libs/liba12.so -Wl,-rpath,.libs/; .libs/main This segfaults now, the above can be compiled even with gcc 13 and/or run against gcc 13 libgfortran.so.5 and/or libgcc_s.so.1, the only thing for the crash that matters is whether it dynamically links against gcc 13 libquadmath.so.0 (then it works) or gcc 14 libquadmath.so.0 (then it crashes).