Closed Bug 1389436 Opened 2 years ago Closed 2 years ago
[gcc6] PGO builds fail with undefined reference to `gfx
Shaped Word* gfx Font::Get Shaped Word ...
59 bytes, text/x-review-board-request
INFO - ../../gfx/thebes/Unified_cpp_gfx_thebes1.o: In function `gfxTextRun::SetSpaceGlyph(gfxFont*, mozilla::gfx::DrawTarget*, unsigned int, mozilla::gfx::ShapedTextFlags)': INFO - /home/worker/workspace/build/src/gfx/thebes/gfxTextRun.cpp:1624: 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*)' INFO - /home/worker/workspace/build/src/gcc/bin/ld: libxul.so: hidden symbol `_ZN7gfxFont13GetShapedWordIhEEP13gfxShapedWordPN7mozilla3gfx10DrawTargetEPKT_jjNS3_7unicode6ScriptEbiNS4_15ShapedTextFlagsEN13gfxFontShaper13RoundingFlagsEP18gfxTextPerfMetrics' isn't defined INFO - /home/worker/workspace/build/src/gcc/bin/ld: final link failed: Bad value INFO - collect2: error: ld returned 1 exit status INFO - /home/worker/workspace/build/src/config/rules.mk:717: recipe for target 'libxul.so' failed
The reason this happens is that there's a template method declared in gfxFont.h and defined in gfxFont.cpp, and used in both gfxFont.cpp and gfxTextRun.cpp. The split was done 3 years ago, and we've been lucky until now, that the instantiation of the template in gfxFont.cpp was not optimized out... until GCC 6 PGO, which, apparently, happily inlines the function in gfxFont.cpp, such that there's nothing left for gfxTextRun to find.
Assignee: mh+mozilla → nobody
Component: Build Config → Graphics: Text
So is the proper approach to have an explicit instantiation of the method (like I see we already have for SplitAndInitTextRun, at https://dxr.mozilla.org/mozilla-central/rev/5322c03f4c8587fe526172d3f87160031faa6d75/gfx/thebes/gfxFont.cpp#3115)? (We'd only need to do this for the <uint8_t> version of the method, afaics, as that's the one gfxTextRun uses.)
Yes, or move the template to the header. Note that I did try the explicit instantiation, and it failed to build: https://treeherder.mozilla.org/#/jobs?repo=try&revision=fddc9e6782dfb141dfe0a02b5e3bc949c32e81d2 But maybe I botched it?
Comment on attachment 8896247 [details] Bug 1389436 - Explicitly instantiate gfxFont::GetShapedWord<uint8_t> for its use in gfxTextRun.cpp. https://reviewboard.mozilla.org/r/167540/#review172718
Attachment #8896247 - Flags: review?(jfkthame) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/97dae871389b Explicitly instantiate gfxFont::GetShapedWord<uint8_t> for its use in gfxTextRun.cpp. r=jfkthame
Duplicate of this bug: 1332788
You need to log in before you can comment on or make changes to this bug.