This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Avoid importing/exporting hidden symbols in shared libraries
ClosedPublic

Authored by sbc100 on May 26 2022, 11:40 AM.

Details

Summary

We have some special handling for weakly defined symbols where we both
import and export them, but this is not needed for hidden symbols which
should never be imported or exported.

See https://github.com/emscripten-core/emscripten/pull/16972

This should also help with:
https://github.com/emscripten-core/emscripten/issues/15487

Diff Detail

Event Timeline

sbc100 created this revision.May 26 2022, 11:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2022, 11:40 AM
Herald added subscribers: pmatos, asb, wingo and 4 others. · View Herald Transcript
sbc100 requested review of this revision.May 26 2022, 11:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2022, 11:40 AM

what happens when you use attribute(export-name) in clang, along with -fvisibility=hidden? (or is there some other way force an export?)

lld/test/wasm/shared-weak-symbols.s
73

should we put a CHECK-NEXT for the next section (after export) here to ensure there are only 3 exports?

sbc100 marked an inline comment as done.May 26 2022, 1:20 PM

what happens when you use attribute(export-name) in clang, along with -fvisibility=hidden? (or is there some other way force an export?)

attribute(export-name) will be honored whenever a symbol is exported.

hidden symbols can indeed be exported explicitly via --export on the command line. Not sure if that is good or a bad thing.

sbc100 updated this revision to Diff 432371.May 26 2022, 1:20 PM
  • feedback
dschuff accepted this revision.May 26 2022, 1:32 PM

Yeah, letting the user override with the manual mechanisms seems like a good thing, probably?

This revision is now accepted and ready to land.May 26 2022, 1:32 PM
This revision was landed with ongoing or failed builds.May 26 2022, 1:43 PM
This revision was automatically updated to reflect the committed changes.