RESOLVED FIXED 186944
Adjust WEBCORE_EXPORT annotations for LTO
https://bugs.webkit.org/show_bug.cgi?id=186944
Summary Adjust WEBCORE_EXPORT annotations for LTO
Keith Rollin
Reported 2018-06-22 15:40:22 PDT
Adjust a number of places that result in WebKit's 'check-for-weak-vtables-and-externals' script reporting weak external symbols: ERROR: WebCore has a weak external symbol in it (/Volumes/Data/dev/webkit/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore) ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library. ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file. ... These cases are caused by inline methods being marked with WTF_EXPORT (or related macro) or with an inline function being in a class marked as such, and when enabling LTO builds. For the most part, address these by removing the WEBCORE_EXPORT annotation from inline methods. In some cases, move the implementation out-of-line because it's the class that has the WEBCORE_EXPORT on it and removing the annotation from the class would be too disruptive. Finally, in other cases, move the implementation out-of-line because check-for-weak-vtables-and-externals still complains when keeping the implementation inline and removing the annotation; this seems to typically (but not always) happen with destructors.
Attachments
Patch (21.60 KB, patch)
2018-06-22 15:43 PDT, Keith Rollin
no flags
Patch (24.99 KB, patch)
2018-06-25 17:32 PDT, Keith Rollin
no flags
Radar WebKit Bug Importer
Comment 1 2018-06-22 15:40:34 PDT
Keith Rollin
Comment 2 2018-06-22 15:43:53 PDT
EWS Watchlist
Comment 3 2018-06-22 15:48:20 PDT
Attachment 343380 [details] did not pass style-queue: ERROR: Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.h:53: Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line. [build/webcore_export] [4] Total errors found: 1 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Keith Rollin
Comment 4 2018-06-22 16:59:22 PDT
That warning can be ignored for now. LTO builds succeed despite it.
David Kilzer (:ddkilzer)
Comment 5 2018-06-25 13:18:35 PDT
Comment on attachment 343380 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=343380&action=review r=me > Source/WebCore/ChangeLog:29 > + For the most part, address these by removing the WEBCORE_EXPORT > + annotation from inline methods. In some cases, move the implementation > + out-of-line because it's the class that has the WEBCORE_EXPORT on it > + and removing the annotation from the class would be too disruptive. > + Finally, in other cases, move the implementation out-of-line because > + check-for-weak-vtables-and-externals still complains when keeping the > + implementation inline and removing the annotation; this seems to > + typically (but not always) happen with destructors. Moving destructors out-of-line can save disk space in the binary as well! > Source/WebCore/workers/service/server/SWServer.h:72 > - WEBCORE_EXPORT virtual ~Connection() { } > + virtual ~Connection() { } This can be changed to: virtual ~Connection() = default;
David Kilzer (:ddkilzer)
Comment 6 2018-06-25 13:20:18 PDT
(In reply to Keith Rollin from comment #4) > That warning can be ignored for now. LTO builds succeed despite it. ERROR: Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.h:53: Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line. [build/webcore_export] [4] Total errors found: 1 in 17 files Why not just fix it? It's clearly wrong. Please fix.
Keith Rollin
Comment 7 2018-06-25 17:31:17 PDT
OK. I've made the requested changes.
Keith Rollin
Comment 8 2018-06-25 17:32:26 PDT
WebKit Commit Bot
Comment 9 2018-06-25 19:05:42 PDT
Comment on attachment 343565 [details] Patch Clearing flags on attachment: 343565 Committed r233189: <https://trac.webkit.org/changeset/233189>
WebKit Commit Bot
Comment 10 2018-06-25 19:05:43 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.