Bug 183736 - Investigate why __cpu_indicator_init is used
Summary: Investigate why __cpu_indicator_init is used
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: mitz
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-03-18 22:13 PDT by Yusuke Suzuki
Modified: 2018-03-20 14:54 PDT (History)
12 users (show)

See Also:


Attachments
WIP (5.98 KB, patch)
2018-03-19 00:10 PDT, mitz
no flags Details | Formatted Diff | Diff
WIP (3.03 KB, patch)
2018-03-19 07:26 PDT, mitz
no flags Details | Formatted Diff | Diff
Stop using -all_load (7.53 KB, patch)
2018-03-19 17:16 PDT, mitz
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2018-03-18 22:13:03 PDT
It calls static initializer. If it is possible, dropping it would be nice.
Comment 1 mitz 2018-03-18 22:27:01 PDT
This is happening because we’re passing -all_load to the linker when linking JavaScriptCore, which prevents the linker from eliding __cpu_indicator_init even though it’s unused.
Comment 2 mitz 2018-03-18 22:28:56 PDT
We should probably switch to -force_load for whichever libraries we need.
Comment 3 mitz 2018-03-18 22:40:56 PDT
Also, reexporting libobjc is probably a mistake, introduced in <https://trac.webkit.org/r6086>.
Comment 4 mitz 2018-03-18 22:52:30 PDT
The -all_load was added in <https://trac.webkit.org/r111786> to fix the build after <https://trac.webkit.org/r111778>, but really could have just been -force_load WTF (if all supported linkers had that option at the time).
Comment 5 mitz 2018-03-18 23:06:14 PDT
We might not even need to -force_load WTF (which is tricky, because it requires a configuration-dependent path), if -ObjC is sufficient.
Comment 6 mitz 2018-03-19 00:10:08 PDT
Created attachment 336033 [details]
WIP
Comment 7 mitz 2018-03-19 07:26:52 PDT
Created attachment 336043 [details]
WIP
Comment 8 mitz 2018-03-19 17:16:36 PDT
Created attachment 336085 [details]
Stop using -all_load
Comment 9 WebKit Commit Bot 2018-03-19 20:26:20 PDT
Comment on attachment 336085 [details]
Stop using -all_load

Clearing flags on attachment: 336085

Committed r229738: <https://trac.webkit.org/changeset/229738>
Comment 10 WebKit Commit Bot 2018-03-19 20:26:21 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2018-03-19 20:27:24 PDT
<rdar://problem/38648167>
Comment 12 Darin Adler 2018-03-20 14:49:23 PDT
Is there some alternative to doing force load for the entire WTF library that would be an even better solution long term?
Comment 13 mitz 2018-03-20 14:54:45 PDT
(In reply to Darin Adler from comment #12)
> Is there some alternative to doing force load for the entire WTF library
> that would be an even better solution long term?

Not loading all of WTF can only be an improvement if we believe that WTF includes or might include unused code. However, I don’t think there’s a good way to predict, when building JavaScriptCore, which parts of WTF that aren’t used in JSC are needed by WebCore and WebKit. If we just add those parts to a list in JavaScriptCore, we’ll have an easy way to add to the list (add something if Web* fails to build without it) but no good way to remove from it.