Files
clang-p2996/lld/test/wasm/func-attr.s
Brendan Dahl 220fe00a7c [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
2023-07-11 15:17:26 -07:00

36 lines
969 B
ArmAsm

# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
# RUN: wasm-ld %t.o -o %t.wasm
# RUN: obj2yaml %t.wasm | FileCheck %s
.functype foo () -> ()
.functype bar () -> ()
.functype _start () -> ()
.globl foo
.type foo,@function
foo:
.functype foo () -> ()
end_function
.section .text.bar,"",@
.globl bar
.type bar,@function
bar:
.functype bar () -> ()
end_function
.globl _start
.type _start,@function
_start:
.functype _start () -> ()
call foo
call bar
end_function
.section .custom_section.llvm.func_attr.custom0,"",@
.int32 foo@FUNCINDEX
.int32 bar@FUNCINDEX
# CHECK: - Type: CUSTOM
# CHECK-NEXT: Name: llvm.func_attr.custom0
# CHECK-NEXT: Payload: '0000000001000000'