diff options
author | Brendan Dahl <brendan.dahl@gmail.com> | 2023-07-11 15:12:26 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2023-07-11 15:17:26 -0700 |
commit | 220fe00a7c0f73164711f0d6cdefacef264b85dc (patch) | |
tree | a570739a4f329a3363274f3c3a99456c694df424 /llvm/lib/MC/MCExpr.cpp | |
parent | 78af051ff0e16db73201b1370e34206a6a4c1b93 (diff) | |
download | llvm-220fe00a7c0f73164711f0d6cdefacef264b85dc.zip llvm-220fe00a7c0f73164711f0d6cdefacef264b85dc.tar.gz llvm-220fe00a7c0f73164711f0d6cdefacef264b85dc.tar.bz2 |
[WebAssembly] Support `annotate` clang attributes for marking functions.
Annotation attributes may be attached to a function to mark it with
custom data that will be contained in the final Wasm file. The
annotation causes a custom section named
"func_attr.annotate.<name>.<arg0>.<arg1>..." to be created that will
contain each function's index value that was marked with the annotation.
A new patchable relocation type for function indexes had to be created so
the custom section could be updated during linking.
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D150803
Diffstat (limited to 'llvm/lib/MC/MCExpr.cpp')
-rw-r--r-- | llvm/lib/MC/MCExpr.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index a73ae52..f2caadd 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -362,6 +362,7 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) { case VK_WASM_TLSREL: return "TLSREL"; case VK_WASM_TBREL: return "TBREL"; case VK_WASM_GOT_TLS: return "GOT@TLS"; + case VK_WASM_FUNCINDEX: return "FUNCINDEX"; case VK_AMDGPU_GOTPCREL32_LO: return "gotpcrel32@lo"; case VK_AMDGPU_GOTPCREL32_HI: return "gotpcrel32@hi"; case VK_AMDGPU_REL32_LO: return "rel32@lo"; @@ -505,6 +506,7 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) { .Case("mbrel", VK_WASM_MBREL) .Case("tlsrel", VK_WASM_TLSREL) .Case("got@tls", VK_WASM_GOT_TLS) + .Case("funcindex", VK_WASM_FUNCINDEX) .Case("gotpcrel32@lo", VK_AMDGPU_GOTPCREL32_LO) .Case("gotpcrel32@hi", VK_AMDGPU_GOTPCREL32_HI) .Case("rel32@lo", VK_AMDGPU_REL32_LO) |