-
-
Notifications
You must be signed in to change notification settings - Fork 177
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.