Closed Bug 1364597 Opened 7 years ago Closed 7 years ago

link fails with GCC 7.1

Categories

(Core :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: aceman, Unassigned)

References

Details

I tried GCC 7.1 on Linux now and linking of libxul fails for me with errors like these: toolkit/library/../../gfx/skia/GrGLBuffer.o(.debug_addr+0x4a0): error: undefined reference to 'GrFragmentProcessor::coordTransform(int) const'' toolkit/library/../../dom/canvas/Unified_cpp_dom_canvas3.o(.debug_addr+0x52c8): error: undefined reference to 'gfxPrefs::GetAPZEnlargeDisplayPortWhenClippedPrefName()' Similar errors repeat multiple times for many object files. On the same tree, when I went back to GCC 5.4 the build+link works fine again. Is there some change in symbol visibility with GCC 7?
I don't experience this issue. Which distro do you use ?
Slackware. Which aims to keep packages close to upstream without modifications. It introduced gcc 7.1 in the -current branch ('unstable/nightly') so I tried it as a drop in replacement for gcc 5.4. Going back to 5.4 after that makes the error go away again.
This still happens. It happens regardless whether I use ld.bfd or gold linker. I'm using these gcc flags: export CFLAGS="-march=native -ggdb -gsplit-dwarf -O2 -fstack-protector-strong -fno-lto -fno-fat-lto-objects -fno-ipa-icf" Interestingly, the main app binary is created fine, it is just libxul.so that fails to link.
It appears others have also observed this problem so it is not only my system (it still may be distro specific). See http://www.slackware.com/~alien/slackbuilds/ChangeLog.txt: Wed Jun 21 17:29:12 UTC 2017 gcc5: added a package for gcc-5.4.0 which can be installed alongside the gcc-7.1.0 of Slackware-current. Some applications will not compile with gcc7 (like Pale Moon) so in those cases, install gcc5 on the side. I assume Pale Moon being based on Firefox code may indicate something.
I'm also see a failure during linking with gcc 7.1.0 (whether it's using bfd or gold linker), but only when doing a PGO build. Firefox builds fine without PGO. I'm using default optimizations with no extra CFLAGS. This is the error I get with gold: ../../build/unix/gold/ld: error: /home/user/desktop-src/applications/firefox-build/toolkit/library/../../gfx/thebes/Unified_cpp_gfx_thebes1.o: requires dynamic R_X86_64_PC32 reloc against '_ZN7gfxFont13GetShapedWordIhEEP13gfxShapedWordPN7mozilla3gfx10DrawTargetEPKT_jjNS3_7unicode6ScriptEbiNS4_15ShapedTextFlagsEN13gfxFontShaper13RoundingFlagsEP18gfxTextPerfMetrics' which may overflow at runtime; recompile with -fPIC ../../build/unix/gold/ld: error: read-only segment has dynamic relocations /home/user/desktop-src/applications/firefox-55.0.1/gfx/thebes/gfxTextRun.cpp:1627: error: undefined reference to 'gfxShapedWord* gfxFont::GetShapedWord<unsigned char>(mozilla::gfx::DrawTarget*, unsigned char const*, unsigned int, unsigned int, mozilla::unicode::Script, bool, int, mozilla::gfx::ShapedTextFlags, gfxFontShaper::RoundingFlags, gfxTextPerfMetrics*)' collect2: error: ld returned 1 exit status
I can build Firefox 57.0 fine now with PGO on gcc 7.2.0. One thing I have to do to build stylo to make it find system headers for nspr and pixman is set BINDGEN_CFLAGS=$(pkg-config --cflags nspr pixman-1).
It seems this is fixed for me with the recent gcc 7.3 release. I get successful builds now. Possibly fixed by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81993 (I do use -gsplit-dwarf as stated in comment 3).
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
I wasn't expecting this bug on gcc to affect also firefox devs ;)
You need to log in before you can comment on or make changes to this bug.