Closed Bug 1389436 Opened 2 years ago Closed 2 years ago

[gcc6] PGO builds fail with undefined reference to `gfxShapedWord* gfxFont::GetShapedWord ...


(Core :: Graphics: Text, defect)

Not set



Tracking Status
firefox57 --- fixed


(Reporter: glandium, Assigned: glandium)




(1 file)

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: 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/ recipe for target '' 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
Blocks: 1066043
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

(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:

But maybe I botched it?
Assignee: nobody → mh+mozilla
Comment on attachment 8896247 [details]
Bug 1389436 - Explicitly instantiate gfxFont::GetShapedWord<uint8_t> for its use in gfxTextRun.cpp.
Attachment #8896247 - Flags: review?(jfkthame) → review+
Pushed by
Explicitly instantiate gfxFont::GetShapedWord<uint8_t> for its use in gfxTextRun.cpp. r=jfkthame
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Duplicate of this bug: 1332788
You need to log in before you can comment on or make changes to this bug.