1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/test/MC/WebAssembly/export-name.s
Sam Clegg 998874b92b [WebAssembly] Add new export_name clang attribute for controlling wasm export names
This is equivalent to the existing `import_name` and `import_module`
attributes which control the import names in the final wasm binary
produced by lld.

This maps the existing

This attribute currently requires a string rather than using the
symbol name for a couple of reasons:

1. Avoid confusion with static and dynamic linking which is
   based on symbol name.  Exporting a function from a wasm module using
   this directive is orthogonal to both static and dynamic linking.
2. Avoids name mangling.

Differential Revision: https://reviews.llvm.org/D70520
2019-12-11 11:54:57 -08:00

27 lines
951 B
ArmAsm

# RUN: llvm-mc -triple=wasm32-unknown-unknown < %s | FileCheck %s
# Check that it also comiled to object for format.
# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -o - < %s | obj2yaml | FileCheck -check-prefix=CHECK-OBJ %s
foo:
.globl foo
.functype foo () -> ()
.export_name foo, bar
end_function
# CHECK: .export_name foo, bar
# CHECK-OBJ: - Type: EXPORT
# CHECK-OBJ-NEXT: Exports:
# CHECK-OBJ-NEXT: - Name: bar
# CHECK-OBJ-NEXT: Kind: FUNCTION
# CHECK-OBJ-NEXT: Index: 0
# CHECK-OBJ: Name: linking
# CHECK-OBJ-NEXT: Version: 2
# CHECK-OBJ-NEXT: SymbolTable:
# CHECK-OBJ-NEXT: - Index: 0
# CHECK-OBJ-NEXT: Kind: FUNCTION
# CHECK-OBJ-NEXT: Name: foo
# CHECK-OBJ-NEXT: Flags: [ EXPORTED ]
# CHECK-OBJ-NEXT: Function: 0