[WebAssembly] Support `annotate` clang attributes for marking functions.
authorBrendan Dahl <brendan.dahl@gmail.com>
Tue, 11 Jul 2023 22:12:26 +0000 (15:12 -0700)
committerDerek Schuff <dschuff@chromium.org>
Tue, 11 Jul 2023 22:17:26 +0000 (15:17 -0700)
commit220fe00a7c0f73164711f0d6cdefacef264b85dc
treea570739a4f329a3363274f3c3a99456c694df424
parent78af051ff0e16db73201b1370e34206a6a4c1b93
[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
16 files changed:
lld/test/wasm/func-attr-tombstone.s [new file with mode: 0644]
lld/test/wasm/func-attr.s [new file with mode: 0644]
lld/test/wasm/merge-func-attr-section.s [new file with mode: 0644]
lld/wasm/InputChunks.cpp
lld/wasm/InputFiles.cpp
llvm/docs/ReleaseNotes.rst
llvm/include/llvm/BinaryFormat/WasmRelocs.def
llvm/include/llvm/MC/MCExpr.h
llvm/lib/MC/MCExpr.cpp
llvm/lib/MC/WasmObjectWriter.cpp
llvm/lib/Object/WasmObjectFile.cpp
llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.h
llvm/test/CodeGen/WebAssembly/func-attr-annotate.ll [new file with mode: 0644]
llvm/test/MC/WebAssembly/func-attr.s [new file with mode: 0644]