[lld][WebAssembly] Fix --export-all when __stack_pointer is present
authorSam Clegg <sbc@chromium.org>
Tue, 15 Sep 2020 01:28:26 +0000 (18:28 -0700)
committerSam Clegg <sbc@chromium.org>
Tue, 15 Sep 2020 13:17:01 +0000 (06:17 -0700)
commit3f411e97739ffbdca0077d1c4fdc9c1fc1819019
treecd54cb803bc1932c440554b207626edfdb9c1609
parentfe395aecd9e70b815e6490639098d815385f9932
[lld][WebAssembly] Fix --export-all when __stack_pointer is present

With https://reviews.llvm.org/D87537 we made it an error
to import or export a mutable global with the +mutable-globals
feature present.  However the scan was of the entire symbol
table rather than just the imports or exports and the filter
didn't match exaclyt meaning the `__stack_pointer` (a mutable
global) was always triggering with error when the `--export-all`
flag was used.

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.

Differential Revision: https://reviews.llvm.org/D87663
lld/test/wasm/export-all.s [new file with mode: 0644]
lld/wasm/SyntheticSections.h
lld/wasm/Writer.cpp