1; Test in default mode 2; RUN: llc -filetype=obj %s -o %t.o 3; RUN: not wasm-ld --export=missing -o %t.wasm %t.o 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s 4; RUN: wasm-ld --export=hidden_function -o %t.wasm %t.o 5; RUN: obj2yaml %t.wasm | FileCheck %s 6 7; Now test in Emscripten mode 8; RUN: llc -filetype=obj %s -o %t.o -mtriple=wasm32-unknown-emscripten 9; RUN: not wasm-ld --export=missing -o %t.wasm %t.o 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s 10; RUN: wasm-ld --export=hidden_function -o %t.wasm %t.o 11; RUN: obj2yaml %t.wasm | FileCheck %s --check-prefixes=CHECK,EMSCRIPTEN 12 13target triple = "wasm32-unknown-unknown" 14 15@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @used_function to i8*)], section "llvm.metadata" 16 17; Not exported by default, but forced via commandline 18define hidden i32 @hidden_function() local_unnamed_addr { 19entry: 20 ret i32 0 21} 22 23; Not exported by default 24define i32 @default_function() local_unnamed_addr { 25entry: 26 ret i32 0 27} 28 29; Exported because its part of llvm.used 30define i32 @used_function() local_unnamed_addr { 31entry: 32 ret i32 0 33} 34 35; Exported by default 36define void @_start() local_unnamed_addr { 37entry: 38 ret void 39} 40 41; CHECK-ERROR: error: symbol exported via --export not found: missing 42 43; CHECK-NOT: - Name: default_function 44 45; CHECK: - Type: EXPORT 46; CHECK-NEXT: Exports: 47; CHECK-NEXT: - Name: memory 48; CHECK-NEXT: Kind: MEMORY 49; CHECK-NEXT: Index: 0 50; CHECK-NEXT: - Name: hidden_function 51; CHECK-NEXT: Kind: FUNCTION 52; CHECK-NEXT: Index: 0 53; EMSCRIPTEN-NEXT: - Name: used_function 54; EMSCRIPTEN-NEXT: Kind: FUNCTION 55; EMSCRIPTEN-NEXT: Index: 1 56; CHECK-NEXT: - Name: _start 57; CHECK-NEXT: Kind: FUNCTION 58; CHECK-NEXT: Index: 2 59; CHECK-NEXT: - Type: CODE 60