llvm-project/lld/wasm
Heejin Ahn 9261ee32dc [WebAssembly] Make EH work with dynamic linking
This makes Wasm EH work with dynamic linking. So far we were only able
to handle destructors, which do not use any tags or LSDA info.

1. This uses `TargetExternalSymbol` for `GCC_except_tableN` symbols,
   which points to the address of per-function LSDA info. It is more
   convenient to use than `MCSymbol` because it can take additional
   target flags.

2. When lowering `wasm_lsda` intrinsic, if PIC is enabled, make the
   symbol relative to `__memory_base` and generate the `add` node. If
   PIC is disabled, continue to use the absolute address.

3. Make tag symbols (`__cpp_exception` and `__c_longjmp`) undefined in
   the backend, because it is hard to make it work with dynamic
   linking's loading order. Instead, we make all tag symbols undefined
   in the LLVM backend and import it from JS.

4. Add support for undefined tags to the linker.

Companion patches:
- https://github.com/WebAssembly/binaryen/pull/4223
- https://github.com/emscripten-core/emscripten/pull/15266

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D111388
2021-10-12 23:28:27 -07:00
..
CMakeLists.txt Reland: "[lld][WebAssembly] Initial support merging string data" 2021-05-10 16:03:38 -07:00
Config.h [lld][WebAssembly] Add new `--import-undefined` option 2021-06-17 11:44:21 -07:00
Driver.cpp [lld][WebAssembly] Create optional internal symbols only after LTO object as been added 2021-10-05 13:31:09 -07:00
InputChunks.cpp [WebAssembly] Support R_WASM_MEMORY_ADDR_TLS_SLEB64 for wasm64 2021-07-19 10:22:43 -07:00
InputChunks.h [WebAssembly] Add explict TLS symbol flag 2021-09-09 10:03:30 -04:00
InputElement.h [WebAssembly] Remove WasmTagType 2021-10-05 17:11:22 -07:00
InputFiles.cpp [WebAssembly] Make EH work with dynamic linking 2021-10-12 23:28:27 -07:00
InputFiles.h [Object][WebAssemlby] Report function types (signatures). NFC 2021-10-04 17:33:56 -07:00
LTO.cpp [LTO][wasm][NewPM] Allow using new pass manager for wasm LTO 2020-12-01 12:22:40 -08:00
LTO.h [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
MapFile.cpp [WebAssembly][lld] Fix segfault on .bss sections in mapfile 2021-07-07 23:31:48 -07:00
MapFile.h [lld][WebAssembly] Add initial support for -Map/--print-map 2020-09-12 16:10:51 -07:00
MarkLive.cpp [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
MarkLive.h
Options.td [lld][WebAssembly] Add new `--import-undefined` option 2021-06-17 11:44:21 -07:00
OutputSections.cpp [lld][WebAssembly] Cleanup output of --verbose 2021-09-10 11:35:50 -04:00
OutputSections.h [lld][WebAssembly] Cleanup output of --verbose 2021-09-10 11:35:50 -04:00
OutputSegment.cpp [lld][WebAssembly] Enable string tail merging in debug sections 2021-05-18 12:25:39 -07:00
OutputSegment.h [lld][WebAssembly] Refactor input chunk class hierarchy. NFC 2021-05-17 21:01:17 -07:00
Relocations.cpp [lld][WebAssembly] Remove redundant check for undefined global (NFC) 2021-10-05 15:11:27 -07:00
Relocations.h [Coding style change][lld] Rename variables for non-ELF ports 2019-07-11 05:40:30 +00:00
SymbolTable.cpp [WebAssembly] Make EH work with dynamic linking 2021-10-12 23:28:27 -07:00
SymbolTable.h [WebAssembly] Make EH work with dynamic linking 2021-10-12 23:28:27 -07:00
Symbols.cpp [WebAssembly] Make EH work with dynamic linking 2021-10-12 23:28:27 -07:00
Symbols.h [WebAssembly] Make EH work with dynamic linking 2021-10-12 23:28:27 -07:00
SyntheticSections.cpp [WebAssembly] Make EH work with dynamic linking 2021-10-12 23:28:27 -07:00
SyntheticSections.h [WebAssembly] Make EH work with dynamic linking 2021-10-12 23:28:27 -07:00
Writer.cpp [WebAssembly] Allow import and export of TLS symbols between DSOs 2021-09-14 06:47:37 -07:00
Writer.h [WebAssembly] Refactor synthetic sections and relocation processing. NFC. 2019-05-21 09:13:09 +00:00
WriterUtils.cpp [WebAssembly] Remove WasmTagType 2021-10-05 17:11:22 -07:00
WriterUtils.h [WebAssembly] Remove WasmTagType 2021-10-05 17:11:22 -07:00