[all-commits] [llvm/llvm-project] 9261ee: [WebAssembly] Make EH work with dynamic linking
Heejin Ahn via All-commits
all-commits at lists.llvm.org
Tue Oct 12 23:28:57 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9261ee32dc41ae6f2ebf0608c3cec22daf5ec494
https://github.com/llvm/llvm-project/commit/9261ee32dc41ae6f2ebf0608c3cec22daf5ec494
Author: Heejin Ahn <aheejin at gmail.com>
Date: 2021-10-12 (Tue, 12 Oct 2021)
Changed paths:
M lld/test/wasm/Inputs/tag-section1.ll
M lld/test/wasm/Inputs/tag-section2.ll
M lld/test/wasm/tag-section.ll
M lld/wasm/InputFiles.cpp
M lld/wasm/SymbolTable.cpp
M lld/wasm/SymbolTable.h
M lld/wasm/Symbols.cpp
M lld/wasm/Symbols.h
M lld/wasm/SyntheticSections.cpp
M lld/wasm/SyntheticSections.h
M llvm/lib/CodeGen/AsmPrinter/WasmException.cpp
M llvm/lib/Object/WasmObjectFile.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
M llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
M llvm/test/CodeGen/WebAssembly/eh-lsda.ll
Log Message:
-----------
[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
More information about the All-commits
mailing list