-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide symbols for mac with -fvisibility=hidden #688
Conversation
Maybe worth reading: https://labjack.com/news/simple-cpp-symbol-visibility-demo |
@peakji thanks! There's one section that confuses me:
What we're seeing is the opposite: we do need |
Relevant |
The linux binary does contain global symbols - but not of |
I think the difference between linux and mac can be explained by their default mode of Still, even when I manually do |
OK, I did a test on mac, loading A few unixes also default to |
Closes #686. Alternative to #687 - see #687 (comment). I'm hoping for some feedback on nodejs/node-addon-api#460 (comment).
I tested this and it works, but I don't fully understand why yet. Here's the difference between the symbol tables of a
leveldown
master build (asnode_modules/ldmaster
) and this PR (asnode_modules/ldhidden
):Click to expand
Note: I reordered the output for easier comparison.
Notice how for example the
__ZN10BaseWorker7ExecuteEP10napi_env__Pv
symbol is global (g
) in the master build, but local (l
) in the-fvisibility=hidden
build. I'm guessing when two builds have global symbols with the same name (which happens on any two 5.x builds on mac), that's when conflicts like #686 arise.