This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Fix --export-all when __stack_pointer is present
ClosedPublic

Authored by sbc100 on Sep 14 2020, 6:32 PM.

Details

Summary

With https://reviews.llvm.org/D87537 we made it an error
to export a mutable global with the +mutable-globals feature
present. However, this broke the use of the --export-all
flag because the __stack_pointer which is present in almost
all programs is a mutable global.

This also revealed that we didn't have any test coverage for
the --export-all flag.

This change fixes the current breakage on the emscripten-releases
roller.

Diff Detail

Event Timeline

sbc100 created this revision.Sep 14 2020, 6:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2020, 6:32 PM
sbc100 requested review of this revision.Sep 14 2020, 6:32 PM
tlively accepted this revision.Sep 14 2020, 8:40 PM

Looks good!

lld/test/wasm/mutable-globals.s
2

Why was this change necessary?

lld/wasm/Writer.cpp
1117–1118

I'm nervous that some of the intervening steps might have depended on the features having been parsed for some reason, but if there was no test breakage, there's probably no issue.

This revision is now accepted and ready to land.Sep 14 2020, 8:40 PM
sbc100 added inline comments.Sep 15 2020, 5:41 AM
lld/test/wasm/mutable-globals.s
2

Because I moved the calculation of the features section later on the link process, the error regarding foo being undefined now get generated before the error we are checking for here mutable global imported but 'mutable-globals' feature not present in inputs.

Does this seems like a reasonable change?

sbc100 updated this revision to Diff 291886.Sep 15 2020, 6:17 AM

revert part

sbc100 added inline comments.Sep 15 2020, 6:19 AM
lld/test/wasm/mutable-globals.s
2

Landing https://reviews.llvm.org/D87666 first made this unnecessary so I could revert it.

This revision was landed with ongoing or failed builds.Sep 15 2020, 6:20 AM
This revision was automatically updated to reflect the committed changes.