diff options
author | Sam Clegg <sbc@chromium.org> | 2019-04-02 14:53:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-02 14:53:48 -0700 |
commit | b192c53c6ef549bb5264bc58a71424ce311a4890 (patch) | |
tree | 895f6535ba16bed2c5ec75d365dfe37eda776315 /test/lld/shared.c | |
parent | 8e8cb825cd28bc1c188f9cf796bd97626bc1bb40 (diff) | |
download | binaryen-b192c53c6ef549bb5264bc58a71424ce311a4890.tar.gz binaryen-b192c53c6ef549bb5264bc58a71424ce311a4890.tar.bz2 binaryen-b192c53c6ef549bb5264bc58a71424ce311a4890.zip |
wasm-emscripten-finalize: Improve shared library support (#1961)
Convert PIC code generated by llvm to work with the current emscripten
ABI for dynamic linking:
- Convert mutable global imports from GOT.mem and GOT.func into
internal globals.
- Initialize these globals on started up in g$foo and f$foo imported functions
to calculate addresses at runtime.
Also:
- Add a test case for linking and finalizing a shared library
- Allow __stack_pointer global to be non-existent as can be case for
a shared library.
- Allow __stack_pointer global to be an import, as can be the case for
a shared library.
Diffstat (limited to 'test/lld/shared.c')
-rw-r--r-- | test/lld/shared.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/lld/shared.c b/test/lld/shared.c new file mode 100644 index 000000000..1d98b068b --- /dev/null +++ b/test/lld/shared.c @@ -0,0 +1,7 @@ +int puts(const char* str); +extern int external_var; + +int print_message() { + puts("Hello, world"); + return external_var; +} |