Bug 167282 - JavaScriptCore has a weak external symbol in it
Summary: JavaScriptCore has a weak external symbol in it
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2017-01-21 02:05 PST by Shuan Zhao
Modified: 2017-01-23 02:43 PST (History)
7 users (show)

See Also:

[PATCH] Proposed Fix (1.72 KB, patch)
2017-01-22 22:16 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shuan Zhao 2017-01-21 02:05:41 PST
ERROR: JavaScriptCore has a weak external symbol in it (/Users/hoolai/Library/Developer/Xcode/DerivedData/WebKit-ehpvmnqmihxdvndqudiokzoxdfuu/Build/Products/Debug/JavaScriptCore.framework/Versions/A/JavaScriptCore)
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.
ERROR: symbol automatically hidden __ZTVN3JSC8Debugger15ProfilingClientE
Comment 1 Alexey Proskuryakov 2017-01-21 23:29:17 PST
I don't think that we've seen this particular error. What version of Xcode are you building with?
Comment 2 Shuan Zhao 2017-01-21 23:32:26 PST
I'm using Xcode Version 8.2.1 (8C1002)
Comment 3 Alexey Proskuryakov 2017-01-21 23:52:10 PST
Our bots have version 8.2, which is unlikely to be different in this regard. What command do you build with?
Comment 4 Shuan Zhao 2017-01-22 00:14:51 PST
I just open the workspace file with Xcode, and select the JavaScriptCore target. I have changed the Mach-O Type to static library to run on iOS with my own app. Error was reported for debug build. I can make the release build successfully.
Comment 5 Joseph Pecoraro 2017-01-22 18:41:47 PST
This seems like an issue that I used to see in the past that was solved by newer compilers. In any case, it sounds like we can just make the destructor:

    virtual ~ProfilingClient() { }

Not be inlined to solve this. I'll try to reproduce myself tonight, but I'll just throw up a patch anyways.
Comment 6 Joseph Pecoraro 2017-01-22 22:14:00 PST

  $ xcrun clang++ -v
  Apple LLVM version 8.1.0 (clang-802.0.21.2)

I only see these weak externals:

  $ nm -m $build/Release/JavaScriptCore.framework/JavaScriptCore | grep 'weak external'
    (undefined) weak external __ZdaPv (from libc++)
    (undefined) weak external __ZdlPv (from libc++)
    (undefined) weak external __Znam (from libc++)
    (undefined) weak external __Znwm (from libc++)

So I guess I can go ahead speculatively here, seems harmless.
Comment 7 Joseph Pecoraro 2017-01-22 22:16:29 PST
Created attachment 299500 [details]
[PATCH] Proposed Fix
Comment 8 Joseph Pecoraro 2017-01-22 22:17:03 PST
Shuan, since I can't reproduce but you can, would you be willing to try the attached patch (very basic) and see if it solves the problem for you?
Comment 9 Shuan Zhao 2017-01-22 22:20:19 PST
Ok, I'll try it and report my result later.
Comment 10 Shuan Zhao 2017-01-22 23:35:47 PST
The patch solved my problem. Thanks for you work.
Comment 11 Yusuke Suzuki 2017-01-23 02:18:28 PST
Comment on attachment 299500 [details]
[PATCH] Proposed Fix

ok, r=me
Comment 12 WebKit Commit Bot 2017-01-23 02:42:58 PST
Comment on attachment 299500 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 299500

Committed r211037: <http://trac.webkit.org/changeset/211037>
Comment 13 WebKit Commit Bot 2017-01-23 02:43:02 PST
All reviewed patches have been landed.  Closing bug.