This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Implement NO_STRIP
ClosedPublic

Authored by sunfish on Aug 29 2019, 11:42 AM.

Details

Summary

This patch replaces https://reviews.llvm.org/D62443 and removes the Emscripten-specific behavior. It just implements support for the NO_STRIP flag, which will allow __attribute__((used)) to be implemented.

This accompanies https://reviews.llvm.org/D62542, which will move to setting the NO_STRIP flag, and will continue to set EXPORTED for Emscripten targets for compatibility.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

sunfish created this revision.Aug 29 2019, 11:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2019, 11:42 AM

I'm curious why a user would want to use WASM_SYMBOL_NO_STRIP if it doesn't export the symbol? Maybe for post-linker to do stuff perhaps?

Do you have plan for how you want to allow llvm user to export symbols with wasm32-wasi? Presumably using custom attribute?

Presumably tests will go with the followup CLs?

tools/lld/wasm/MarkLive.cpp
72 ↗(On Diff #217950)

Update the comment?

sunfish updated this revision to Diff 217962.Aug 29 2019, 1:00 PM

Include the basic test case.

I'm curious why a user would want to use WASM_SYMBOL_NO_STRIP if it doesn't export the symbol? Maybe for post-linker to do stuff perhaps?

I've seen people use it to make something available in a debugger. But in any case, this is how __attribute__((used)) works on other platforms.

Do you have plan for how you want to allow llvm user to export symbols with wasm32-wasi? Presumably using custom attribute?

I don't have a specific proposal yet, but yes, I'm picturing something like __attribute__((export_name("foo"))).

Presumably tests will go with the followup CLs?

Oops, I lost the test change when I removed the other changes from the patch. I've now included it.

sunfish marked 2 inline comments as done.Aug 29 2019, 1:03 PM
sunfish added inline comments.
tools/lld/wasm/MarkLive.cpp
72 ↗(On Diff #217950)

Updated in the new patch.

sbc100 accepted this revision.Aug 29 2019, 2:15 PM
This revision is now accepted and ready to land.Aug 29 2019, 2:15 PM
This revision was automatically updated to reflect the committed changes.