llvm-project/lld/test/wasm/export-all.ll
Sam Clegg 177b458c8a [WebAssembly] Add --export-all flag
This causes all symbols to be exported in the final wasm binary
even if they were not compiled with default visibility.

This feature is useful for the emscripten toolchain that has a
corresponding EXPORT_ALL feature which allows the JS code to
interact with all C function.

Differential Revision: https://reviews.llvm.org/D47806

llvm-svn: 334157
2018-06-07 01:27:07 +00:00

46 lines
1.1 KiB
LLVM

; RUN: llc -O0 -filetype=obj %s -o %t.o
; RUN: wasm-ld -o %t.wasm %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
; RUN: wasm-ld --export-all -o %t.wasm %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s -check-prefix=EXPORT
; RUN: wasm-ld --export-all --no-gc-sections -o %t.wasm %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s -check-prefix=NOGC
; Verify the --export-all flag exports hidden symbols
target triple = "wasm32-unknown-unknown"
define hidden void @bar() local_unnamed_addr {
entry:
ret void
}
define hidden void @foo() local_unnamed_addr {
entry:
ret void
}
define hidden void @_start() local_unnamed_addr {
entry:
call void @foo()
ret void
}
; CHECK: - Type: EXPORT
; CHECK: - Name: _start
; CHECK-NOT: - Name: bar
; CHECK-NOT: - Name: foo
; EXPORT: - Type: EXPORT
; EXPORT: - Name: _start
; EXPORT-NOT: - Name: bar
; EXPORT: - Name: foo
; NOGC: - Type: EXPORT
; NOGC: - Name: _start
; NOGC: - Name: bar
; NOGC: - Name: foo