RESOLVED FIXED 228865
Adding missing REFERENCED_FROM_ASM annotations to facilitate LTO
https://bugs.webkit.org/show_bug.cgi?id=228865
Summary Adding missing REFERENCED_FROM_ASM annotations to facilitate LTO
Michael Catanzaro
Reported 2021-08-06 09:21:06 PDT
When investigating why WebKitGTK fails to build with LTO (link-time optimization) enabled, one of the GCC developers noticed that we are missing __attribute__ (("used")) on several C++ functions declared in LLIntSlowPaths.h and WasmSlowPaths.h that are called only from asm. Without this attribute, GCC assumes the functions are unused and drops them, then linking fails because they really are used. Turns out, this is the *only* problem that prevents building WebKit with LTO, so this patch should allow distros like Fedora and SUSE to drop downstream workarounds to turn off LTO. To test building with LTO, I used -DCMAKE_C_FLAGS="-flto=auto -ffat-lto-objects" -DCMAKE_CXX_FLAGS="-flto=auto -ffat-lto-objects" with GCC. Note that is GCC-specific. Clang uses "-flto" instead, simpler.
Attachments
Patch (5.87 KB, patch)
2021-08-06 09:28 PDT, Michael Catanzaro
no flags
Michael Catanzaro
Comment 1 2021-08-06 09:24:33 PDT
(In reply to Michael Catanzaro from comment #0) > Turns out, this is the *only* problem that prevents building WebKit with > LTO, so this patch should allow distros like Fedora and SUSE to drop > downstream workarounds to turn off LTO. Oh, well I'm actually getting an ld.gold internal error as well. Workaround for that is -DUSE_LD_GOLD=OFF. We might want to get rid of ld.gold anyway since it's no longer well-maintained.
Michael Catanzaro
Comment 2 2021-08-06 09:28:19 PDT
Adrian Perez
Comment 3 2021-08-09 00:36:48 PDT
Comment on attachment 435072 [details] Patch Nice find. I think the patch is correct 😉
Yusuke Suzuki
Comment 4 2021-08-09 00:46:00 PDT
Comment on attachment 435072 [details] Patch r=me
EWS
Comment 5 2021-08-09 03:53:12 PDT
Committed r280770 (240354@main): <https://commits.webkit.org/240354@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 435072 [details].
Radar WebKit Bug Importer
Comment 6 2021-08-09 03:54:17 PDT
Michael Catanzaro
Comment 7 2021-08-12 13:08:26 PDT
(In reply to Michael Catanzaro from comment #0) > To test building with LTO, I used -DCMAKE_C_FLAGS="-flto=auto > -ffat-lto-objects" -DCMAKE_CXX_FLAGS="-flto=auto -ffat-lto-objects" with > GCC. Note that is GCC-specific. Clang uses "-flto" instead, simpler. Correction: according to https://fedoraproject.org/wiki/Changes/LTOBuildImprovements#Detailed_Description actually do not want to use -ffat-lto-objects because we don't install any .o or .a files. Huh.
Michael Catanzaro
Comment 8 2021-08-23 12:35:39 PDT
*** Bug 202346 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.