tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
ld --as-needed support incomplete?
Hi!
In 11.99.8/x86_64, ld supports the --as-needed flag.
gcc 16 sees this and wants to use this. gcc changelog entry:
2026-01-13 Jakub Jelinek <jakub%redhat.com@localhost>
PR libstdc++/123396
* configure.ac (gcc_cv_ld_use_as_needed_ldscript): New test.
(USE_LD_AS_NEEDED_LDSCRIPT): New AC_DEFINE.
* gcc.cc (LINK_LIBATOMIC_SPEC): Use "-latomic_asneeded" instead
of LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION
if USE_LD_AS_NEEDED_LDSCRIPT is defined.
(init_gcc_specs): Use "-lgcc_s_asneeded" instead of
LD_AS_NEEDED_OPTION " -lgcc_s " LD_NO_AS_NEEDED_OPTION
if USE_LD_AS_NEEDED_LDSCRIPT is defined.
* config.in: Regenerate.
* configure: Regenerate.
However, this does not work, as I noticed when trying to use
gcc16-libjit with emacs31; the configure test for libjit failed with
configure:28629: gcc -std=gnu23 -o conftest -O2 -g -fstack-clash-protection -I/usr/include -I/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/harfbuzz -I/usr/pkg/include/libdrm -I/usr/pkg/include/librsvg-2.0 -I/usr/pkg/include/gdk-pixbuf-2.0 -I/usr/pkg/include -I/usr/pkg/include/cairo -I/usr/pkg/include/libxml2 -I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/fribidi -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -I/usr/pkg/include/pixman-1 -I/usr/pkg/include/harfbuzz -I/usr/pkg/include/freetype2 -I/usr/pkg/include/libpng16 -pthread -I/usr/pkg/include/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/cairo -I/usr/pkg/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/libpng16 -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -I/usr/pkg/include/pixman-1 -fno-tree-sra -DTERMINFO -I/usr/include -I/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/harfbuzz -I/usr/pkg/include/libdrm -Wl,-R/usr/pkg/gcc16/lib -Wl,-zrelro -Wl,-znow -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib conftest.c -lgccjit -lsqlite3 -lX11 -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lcairo >&5
ld: /usr/lib/libm.so.0: warning: warning: reference to compatibility cabs()
ld: /usr/lib/libm.so.0: warning: warning: reference to compatibility cabsf()
configure:28629: $? = 0
configure:28629: ./conftest
/usr/bin/ld: cannot find -lgcc_s_asneeded: No such file or directory
/usr/bin/ld: cannot find -lgcc_s_asneeded: No such file or directory
libgccjit.so: error: : error invoking gcc driver
configure:28629: $? = 1
configure: program exited with status 1
This looks like a bug in ld(1) to me, but I haven't dug deeper - I've
just disabled the use of as-needed in the gcc16 packages, and the
configure test works now.
Cheers,
Thomas
Home |
Main Index |
Thread Index |
Old Index