Index: docs/WebAssembly.rst =================================================================== --- docs/WebAssembly.rst +++ docs/WebAssembly.rst @@ -18,8 +18,8 @@ https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md. This is object format that the llvm will produce when run with the -``wasm32-unknown-unknown-wasm`` target. To build llvm with WebAssembly support -currently requires enabling the experimental backed using +``wasm32-unknown-unknown`` target triple. To build llvm with WebAssembly +support currently requires enabling the experimental backed using ``-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly``. Index: test/wasm/Inputs/archive1.ll =================================================================== --- test/wasm/Inputs/archive1.ll +++ test/wasm/Inputs/archive1.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + declare i32 @bar() local_unnamed_addr #1 define i32 @foo() local_unnamed_addr #0 { Index: test/wasm/Inputs/archive2.ll =================================================================== --- test/wasm/Inputs/archive2.ll +++ test/wasm/Inputs/archive2.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + declare i32 @foo() local_unnamed_addr #1 define i32 @bar() local_unnamed_addr #0 { Index: test/wasm/Inputs/call-indirect.ll =================================================================== --- test/wasm/Inputs/call-indirect.ll +++ test/wasm/Inputs/call-indirect.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + @indirect_bar = internal local_unnamed_addr global i64 ()* @bar, align 4 @indirect_foo = internal local_unnamed_addr global i32 ()* @foo, align 4 Index: test/wasm/Inputs/comdat1.ll =================================================================== --- test/wasm/Inputs/comdat1.ll +++ test/wasm/Inputs/comdat1.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + $inlineFn = comdat any @constantData = weak_odr constant [3 x i8] c"abc", comdat($inlineFn) define linkonce_odr i32 @inlineFn() comdat { Index: test/wasm/Inputs/comdat2.ll =================================================================== --- test/wasm/Inputs/comdat2.ll +++ test/wasm/Inputs/comdat2.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + $inlineFn = comdat any @constantData = weak_odr constant [3 x i8] c"abc", comdat($inlineFn) define linkonce_odr i32 @inlineFn() comdat { Index: test/wasm/Inputs/global-ctor-dtor.ll =================================================================== --- test/wasm/Inputs/global-ctor-dtor.ll +++ test/wasm/Inputs/global-ctor-dtor.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + define hidden void @myctor() { entry: ret void Index: test/wasm/Inputs/hello.ll =================================================================== --- test/wasm/Inputs/hello.ll +++ test/wasm/Inputs/hello.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + ; Wasm module generated from the following C code: ; void puts(const char*); ; void hello() { puts("hello\n"); } Index: test/wasm/Inputs/hidden.ll =================================================================== --- test/wasm/Inputs/hidden.ll +++ test/wasm/Inputs/hidden.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + ; Function Attrs: norecurse nounwind readnone define hidden i32 @archiveHidden() #0 { entry: Index: test/wasm/Inputs/locals-duplicate1.ll =================================================================== --- test/wasm/Inputs/locals-duplicate1.ll +++ test/wasm/Inputs/locals-duplicate1.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + ; Will collide: local (internal linkage) with global (external) linkage @colliding_global1 = internal default global i32 0, align 4 ; Will collide: global with local Index: test/wasm/Inputs/locals-duplicate2.ll =================================================================== --- test/wasm/Inputs/locals-duplicate2.ll +++ test/wasm/Inputs/locals-duplicate2.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + ; Will collide: local (internal linkage) with global (external) linkage @colliding_global1 = default global i32 0, align 4 ; Will collide: global with local Index: test/wasm/Inputs/many-funcs.ll =================================================================== --- test/wasm/Inputs/many-funcs.ll +++ test/wasm/Inputs/many-funcs.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + @g0 = global i32 1, align 4 @foo = global i32 1, align 4 Index: test/wasm/Inputs/ret32.ll =================================================================== --- test/wasm/Inputs/ret32.ll +++ test/wasm/Inputs/ret32.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + ; Function Attrs: norecurse nounwind readnone define i32 @ret32(float %arg) #0 { entry: Index: test/wasm/Inputs/ret64.ll =================================================================== --- test/wasm/Inputs/ret64.ll +++ test/wasm/Inputs/ret64.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + define i64 @ret64(double %arg) local_unnamed_addr #0 { entry: ret i64 1 Index: test/wasm/Inputs/weak-alias.ll =================================================================== --- test/wasm/Inputs/weak-alias.ll +++ test/wasm/Inputs/weak-alias.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + ; Function Attrs: norecurse nounwind readnone define i32 @direct_fn() #0 { entry: Index: test/wasm/Inputs/weak-symbol1.ll =================================================================== --- test/wasm/Inputs/weak-symbol1.ll +++ test/wasm/Inputs/weak-symbol1.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + define weak i32 @weakFn() #0 { entry: ret i32 1 Index: test/wasm/Inputs/weak-symbol2.ll =================================================================== --- test/wasm/Inputs/weak-symbol2.ll +++ test/wasm/Inputs/weak-symbol2.ll @@ -1,3 +1,5 @@ +target triple = "wasm32-unknown-unknown-wasm" + define weak i32 @weakFn() #0 { entry: ret i32 2 Index: test/wasm/alias.ll =================================================================== --- test/wasm/alias.ll +++ test/wasm/alias.ll @@ -1,7 +1,9 @@ -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s +; RUN: llc -filetype=obj -o %t.o %s ; RUN: lld -flavor wasm %t.o -o %t.wasm ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + @start_alias = alias i32 (), i32 ()* @_start ; Function Attrs: nounwind uwtable Index: test/wasm/archive.ll =================================================================== --- test/wasm/archive.ll +++ test/wasm/archive.ll @@ -1,7 +1,7 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/archive1.ll -o %t.a1.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/archive2.ll -o %t.a2.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/hello.ll -o %t.a3.o +; RUN: llc -filetype=obj %s -o %t.o +; RUN: llc -filetype=obj %S/Inputs/archive1.ll -o %t.a1.o +; RUN: llc -filetype=obj %S/Inputs/archive2.ll -o %t.a2.o +; RUN: llc -filetype=obj %S/Inputs/hello.ll -o %t.a3.o ; RUN: llvm-ar rcs %t.a %t.a1.o %t.a2.o %t.a3.o ; RUN: rm -f %t.imports ; RUN: not lld -flavor wasm %t.a %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-UNDEFINED %s @@ -13,6 +13,8 @@ ; RUN: llvm-nm -a %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + declare i32 @foo() local_unnamed_addr #1 declare i32 @missing_func() local_unnamed_addr #1 Index: test/wasm/call-indirect.ll =================================================================== --- test/wasm/call-indirect.ll +++ test/wasm/call-indirect.ll @@ -1,5 +1,5 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/call-indirect.ll -o %t2.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %p/Inputs/call-indirect.ll -o %t2.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm -o %t.wasm %t2.o %t.o ; RUN: obj2yaml %t.wasm | FileCheck %s @@ -8,6 +8,8 @@ ; int (*indirect_func)(void) = &foo; ; void _start(void) { indirect_func(); } +target triple = "wasm32-unknown-unknown-wasm" + @indirect_func = local_unnamed_addr global i32 ()* @foo, align 4 ; Function Attrs: norecurse nounwind readnone Index: test/wasm/comdats.ll =================================================================== --- test/wasm/comdats.ll +++ test/wasm/comdats.ll @@ -4,6 +4,8 @@ ; RUN: lld -flavor wasm -o %t.wasm %t.o %t1.o %t2.o ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + declare i32 @inlineFn() define void @_start() local_unnamed_addr { Index: test/wasm/conflict.test =================================================================== --- test/wasm/conflict.test +++ test/wasm/conflict.test @@ -1,4 +1,4 @@ -# RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o +# RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o # RUN: not lld -flavor wasm -o %t.wasm %t.ret32.o %t.ret32.o 2>&1 | FileCheck %s # CHECK: duplicate symbol: ret32 Index: test/wasm/data-layout.ll =================================================================== --- test/wasm/data-layout.ll +++ test/wasm/data-layout.ll @@ -1,5 +1,7 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/hello.ll -o %t.hello.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %p/Inputs/hello.ll -o %t.hello.o +; RUN: llc -filetype=obj %s -o %t.o + +target triple = "wasm32-unknown-unknown-wasm" @foo = hidden global i32 1, align 4 @aligned_bar = hidden global i32 3, align 16 Index: test/wasm/entry.ll =================================================================== --- test/wasm/entry.ll +++ test/wasm/entry.ll @@ -1,4 +1,6 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %s -o %t.o + +target triple = "wasm32-unknown-unknown-wasm" define hidden void @entry() local_unnamed_addr #0 { entry: Index: test/wasm/export.ll =================================================================== --- test/wasm/export.ll +++ test/wasm/export.ll @@ -1,8 +1,10 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: not lld -flavor wasm --export=missing -o %t.wasm %t.o 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s ; RUN: lld -flavor wasm --export=hidden_function -o %t.wasm %t.o ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + define hidden i32 @hidden_function() local_unnamed_addr { entry: ret i32 0 Index: test/wasm/function-imports-first.ll =================================================================== --- test/wasm/function-imports-first.ll +++ test/wasm/function-imports-first.ll @@ -1,8 +1,10 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm -o %t.wasm %t.o %t.ret32.o ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + ; Function Attrs: nounwind define hidden void @_start() local_unnamed_addr #0 { entry: Index: test/wasm/function-imports.ll =================================================================== --- test/wasm/function-imports.ll +++ test/wasm/function-imports.ll @@ -1,8 +1,10 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm -o %t.wasm %t.ret32.o %t.o ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + ; Function Attrs: nounwind define hidden void @_start() local_unnamed_addr #0 { entry: Index: test/wasm/function-index.test =================================================================== --- test/wasm/function-index.test +++ test/wasm/function-index.test @@ -1,5 +1,5 @@ -# RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o -# RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret64.ll -o %t.ret64.o +# RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o +# RUN: llc -filetype=obj %p/Inputs/ret64.ll -o %t.ret64.o # RUN: lld -flavor wasm -r -o %t.wasm %t.ret32.o %t.ret64.o # RUN: obj2yaml %t.wasm | FileCheck %s Index: test/wasm/import-memory.test =================================================================== --- test/wasm/import-memory.test +++ test/wasm/import-memory.test @@ -1,4 +1,4 @@ -# RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o +# RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o # RUN: lld -flavor wasm -entry ret32 --import-memory -o %t.wasm %t.ret32.o # RUN: obj2yaml %t.wasm | FileCheck %s Index: test/wasm/init-fini.ll =================================================================== --- test/wasm/init-fini.ll +++ test/wasm/init-fini.ll @@ -1,5 +1,7 @@ -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %S/Inputs/global-ctor-dtor.ll -o %t.global-ctor-dtor.o +; RUN: llc -filetype=obj -o %t.o %s +; RUN: llc -filetype=obj %S/Inputs/global-ctor-dtor.ll -o %t.global-ctor-dtor.o + +target triple = "wasm32-unknown-unknown-wasm" define hidden void @func1() { entry: Index: test/wasm/invalid-stack-size.ll =================================================================== --- test/wasm/invalid-stack-size.ll +++ test/wasm/invalid-stack-size.ll @@ -1,6 +1,8 @@ -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %s -o %t.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: not lld -flavor wasm -o %t.wasm -z stack-size=1 %t.o 2>&1 | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + define i32 @_start() local_unnamed_addr #1 { entry: ret i32 0 Index: test/wasm/load-undefined.ll =================================================================== --- test/wasm/load-undefined.ll +++ test/wasm/load-undefined.ll @@ -1,13 +1,15 @@ ; Verify that the -u / --undefined option is able to pull in symbols from ; an archive, and doesn't error when uses to pull in a symbol already loaded. ; -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/ret64.ll -o %t.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %S/Inputs/ret32.ll -o %t2.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t3.o +; RUN: llc -filetype=obj %S/Inputs/ret64.ll -o %t.o +; RUN: llc -filetype=obj %S/Inputs/ret32.ll -o %t2.o +; RUN: llc -filetype=obj %s -o %t3.o ; RUN: llvm-ar rcs %t2.a %t2.o ; RUN: lld -flavor wasm %t3.o %t2.a %t.o -o %t.wasm -u ret32 --undefined ret64 ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + define i32 @_start() local_unnamed_addr { entry: ret i32 1 Index: test/wasm/local-symbols.ll =================================================================== --- test/wasm/local-symbols.ll +++ test/wasm/local-symbols.ll @@ -1,7 +1,9 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm -o %t.wasm %t.o ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + @foo = default global i32 1, align 4 @bar = internal default global i32 3, align 4 Index: test/wasm/locals-duplicate.test =================================================================== --- test/wasm/locals-duplicate.test +++ test/wasm/locals-duplicate.test @@ -1,5 +1,5 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/locals-duplicate1.ll -o %t1.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/locals-duplicate2.ll -o %t2.o +; RUN: llc -filetype=obj %p/Inputs/locals-duplicate1.ll -o %t1.o +; RUN: llc -filetype=obj %p/Inputs/locals-duplicate2.ll -o %t2.o ; RUN: lld -flavor wasm --no-entry -o %t.wasm %t1.o %t2.o ; RUN: obj2yaml %t.wasm | FileCheck %s Index: test/wasm/many-functions.ll =================================================================== --- test/wasm/many-functions.ll +++ test/wasm/many-functions.ll @@ -1,5 +1,5 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/many-funcs.ll -o %t.many.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %p/Inputs/many-funcs.ll -o %t.many.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm -r -o %t.wasm %t.many.o %t.o ; RUN: obj2yaml %t.wasm | FileCheck %s @@ -8,6 +8,8 @@ ; 128 function and so the final output requires a 2-byte LEB in ; the CODE section header to store the function count. +target triple = "wasm32-unknown-unknown-wasm" + define i32 @func() { entry: %call = tail call i32 @func() Index: test/wasm/relocatable.ll =================================================================== --- test/wasm/relocatable.ll +++ test/wasm/relocatable.ll @@ -1,8 +1,10 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/hello.ll -o %t.hello.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %p/Inputs/hello.ll -o %t.hello.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm -r -o %t.wasm %t.hello.o %t.o ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + ; Function Attrs: nounwind define hidden i32 @my_func() local_unnamed_addr { entry: Index: test/wasm/signature-mismatch.ll =================================================================== --- test/wasm/signature-mismatch.ll +++ test/wasm/signature-mismatch.ll @@ -1,7 +1,9 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.main.o +; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o +; RUN: llc -filetype=obj %s -o %t.main.o ; RUN: not lld -flavor wasm --check-signatures -o %t.wasm %t.main.o %t.ret32.o 2>&1 | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + ; Function Attrs: nounwind define hidden void @_start() local_unnamed_addr #0 { entry: Index: test/wasm/stack-pointer.ll =================================================================== --- test/wasm/stack-pointer.ll +++ test/wasm/stack-pointer.ll @@ -1,7 +1,9 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm --relocatable -o %t.wasm %t.o ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + ; Function Attrs: nounwind define i32 @_start() local_unnamed_addr { entry: Index: test/wasm/strip-debug.test =================================================================== --- test/wasm/strip-debug.test +++ test/wasm/strip-debug.test @@ -1,4 +1,4 @@ -RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o +RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o RUN: lld -flavor wasm --strip-debug --entry=ret32 -o %t.wasm %t.ret32.o RUN: obj2yaml %t.wasm | FileCheck %s Index: test/wasm/symbol-type-mismatch.ll =================================================================== --- test/wasm/symbol-type-mismatch.ll +++ test/wasm/symbol-type-mismatch.ll @@ -1,7 +1,9 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o +; RUN: llc -filetype=obj %s -o %t.o +; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o ; RUN: not lld -flavor wasm -o %t.wasm %t.o %t.ret32.o 2>&1 | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + @ret32 = extern_weak global i32, align 4 ; CHECK: error: symbol type mismatch: ret32 Index: test/wasm/undefined-entry.test =================================================================== --- test/wasm/undefined-entry.test +++ test/wasm/undefined-entry.test @@ -1,4 +1,4 @@ -RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/ret32.ll -o %t.ret32.o +RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o RUN: not lld -flavor wasm -o %t.wasm %t.ret32.o 2>&1 | FileCheck %s CHECK: error: undefined symbol: _start Index: test/wasm/undefined.ll =================================================================== --- test/wasm/undefined.ll +++ test/wasm/undefined.ll @@ -1,4 +1,4 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm --allow-undefined -o %t.wasm %t.o ; Fails due to undefined 'foo' @@ -9,6 +9,8 @@ ; RUN: echo 'foo' > %t.txt ; RUN: lld -flavor wasm --allow-undefined-file=%t.txt -o %t.wasm %t.o +target triple = "wasm32-unknown-unknown-wasm" + ; Takes the address of the external foo() resulting in undefined external @bar = hidden local_unnamed_addr global i8* bitcast (i32 ()* @foo to i8*), align 4 Index: test/wasm/version.ll =================================================================== --- test/wasm/version.ll +++ test/wasm/version.ll @@ -1,7 +1,9 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm -o %t.wasm %t.o ; RUN: llvm-readobj -file-headers %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + define hidden void @_start() local_unnamed_addr #0 { entry: ret void Index: test/wasm/visibility-hidden.ll =================================================================== --- test/wasm/visibility-hidden.ll +++ test/wasm/visibility-hidden.ll @@ -1,5 +1,5 @@ -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %S/Inputs/hidden.ll -o %t2.o +; RUN: llc -filetype=obj -o %t.o %s +; RUN: llc -filetype=obj %S/Inputs/hidden.ll -o %t2.o ; RUN: llvm-ar rcs %t2.a %t2.o ; RUN: lld -flavor wasm %t.o %t2.a -o %t.wasm ; RUN: obj2yaml %t.wasm | FileCheck %s @@ -7,6 +7,8 @@ ; Test that hidden symbols are not exported, whether pulled in from an archive ; or directly. +target triple = "wasm32-unknown-unknown-wasm" + define hidden i32 @objectHidden() { entry: ret i32 0 Index: test/wasm/weak-alias-overide.ll =================================================================== --- test/wasm/weak-alias-overide.ll +++ test/wasm/weak-alias-overide.ll @@ -1,11 +1,13 @@ -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o +; RUN: llc -filetype=obj -o %t.o %s +; RUN: llc -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o ; RUN: lld -flavor wasm %t.o %t2.o -o %t.wasm ; RUN: obj2yaml %t.wasm | FileCheck %s ; Test that the strongly defined alias_fn from this file is used both here ; and in call_alias. +target triple = "wasm32-unknown-unknown-wasm" + define i32 @alias_fn() local_unnamed_addr #1 { ret i32 1 } Index: test/wasm/weak-alias.ll =================================================================== --- test/wasm/weak-alias.ll +++ test/wasm/weak-alias.ll @@ -1,10 +1,12 @@ -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o +; RUN: llc -filetype=obj -o %t.o %s +; RUN: llc -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o ; RUN: lld -flavor wasm %t.o %t2.o -o %t.wasm ; RUN: obj2yaml %t.wasm | FileCheck %s ; Test that weak aliases (alias_fn is a weak alias of direct_fn) are linked correctly +target triple = "wasm32-unknown-unknown-wasm" + declare i32 @alias_fn() local_unnamed_addr #1 ; Function Attrs: nounwind uwtable Index: test/wasm/weak-symbols.ll =================================================================== --- test/wasm/weak-symbols.ll +++ test/wasm/weak-symbols.ll @@ -1,9 +1,11 @@ -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/weak-symbol1.ll -o %t1.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %p/Inputs/weak-symbol2.ll -o %t2.o -; RUN: llc -filetype=obj -mtriple=wasm32-unknown-unknown-wasm %s -o %t.o +; RUN: llc -filetype=obj %p/Inputs/weak-symbol1.ll -o %t1.o +; RUN: llc -filetype=obj %p/Inputs/weak-symbol2.ll -o %t2.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: lld -flavor wasm -o %t.wasm %t.o %t1.o %t2.o ; RUN: obj2yaml %t.wasm | FileCheck %s +target triple = "wasm32-unknown-unknown-wasm" + declare i32 @weakFn() local_unnamed_addr @weakGlobal = external global i32 Index: test/wasm/weak-undefined.ll =================================================================== --- test/wasm/weak-undefined.ll +++ test/wasm/weak-undefined.ll @@ -1,10 +1,12 @@ -; RUN: llc -mtriple=wasm32-unknown-unknown-wasm -filetype=obj -o %t.o %s +; RUN: llc -filetype=obj -o %t.o %s ; RUN: lld -flavor wasm -strip-debug %t.o -o %t.wasm ; RUN: obj2yaml %t.wasm | FileCheck %s ; Test that undefined weak externals (global_var) and (foo) don't cause ; link failures and resolve to zero. +target triple = "wasm32-unknown-unknown-wasm" + @global_var = extern_weak global i32, align 4 declare extern_weak i32 @foo()