Open Bug 1999445 Opened 10 months ago Updated 9 months ago

[Linux] Fails to link without LTO

Categories

(Core :: JavaScript: GC, defect, P3)

defect

Tracking

()

People

(Reporter: stransky, Unassigned)

References

(Blocks 1 open bug)

Details

Firefox 145.0 fails to link without LTO (Fedora disables it due to https://gcc.gnu.org/PR122620).
It's GCC 15.x PGO build with --disable-lto option. Strangely enough GCC 14.x compiles / links it.

rm -f ../../../dist/bin/libxul.so
/usr/bin/g++ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstrict-flex-arrays=1 -fno-rtti -pthread -fno-sized-deallocation -fno-aligned-new -ffunction-sections -fdata-sections -fno-math-errno -fno-exceptions -pipe -fPIC -O2 -g1 -grecord-gcc-switches -pipe -Wno-complain-wrong-lang -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fpermissive -DNSS_PKCS11_3_0_STRICT -O3 -fomit-frame-pointer -funwind-tables -shared -Wl,-z,defs -Wl,--gc-sections -Wl,-h,libxul.so -o ../../../dist/bin/libxul.so -Wl,@/raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/toolkit/library/build/libxul_so.list    -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,--no-keep-memory -Wl,--reduce-memory-overheads -Wl,--build-id=sha1 -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,-z,now -Wl,-z,nocopyreloc -Wl,-z,pack-relative-relocs -fstack-protector-strong -Wl,-rpath-link,/raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/bin -fprofile-use ../../../js/src/build/libjs_static.a ../../../build/pure_virtual/libpure_virtual.a ../../../x86_64-unknown-linux-gnu/release/libgkrust.a ../../../dist/bin/libmozsandbox.so ../../../dist/bin/libgkcodecs.so ../../../dist/bin/liblgpllibs.so ../../../dist/bin/libmozsqlite3.so ../../../dist/bin/libmozgtk.so ../../../dist/bin/libmozwayland.so -Wl,--version-script,libxul.so.symbols  -lresolv -ldl -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrandr -lXrender -ldrm -lpipewire-0.3 -lasound -lgbm -lpthread -lc -L/usr/lib64/../lib64 -lffi -lplds4 -lplc4 -lnspr4 -lz -lm -lssl3 -lsmime3 -lnss3 -lnssutil3 -lfreetype -lfontconfig -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lrt -ljpeg -lwebp -lwebpdemux -levent -lvpx -lpixman-1 -L/usr/lib64/pkgconfig/../../lib64 -ldbus-1 -lxcb-shm -lX11-xcb -lxcb -lXcursor -lXi
/usr/bin/ld: ../../../js/src/build/libjs_static.a(Unified_cpp_js_src22.o): in function `js::GenericTracerImpl<js::gc::MarkingTracerT<2u> >::onShapeEdge(js::Shape**, char const*)':
/raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text._ZN2js11RegExpRealm5traceEP8JSTracer+0x7d): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<js::Shape>(js::Shape**, char const*)'
/usr/bin/ld: ../../../js/src/build/libjs_static.a(Unified_cpp_js_src22.o): in function `js::GenericTracerImpl<js::gc::MarkingTracerT<2u> >::onStringEdge(JSString**, char const*)':
/raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text._ZN2js13RegExpStatics5traceEP8JSTracer[_ZN2js13RegExpStatics5traceEP8JSTracer]+0x38): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<JSString>(JSString**, char const*)'
/usr/bin/ld: /raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text._ZN2js13RegExpStatics5traceEP8JSTracer[_ZN2js13RegExpStatics5traceEP8JSTracer]+0xa4): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<JSString>(JSString**, char const*)'
/usr/bin/ld: /raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text._ZN2js13RegExpStatics5traceEP8JSTracer[_ZN2js13RegExpStatics5traceEP8JSTracer]+0x7a): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<JSString>(JSString**, char const*)'
/usr/bin/ld: /raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text.hot._ZN2js12RegExpShared13traceChildrenEP8JSTracer+0x4f): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<JSString>(JSString**, char const*)'
/usr/bin/ld: ../../../js/src/build/libjs_static.a(Unified_cpp_js_src22.o): in function `js::GenericTracerImpl<js::gc::MarkingTracerT<2u> >::onJitCodeEdge(js::jit::JitCode**, char const*)':
/raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text.hot._ZN2js12RegExpShared13traceChildrenEP8JSTracer+0x12c): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<js::jit::JitCode>(js::jit::JitCode**, char const*)'
/usr/bin/ld: /raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text.hot._ZN2js12RegExpShared13traceChildrenEP8JSTracer+0x159): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<js::jit::JitCode>(js::jit::JitCode**, char const*)'
/usr/bin/ld: ../../../js/src/build/libjs_static.a(Unified_cpp_js_src22.o): in function `js::GenericTracerImpl<js::gc::MarkingTracerT<2u> >::onStringEdge(JSString**, char const*)':
/raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text.hot._ZN2js12RegExpShared13traceChildrenEP8JSTracer+0xfc): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<JSString>(JSString**, char const*)'
/usr/bin/ld: /raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text._ZN2js17GenericTracerImplINS_2gc14MarkingTracerTILj2EEEE12onStringEdgeEPP8JSStringPKc[_ZN2js17GenericTracerImplINS_2gc14MarkingTracerTILj2EEEE12onStringEdgeEPP8JSStringPKc]+0x5): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<JSString>(JSString**, char const*)'
/usr/bin/ld: ../../../js/src/build/libjs_static.a(Unified_cpp_js_src22.o): in function `js::GenericTracerImpl<js::gc::MarkingTracerT<2u> >::onJitCodeEdge(js::jit::JitCode**, char const*)':
/raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text._ZN2js17GenericTracerImplINS_2gc14MarkingTracerTILj2EEEE13onJitCodeEdgeEPPNS_3jit7JitCodeEPKc[_ZN2js17GenericTracerImplINS_2gc14MarkingTracerTILj2EEEE13onJitCodeEdgeEPPNS_3jit7JitCodeEPKc]+0x5): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<js::jit::JitCode>(js::jit::JitCode**, char const*)'
/usr/bin/ld: ../../../js/src/build/libjs_static.a(Unified_cpp_js_src22.o): in function `js::GenericTracerImpl<js::gc::MarkingTracerT<2u> >::onShapeEdge(js::Shape**, char const*)':
/raid/CVS/firefox/firefox-145.0-build/firefox-145.0/objdir/dist/include/js/TracingAPI.h:221:(.text._ZN2js17GenericTracerImplINS_2gc14MarkingTracerTILj2EEEE11onShapeEdgeEPPNS_5ShapeEPKc[_ZN2js17GenericTracerImplINS_2gc14MarkingTracerTILj2EEEE11onShapeEdgeEPPNS_5ShapeEPKc]+0x5): undefined reference to `void js::gc::MarkingTracerT<2u>::onEdge<js::Shape>(js::Shape**, char const*)'
/usr/bin/ld: ../../../dist/bin/libxul.so: hidden symbol `_ZN2js2gc14MarkingTracerTILj2EE6onEdgeI8JSStringEEvPPT_PKc' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

For instance void js::gc::MarkingTracerT<2u>::onEdge<JSString>(JSString**, char const*) is only undefined/hidden at libjs_static.a

objdump -t libjs_static.a | grep _ZN2js2gc14MarkingTracerTILj2EE6onEdgeI8JSStringEEvPPT_PKc
0000000000000000         *UND*	0000000000000000 .hidden _ZN2js2gc14MarkingTracerTILj2EE6onEdgeI8JSStringEEvPPT_PKc

Looks like those are defined as weak at Unified_cpp_js_src_gc1.o

The function is a template function defined in a cpp source file rather than a header, and used from a header. That's the typical recipe for things like this happening depending on what the compiler does with optimizations.

Blocks: sm-build
Severity: -- → S4
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.