[llvm-branch-commits] [lld] fd1c894 - [lld][WebAssembly] Convert some lld tests to assembly

Sam Clegg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 28 16:54:20 PDT 2020


Author: Sam Clegg
Date: 2020-05-28T16:52:01-07:00
New Revision: fd1c894a4a3690b2e500bfdf71194e9cc3f1b399

URL: https://github.com/llvm/llvm-project/commit/fd1c894a4a3690b2e500bfdf71194e9cc3f1b399
DIFF: https://github.com/llvm/llvm-project/commit/fd1c894a4a3690b2e500bfdf71194e9cc3f1b399.diff

LOG: [lld][WebAssembly] Convert some lld tests to assembly

When we originally wrote these tests we didn't have a stable and
fleshed out assembly format.  Now we do so we should prefer that
over llvm ir for lld tests to avoid including more part of llvm
than necessary in order to run the test.

This change converts just 30 out of about 130 test files. More to
come when I have some more time.

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

Added: 
    lld/test/wasm/Inputs/call-indirect.s
    lld/test/wasm/Inputs/call-ret32.s
    lld/test/wasm/Inputs/hello.s
    lld/test/wasm/Inputs/hidden.s
    lld/test/wasm/Inputs/import-attributes.s
    lld/test/wasm/Inputs/optional-symbol.s
    lld/test/wasm/Inputs/ret32.s
    lld/test/wasm/Inputs/ret64.s
    lld/test/wasm/Inputs/start.s
    lld/test/wasm/Inputs/strong-symbol.s
    lld/test/wasm/Inputs/weak-symbol1.s
    lld/test/wasm/Inputs/weak-symbol2.s
    lld/test/wasm/alias.s
    lld/test/wasm/archive-no-index.s
    lld/test/wasm/bss-only.s
    lld/test/wasm/demangle.s
    lld/test/wasm/entry-signature.s
    lld/test/wasm/export-optional-lazy.test
    lld/test/wasm/import-attribute-mismatch.s
    lld/test/wasm/no-tls.ll
    lld/test/wasm/optional-symbol.s
    lld/test/wasm/symbol-type-mismatch.s
    lld/test/wasm/version.s

Modified: 
    lld/test/wasm/archive-export.ll
    lld/test/wasm/archive-weak-undefined.ll
    lld/test/wasm/archive.ll
    lld/test/wasm/call-indirect.ll
    lld/test/wasm/compress-relocs.ll
    lld/test/wasm/conflict.test
    lld/test/wasm/data-layout.ll
    lld/test/wasm/emit-relocs-fpic.s
    lld/test/wasm/emit-relocs.ll
    lld/test/wasm/export-empty.test
    lld/test/wasm/export-table.test
    lld/test/wasm/fatal-warnings.ll
    lld/test/wasm/function-imports-first.ll
    lld/test/wasm/function-imports.ll
    lld/test/wasm/function-index.test
    lld/test/wasm/global-base.test
    lld/test/wasm/growable-table.test
    lld/test/wasm/import-memory.test
    lld/test/wasm/import-table.test
    lld/test/wasm/invalid-stack-size.test
    lld/test/wasm/large-memory.test
    lld/test/wasm/load-undefined.test
    lld/test/wasm/pic-static.ll
    lld/test/wasm/relocatable.ll
    lld/test/wasm/responsefile.test
    lld/test/wasm/shared-needed.ll
    lld/test/wasm/signature-mismatch-export.ll
    lld/test/wasm/signature-mismatch-unknown.ll
    lld/test/wasm/signature-mismatch-weak.ll
    lld/test/wasm/signature-mismatch.ll
    lld/test/wasm/stack-first.test
    lld/test/wasm/strip-all.test
    lld/test/wasm/strip-debug.test
    lld/test/wasm/trace-symbol.ll
    lld/test/wasm/trace.test
    lld/test/wasm/undefined-entry.test
    lld/test/wasm/visibility-hidden.ll
    lld/test/wasm/weak-symbols.ll
    lld/test/wasm/whole-archive.test

Removed: 
    lld/test/wasm/Inputs/call-indirect.ll
    lld/test/wasm/Inputs/call-ret32.ll
    lld/test/wasm/Inputs/hello.ll
    lld/test/wasm/Inputs/hidden.ll
    lld/test/wasm/Inputs/import-attributes.ll
    lld/test/wasm/Inputs/optional-symbol.ll
    lld/test/wasm/Inputs/ret32.ll
    lld/test/wasm/Inputs/ret64.ll
    lld/test/wasm/Inputs/start.ll
    lld/test/wasm/Inputs/strong-symbol.ll
    lld/test/wasm/Inputs/weak-symbol1.ll
    lld/test/wasm/Inputs/weak-symbol2.ll
    lld/test/wasm/alias.ll
    lld/test/wasm/archive-no-index.ll
    lld/test/wasm/bss-only.ll
    lld/test/wasm/demangle.ll
    lld/test/wasm/entry-signature.ll
    lld/test/wasm/export-optional-lazy.ll
    lld/test/wasm/import-attribute-mismatch.ll
    lld/test/wasm/no-tls.test
    lld/test/wasm/optional-symbol.ll
    lld/test/wasm/symbol-type-mismatch.ll
    lld/test/wasm/version.ll


################################################################################
diff  --git a/lld/test/wasm/Inputs/call-indirect.ll b/lld/test/wasm/Inputs/call-indirect.ll
deleted file mode 100644
index 6afcf30c2515..000000000000
--- a/lld/test/wasm/Inputs/call-indirect.ll
+++ /dev/null
@@ -1,20 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
- at indirect_bar = internal local_unnamed_addr global i64 ()* @bar, align 4
- at indirect_foo = internal local_unnamed_addr global i32 ()* @foo, align 4
-
-declare i32 @foo() local_unnamed_addr
-
-define i64 @bar() {
-entry:
-  ret i64 1
-}
-
-define void @call_bar_indirect() local_unnamed_addr #1 {
-entry:
-  %0 = load i64 ()*, i64 ()** @indirect_bar, align 4
-  %1 = load i32 ()*, i32 ()** @indirect_foo, align 4
-  %call0 = tail call i64 %0() #2
-  %call1 = tail call i32 %1() #2
-  ret void
-}

diff  --git a/lld/test/wasm/Inputs/call-indirect.s b/lld/test/wasm/Inputs/call-indirect.s
new file mode 100644
index 000000000000..c181aa19ad6b
--- /dev/null
+++ b/lld/test/wasm/Inputs/call-indirect.s
@@ -0,0 +1,28 @@
+  .globl  bar
+bar:
+  .functype bar () -> (i64)
+  i64.const 1
+  end_function
+
+  .globl  call_bar_indirect
+call_bar_indirect:
+  .functype call_bar_indirect () -> ()
+  i32.load  indirect_bar
+  call_indirect () -> (i64)
+  drop
+  i32.load  indirect_foo
+  call_indirect () -> (i32)
+  drop
+  end_function
+
+  .section  .data.indirect_bar,"",@
+indirect_bar:
+  .int32  bar
+  .size indirect_bar, 4
+
+  .section  .data.indirect_foo,"",@
+indirect_foo:
+  .int32  foo
+  .size indirect_foo, 4
+
+  .functype foo () -> (i32)

diff  --git a/lld/test/wasm/Inputs/call-ret32.ll b/lld/test/wasm/Inputs/call-ret32.ll
deleted file mode 100644
index 90cbf9684573..000000000000
--- a/lld/test/wasm/Inputs/call-ret32.ll
+++ /dev/null
@@ -1,11 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
- at ret32_address = global i32 (float)* @ret32, align 4
-
-define hidden i32* @call_ret32() {
-entry:
-  %call1 = call i32 @ret32(float 0.000000e+00)
-  ret i32* bitcast (i32 (float)** @ret32_address to i32*)
-}
-
-declare i32 @ret32(float)

diff  --git a/lld/test/wasm/Inputs/call-ret32.s b/lld/test/wasm/Inputs/call-ret32.s
new file mode 100644
index 000000000000..b0c812905917
--- /dev/null
+++ b/lld/test/wasm/Inputs/call-ret32.s
@@ -0,0 +1,16 @@
+  .globl  call_ret32
+call_ret32:
+  .functype call_ret32 () -> (i32)
+  f32.const 0x0p0
+  call  ret32
+  drop
+  i32.const ret32_address
+  end_function
+
+  .section  .data.ret32_address,"",@
+  .globl ret32_address
+ret32_address:
+  .int32  ret32
+  .size ret32_address, 4
+
+  .functype ret32 (f32) -> (i32)

diff  --git a/lld/test/wasm/Inputs/hello.ll b/lld/test/wasm/Inputs/hello.ll
deleted file mode 100644
index 675566861cc7..000000000000
--- a/lld/test/wasm/Inputs/hello.ll
+++ /dev/null
@@ -1,17 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
-; Wasm module generated from the following C code:
-;   void puts(const char*);
-;   void hello() { puts("hello\n"); }
-
- at hello_str = unnamed_addr constant [7 x i8] c"hello\0A\00", align 1
-
-; Function Attrs: nounwind
-define hidden void @hello() local_unnamed_addr #0 {
-entry:
-  tail call void @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @hello_str, i32 0, i32 0))
-  ret void
-}
-
-; Function Attrs: nounwind
-declare void @puts(i8* nocapture readonly) local_unnamed_addr #1

diff  --git a/lld/test/wasm/Inputs/hello.s b/lld/test/wasm/Inputs/hello.s
new file mode 100644
index 000000000000..b245262f9eba
--- /dev/null
+++ b/lld/test/wasm/Inputs/hello.s
@@ -0,0 +1,18 @@
+# asm generated by clang from the following C code:
+#   void puts(const char*);
+#   void hello() { puts("hello\n"); }
+
+  .globl  hello
+hello:
+  .functype hello () -> ()
+  i32.const hello_str
+  call  puts
+  end_function
+
+  .section  .rodata.hello_str,"",@
+  .globl  hello_str
+hello_str:
+  .asciz  "hello\n"
+  .size hello_str, 7
+
+  .functype puts (i32) -> ()

diff  --git a/lld/test/wasm/Inputs/hidden.ll b/lld/test/wasm/Inputs/hidden.ll
deleted file mode 100644
index 4af16b3b99ed..000000000000
--- a/lld/test/wasm/Inputs/hidden.ll
+++ /dev/null
@@ -1,13 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
-; Function Attrs: norecurse nounwind readnone
-define hidden i32 @archiveHidden() #0 {
-entry:
-    ret i32 0
-}
-
-; Function Attrs: norecurse nounwind readnone
-define i32 @archiveDefault() #1 {
-entry:
-    ret i32 0
-}

diff  --git a/lld/test/wasm/Inputs/hidden.s b/lld/test/wasm/Inputs/hidden.s
new file mode 100644
index 000000000000..58b9f5988bfa
--- /dev/null
+++ b/lld/test/wasm/Inputs/hidden.s
@@ -0,0 +1,12 @@
+  .hidden archiveHidden
+  .globl  archiveHidden
+archiveHidden:
+  .functype archiveHidden () -> (i32)
+  i32.const 0
+  end_function
+
+  .globl  archiveDefault
+archiveDefault:
+  .functype archiveDefault () -> (i32)
+  i32.const 0
+  end_function

diff  --git a/lld/test/wasm/Inputs/import-attributes.ll b/lld/test/wasm/Inputs/import-attributes.ll
deleted file mode 100644
index 27ee2774f221..000000000000
--- a/lld/test/wasm/Inputs/import-attributes.ll
+++ /dev/null
@@ -1,10 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
-define void @call_foo() {
-  call void @foo();
-  ret void
-}
-
-declare void @foo() #0
-
-attributes #0 = { "wasm-import-module"="baz" }

diff  --git a/lld/test/wasm/Inputs/import-attributes.s b/lld/test/wasm/Inputs/import-attributes.s
new file mode 100644
index 000000000000..681b54fb78f3
--- /dev/null
+++ b/lld/test/wasm/Inputs/import-attributes.s
@@ -0,0 +1,8 @@
+  .globl  call_foo
+call_foo:
+  .functype call_foo () -> ()
+  call  foo
+  end_function
+
+  .functype foo () -> ()
+  .import_module  foo, baz

diff  --git a/lld/test/wasm/Inputs/optional-symbol.ll b/lld/test/wasm/Inputs/optional-symbol.ll
deleted file mode 100644
index d39a8a4db637..000000000000
--- a/lld/test/wasm/Inputs/optional-symbol.ll
+++ /dev/null
@@ -1,7 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
- at __dso_handle = external global i8*
-
-define i8** @get_optional() {
-  ret i8** @__dso_handle
-}

diff  --git a/lld/test/wasm/Inputs/optional-symbol.s b/lld/test/wasm/Inputs/optional-symbol.s
new file mode 100644
index 000000000000..511a0d82a796
--- /dev/null
+++ b/lld/test/wasm/Inputs/optional-symbol.s
@@ -0,0 +1,7 @@
+# __dso_handle is an linker-generated symbol that is included only when needed.
+
+  .globl  get_optional
+get_optional:
+  .functype get_optional () -> (i32)
+  i32.const __dso_handle
+  end_function

diff  --git a/lld/test/wasm/Inputs/ret32.ll b/lld/test/wasm/Inputs/ret32.ll
deleted file mode 100644
index 674b34b66499..000000000000
--- a/lld/test/wasm/Inputs/ret32.ll
+++ /dev/null
@@ -1,6 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
-define hidden i32 @ret32(float %arg) {
-entry:
-    ret i32 0
-}

diff  --git a/lld/test/wasm/Inputs/ret32.s b/lld/test/wasm/Inputs/ret32.s
new file mode 100644
index 000000000000..5233455917e6
--- /dev/null
+++ b/lld/test/wasm/Inputs/ret32.s
@@ -0,0 +1,6 @@
+  .hidden ret32
+  .globl  ret32
+ret32:
+  .functype ret32 (f32) -> (i32)
+  i32.const 0
+  end_function

diff  --git a/lld/test/wasm/Inputs/ret64.ll b/lld/test/wasm/Inputs/ret64.ll
deleted file mode 100644
index c1dd5e55fee0..000000000000
--- a/lld/test/wasm/Inputs/ret64.ll
+++ /dev/null
@@ -1,6 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
-define hidden i64 @ret64(double %arg) {
-entry:
-    ret i64 1
-}

diff  --git a/lld/test/wasm/Inputs/ret64.s b/lld/test/wasm/Inputs/ret64.s
new file mode 100644
index 000000000000..4ce85495a0fd
--- /dev/null
+++ b/lld/test/wasm/Inputs/ret64.s
@@ -0,0 +1,6 @@
+  .hidden ret64
+  .globl  ret64
+ret64:
+  .functype ret64 (f64) -> (i64)
+  i64.const 1
+  end_function

diff  --git a/lld/test/wasm/Inputs/start.ll b/lld/test/wasm/Inputs/start.ll
deleted file mode 100644
index e2629659bf50..000000000000
--- a/lld/test/wasm/Inputs/start.ll
+++ /dev/null
@@ -1,6 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
-define void @_start() local_unnamed_addr {
-entry:
-  ret void
-}

diff  --git a/lld/test/wasm/Inputs/start.s b/lld/test/wasm/Inputs/start.s
new file mode 100644
index 000000000000..c793185ca1bb
--- /dev/null
+++ b/lld/test/wasm/Inputs/start.s
@@ -0,0 +1,4 @@
+  .globl  _start
+_start:
+  .functype _start () -> ()
+  end_function

diff  --git a/lld/test/wasm/Inputs/strong-symbol.ll b/lld/test/wasm/Inputs/strong-symbol.ll
deleted file mode 100644
index cc2aa8ab5d26..000000000000
--- a/lld/test/wasm/Inputs/strong-symbol.ll
+++ /dev/null
@@ -1,6 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
-define i64 @weakFn() #0 {
-entry:
-  ret i64 1
-}

diff  --git a/lld/test/wasm/Inputs/strong-symbol.s b/lld/test/wasm/Inputs/strong-symbol.s
new file mode 100644
index 000000000000..92200759e16c
--- /dev/null
+++ b/lld/test/wasm/Inputs/strong-symbol.s
@@ -0,0 +1,6 @@
+  .globl  weakFn
+  .type weakFn, at function
+weakFn:
+  .functype weakFn () -> (i64)
+  i64.const 1
+  end_function

diff  --git a/lld/test/wasm/Inputs/weak-symbol1.ll b/lld/test/wasm/Inputs/weak-symbol1.ll
deleted file mode 100644
index 6e394ff91d0c..000000000000
--- a/lld/test/wasm/Inputs/weak-symbol1.ll
+++ /dev/null
@@ -1,13 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
-define weak i32 @weakFn() #0 {
-entry:
-  ret i32 1
-}
-
-define i32 @exportWeak1() {
-entry:
-    ret i32 ptrtoint (i32 ()* @weakFn to i32)
-}
-
- at weakGlobal = weak global i32 1

diff  --git a/lld/test/wasm/Inputs/weak-symbol1.s b/lld/test/wasm/Inputs/weak-symbol1.s
new file mode 100644
index 000000000000..eefdb248cc6b
--- /dev/null
+++ b/lld/test/wasm/Inputs/weak-symbol1.s
@@ -0,0 +1,17 @@
+  .weak weakFn
+weakFn:
+  .functype weakFn () -> (i32)
+  i32.const 1
+  end_function
+
+  .globl  exportWeak1
+exportWeak1:
+  .functype exportWeak1 () -> (i32)
+  i32.const weakFn
+  end_function
+
+  .section  .data.weakGlobal,"",@
+  .weak weakGlobal
+weakGlobal:
+  .int32  1
+  .size weakGlobal, 4

diff  --git a/lld/test/wasm/Inputs/weak-symbol2.ll b/lld/test/wasm/Inputs/weak-symbol2.ll
deleted file mode 100644
index e9c30c18f7de..000000000000
--- a/lld/test/wasm/Inputs/weak-symbol2.ll
+++ /dev/null
@@ -1,13 +0,0 @@
-target triple = "wasm32-unknown-unknown"
-
-define weak i32 @weakFn() #0 {
-entry:
-  ret i32 2
-}
-
-define i32 @exportWeak2() {
-entry:
-    ret i32 ptrtoint (i32 ()* @weakFn to i32)
-}
-
- at weakGlobal = weak global i32 2

diff  --git a/lld/test/wasm/Inputs/weak-symbol2.s b/lld/test/wasm/Inputs/weak-symbol2.s
new file mode 100644
index 000000000000..d044b87b96da
--- /dev/null
+++ b/lld/test/wasm/Inputs/weak-symbol2.s
@@ -0,0 +1,17 @@
+  .weak weakFn
+weakFn:
+  .functype weakFn () -> (i32)
+  i32.const 2
+  end_function
+
+  .globl  exportWeak2
+exportWeak2:
+  .functype exportWeak2 () -> (i32)
+  i32.const weakFn
+  end_function
+
+  .section  .data.weakGlobal,"",@
+  .weak weakGlobal
+weakGlobal:
+  .int32  2
+  .size weakGlobal, 4

diff  --git a/lld/test/wasm/alias.ll b/lld/test/wasm/alias.ll
deleted file mode 100644
index 9927ba4c2225..000000000000
--- a/lld/test/wasm/alias.ll
+++ /dev/null
@@ -1,65 +0,0 @@
-; RUN: llc -filetype=obj -o %t.o %s
-; RUN: wasm-ld --export=start_alias %t.o -o %t.wasm
-; RUN: obj2yaml %t.wasm | FileCheck %s
-
-target triple = "wasm32-unknown-unknown"
-
- at start_alias = alias void (), void ()* @_start
-
-; Function Attrs: nounwind uwtable
-define void @_start() local_unnamed_addr #1 {
-entry:
-  ret void
-}
-
-; CHECK:      --- !WASM
-; CHECK-NEXT: FileHeader:
-; CHECK-NEXT:   Version:         0x00000001
-; CHECK-NEXT: Sections:
-; CHECK-NEXT:   - Type:            TYPE
-; CHECK-NEXT:     Signatures:
-; CHECK-NEXT:       - Index:           0
-; CHECK-NEXT:         ParamTypes:
-; CHECK-NEXT:         ReturnTypes:     []
-; CHECK-NEXT:   - Type:            FUNCTION
-; CHECK-NEXT:     FunctionTypes:   [ 0 ]
-; CHECK-NEXT:   - Type:            TABLE
-; CHECK-NEXT:     Tables:
-; CHECK-NEXT:       - ElemType:        FUNCREF
-; CHECK-NEXT:         Limits:
-; CHECK-NEXT:           Flags:           [ HAS_MAX ]
-; CHECK-NEXT:           Initial:         0x00000001
-; CHECK-NEXT:           Maximum:         0x00000001
-; CHECK-NEXT:   - Type:            MEMORY
-; CHECK-NEXT:     Memories:
-; CHECK-NEXT:       - Initial:         0x00000002
-; CHECK-NEXT:   - Type:            GLOBAL
-; CHECK-NEXT:     Globals:
-; CHECK-NEXT:       - Index:           0
-; CHECK-NEXT:         Type:            I32
-; CHECK-NEXT:         Mutable:         true
-; CHECK-NEXT:         InitExpr:
-; CHECK-NEXT:           Opcode:          I32_CONST
-; CHECK-NEXT:           Value:           66560
-; CHECK-NEXT:   - Type:            EXPORT
-; CHECK-NEXT:     Exports:
-; CHECK-NEXT:       - Name:            memory
-; CHECK-NEXT:         Kind:            MEMORY
-; CHECK-NEXT:         Index:           0
-; CHECK-NEXT:       - Name:            _start
-; CHECK-NEXT:         Kind:            FUNCTION
-; CHECK-NEXT:         Index:           0
-; CHECK-NEXT:       - Name:            start_alias
-; CHECK-NEXT:         Kind:            FUNCTION
-; CHECK-NEXT:         Index:           0
-; CHECK-NEXT:   - Type:            CODE
-; CHECK-NEXT:     Functions:
-; CHECK-NEXT:       - Index:           0
-; CHECK-NEXT:         Locals:
-; CHECK-NEXT:         Body:            0B
-; CHECK-NEXT:   - Type:            CUSTOM
-; CHECK-NEXT:     Name:            name
-; CHECK-NEXT:     FunctionNames:
-; CHECK-NEXT:       - Index:           0
-; CHECK-NEXT:         Name:            _start
-; CHECK-NEXT: ...

diff  --git a/lld/test/wasm/alias.s b/lld/test/wasm/alias.s
new file mode 100644
index 000000000000..e95cef1bb6a9
--- /dev/null
+++ b/lld/test/wasm/alias.s
@@ -0,0 +1,64 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: wasm-ld --export=start_alias %t.o -o %t.wasm
+# RUN: obj2yaml %t.wasm | FileCheck %s
+
+  .globl  _start
+_start:
+  .functype _start () -> ()
+  end_function
+
+  .globl start_alias
+  .type start_alias, at function
+.set start_alias, _start
+
+# CHECK:      --- !WASM
+# CHECK-NEXT: FileHeader:
+# CHECK-NEXT:   Version:         0x00000001
+# CHECK-NEXT: Sections:
+# CHECK-NEXT:   - Type:            TYPE
+# CHECK-NEXT:     Signatures:
+# CHECK-NEXT:       - Index:           0
+# CHECK-NEXT:         ParamTypes:
+# CHECK-NEXT:         ReturnTypes:     []
+# CHECK-NEXT:   - Type:            FUNCTION
+# CHECK-NEXT:     FunctionTypes:   [ 0 ]
+# CHECK-NEXT:   - Type:            TABLE
+# CHECK-NEXT:     Tables:
+# CHECK-NEXT:       - ElemType:        FUNCREF
+# CHECK-NEXT:         Limits:
+# CHECK-NEXT:           Flags:           [ HAS_MAX ]
+# CHECK-NEXT:           Initial:         0x00000001
+# CHECK-NEXT:           Maximum:         0x00000001
+# CHECK-NEXT:   - Type:            MEMORY
+# CHECK-NEXT:     Memories:
+# CHECK-NEXT:       - Initial:         0x00000002
+# CHECK-NEXT:   - Type:            GLOBAL
+# CHECK-NEXT:     Globals:
+# CHECK-NEXT:       - Index:           0
+# CHECK-NEXT:         Type:            I32
+# CHECK-NEXT:         Mutable:         true
+# CHECK-NEXT:         InitExpr:
+# CHECK-NEXT:           Opcode:          I32_CONST
+# CHECK-NEXT:           Value:           66560
+# CHECK-NEXT:   - Type:            EXPORT
+# CHECK-NEXT:     Exports:
+# CHECK-NEXT:       - Name:            memory
+# CHECK-NEXT:         Kind:            MEMORY
+# CHECK-NEXT:         Index:           0
+# CHECK-NEXT:       - Name:            _start
+# CHECK-NEXT:         Kind:            FUNCTION
+# CHECK-NEXT:         Index:           0
+# CHECK-NEXT:       - Name:            start_alias
+# CHECK-NEXT:         Kind:            FUNCTION
+# CHECK-NEXT:         Index:           0
+# CHECK-NEXT:   - Type:            CODE
+# CHECK-NEXT:     Functions:
+# CHECK-NEXT:       - Index:           0
+# CHECK-NEXT:         Locals:
+# CHECK-NEXT:         Body:            0B
+# CHECK-NEXT:   - Type:            CUSTOM
+# CHECK-NEXT:     Name:            name
+# CHECK-NEXT:     FunctionNames:
+# CHECK-NEXT:       - Index:           0
+# CHECK-NEXT:         Name:            _start
+# CHECK-NEXT: ...

diff  --git a/lld/test/wasm/archive-export.ll b/lld/test/wasm/archive-export.ll
index 664f7761e61f..9a76d60d63d9 100644
--- a/lld/test/wasm/archive-export.ll
+++ b/lld/test/wasm/archive-export.ll
@@ -1,6 +1,6 @@
 Test that --export will also fetch lazy symbols from archives
 
-RUN: llc -filetype=obj %S/Inputs/start.ll -o %t.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.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: rm -f %t.a

diff  --git a/lld/test/wasm/archive-no-index.ll b/lld/test/wasm/archive-no-index.ll
deleted file mode 100644
index 237fd93dcd6c..000000000000
--- a/lld/test/wasm/archive-no-index.ll
+++ /dev/null
@@ -1,13 +0,0 @@
-; Tests error on archive file without a symbol table
-; RUN: llvm-as -o %t.o %s
-; RUN: llvm-as -o %t.archive.o %S/Inputs/archive1.ll
-; RUN: rm -f %t.a
-; RUN: llvm-ar crS %t.a %t.archive.o
-
-; RUN: not wasm-ld -o out.wasm %t.o %t.a 2>&1 | FileCheck %s
-
-define i32 @_start() {
-  ret i32 0
-}
-
-; CHECK: archive has no index; run ranlib to add one

diff  --git a/lld/test/wasm/archive-no-index.s b/lld/test/wasm/archive-no-index.s
new file mode 100644
index 000000000000..99ca5a367d3c
--- /dev/null
+++ b/lld/test/wasm/archive-no-index.s
@@ -0,0 +1,14 @@
+# Tests error on archive file without a symbol table
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: llvm-as -o %t.archive.o %S/Inputs/archive1.ll
+# RUN: rm -f %t.a
+# RUN: llvm-ar crS %t.a %t.archive.o
+
+# RUN: not wasm-ld -o out.wasm %t.o %t.a 2>&1 | FileCheck %s
+
+  .globl  _start
+_start:
+  .functype _start () -> ()
+  end_function
+
+# CHECK: archive has no index; run ranlib to add one

diff  --git a/lld/test/wasm/archive-weak-undefined.ll b/lld/test/wasm/archive-weak-undefined.ll
index 25afccabaf7f..530ff8aeb618 100644
--- a/lld/test/wasm/archive-weak-undefined.ll
+++ b/lld/test/wasm/archive-weak-undefined.ll
@@ -1,7 +1,7 @@
 ; Test that weak undefined symbols do not fetch members from archive files.
 ; RUN: llc -filetype=obj %s -o %t.o
-; RUN: llc -filetype=obj %S/Inputs/ret32.ll -o %t.ret32.o
-; RUN: llc -filetype=obj %S/Inputs/hello.ll -o %t.hello.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hello.s -o %t.hello.o
 ; RUN: rm -f %t.a
 ; RUN: llvm-ar rcs %t.a %t.ret32.o %t.hello.o
 

diff  --git a/lld/test/wasm/archive.ll b/lld/test/wasm/archive.ll
index 84054536a92d..df72ec7813e2 100644
--- a/lld/test/wasm/archive.ll
+++ b/lld/test/wasm/archive.ll
@@ -2,7 +2,7 @@
 ; 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/archive3.ll -o %t.a3.o
-; RUN: llc -filetype=obj %S/Inputs/hello.ll -o %t.hello.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hello.s -o %t.hello.o
 ; RUN: rm -f %t.a
 ; RUN: llvm-ar rcs %t.a %t.a1.o %t.a2.o %t.a3.o %t.hello.o
 ; RUN: rm -f %t.imports

diff  --git a/lld/test/wasm/bss-only.ll b/lld/test/wasm/bss-only.ll
deleted file mode 100644
index 23f94a1a3ebd..000000000000
--- a/lld/test/wasm/bss-only.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: llc -filetype=obj %s -o %t.o
-; RUN: wasm-ld -no-gc-sections --no-entry %t.o -o %t.wasm
-; RUN: obj2yaml %t.wasm | FileCheck %s
-
-; Test that the data section is skipped entirely when there are only
-; bss segments
-
-target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
-target triple = "wasm32-unknown-unknown"
-
- at a = global [1000 x i8] zeroinitializer, align 1
- at b = global i32 0
-
-; CHECK-NOT: - Type:            DATA

diff  --git a/lld/test/wasm/bss-only.s b/lld/test/wasm/bss-only.s
new file mode 100644
index 000000000000..56963530a0b0
--- /dev/null
+++ b/lld/test/wasm/bss-only.s
@@ -0,0 +1,43 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: wasm-ld -no-gc-sections --no-entry --export=__data_end %t.o -o %t.wasm
+# RUN: obj2yaml %t.wasm | FileCheck %s
+
+# Test that the data section is skipped entirely when there are only
+# bss segments
+
+  .section  .bss.a,"",@
+  .globl  a
+a:
+  .skip 1000
+  .size a, 1000
+
+  .section  .bss.b,"",@
+  .globl  b
+b:
+  .int32  0
+  .size b, 4
+
+# CHECK-NOT: - Type:            DATA
+
+#      CHECK:   - Type:            GLOBAL
+# CHECK-NEXT:     Globals:
+# CHECK-NEXT:       - Index:           0
+# CHECK-NEXT:         Type:            I32
+# CHECK-NEXT:         Mutable:         true
+# CHECK-NEXT:         InitExpr:
+# CHECK-NEXT:           Opcode:          I32_CONST
+# CHECK-NEXT:           Value:           67568
+# CHECK-NEXT:       - Index:           1
+# CHECK-NEXT:         Type:            I32
+# CHECK-NEXT:         Mutable:         false
+# CHECK-NEXT:         InitExpr:
+# CHECK-NEXT:           Opcode:          I32_CONST
+# CHECK-NEXT:           Value:           2028
+# CHECK-NEXT:   - Type:            EXPORT
+# CHECK-NEXT:     Exports:
+# CHECK-NEXT:       - Name:            memory
+# CHECK-NEXT:         Kind:            MEMORY
+# CHECK-NEXT:         Index:           0
+# CHECK-NEXT:       - Name:            __data_end
+# CHECK-NEXT:         Kind:            GLOBAL
+# CHECK-NEXT:         Index:           1

diff  --git a/lld/test/wasm/call-indirect.ll b/lld/test/wasm/call-indirect.ll
index 2eb134a97bbb..722385bdd350 100644
--- a/lld/test/wasm/call-indirect.ll
+++ b/lld/test/wasm/call-indirect.ll
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=obj %p/Inputs/call-indirect.ll -o %t2.o
 ; RUN: llc -filetype=obj %s -o %t.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/call-indirect.s -o %t2.o
 ; RUN: wasm-ld --export-dynamic -o %t.wasm %t2.o %t.o
 ; RUN: obj2yaml %t.wasm | FileCheck %s
 
@@ -121,9 +121,7 @@ define void @call_ptr(i64 (i64)* %arg) {
 ; CHECK-NEXT:         Body:            42010B
 ; CHECK-NEXT:       - Index:           1
 ; CHECK-NEXT:         Locals:
-; CHECK-NEXT:            - Type:            I32
-; CHECK-NEXT:              Count:           1
-; CHECK-NEXT:          Body:            4100280284888080002100410028028088808000118080808000001A2000118180808000001A0B
+; CHECK-NEXT:         Body:            28028088808000118080808000001A28028488808000118180808000001A0B
 ; CHECK-NEXT:       - Index:           2
 ; CHECK-NEXT:         Locals:
 ; CHECK-NEXT:         Body:            41020B

diff  --git a/lld/test/wasm/compress-relocs.ll b/lld/test/wasm/compress-relocs.ll
index d14ea26a4c33..6c3533a108a5 100644
--- a/lld/test/wasm/compress-relocs.ll
+++ b/lld/test/wasm/compress-relocs.ll
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=obj %p/Inputs/call-indirect.ll -o %t2.o
 ; RUN: llc -filetype=obj %s -o %t.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/call-indirect.s -o %t2.o
 ; RUN: wasm-ld --export-dynamic -o %t.wasm %t2.o %t.o
 ; RUN: obj2yaml %t.wasm | FileCheck %s
 ; RUN: wasm-ld --export-dynamic -O2 -o %t-opt.wasm %t2.o %t.o
@@ -22,5 +22,5 @@ entry:
 
 ; ERROR: wasm-ld: error: --compress-relocations is incompatible with output debug information. Please pass --strip-debug or --strip-all
 
-; CHECK:    Body:            4100280284888080002100410028028088808000118080808000001A2000118180808000001A0B
-; COMPRESS: Body:            41002802840821004100280280081100001A20001101001A0B
+; CHECK:    Body:            28028088808000118080808000001A28028488808000118180808000001A0B
+; COMPRESS: Body:            280280081100001A280284081101001A0B

diff  --git a/lld/test/wasm/conflict.test b/lld/test/wasm/conflict.test
index 9adc92ed1eda..290a0319af53 100644
--- a/lld/test/wasm/conflict.test
+++ b/lld/test/wasm/conflict.test
@@ -1,4 +1,4 @@
-# RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 # RUN: not wasm-ld -o %t.wasm %t.ret32.o %t.ret32.o 2>&1 | FileCheck %s
 
 # CHECK:      duplicate symbol: ret32

diff  --git a/lld/test/wasm/data-layout.ll b/lld/test/wasm/data-layout.ll
index 02ff0ecd8b97..759c5440fe99 100644
--- a/lld/test/wasm/data-layout.ll
+++ b/lld/test/wasm/data-layout.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %p/Inputs/hello.ll -o %t.hello.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hello.s -o %t.hello.o
 ; RUN: llc -filetype=obj %s -o %t.o
 
 target triple = "wasm32-unknown-unknown"

diff  --git a/lld/test/wasm/demangle.ll b/lld/test/wasm/demangle.ll
deleted file mode 100644
index 64fa46ae4dce..000000000000
--- a/lld/test/wasm/demangle.ll
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: llc -filetype=obj %s -o %t.o
-; RUN: not wasm-ld -o %t.wasm %t.o 2>&1 | FileCheck %s
-
-; CHECK: error: {{.*}}.o: undefined symbol: foo(int)
-
-; RUN: not wasm-ld --no-demangle \
-; RUN:     -o %t.wasm %t.o 2>&1 | FileCheck -check-prefix=CHECK-NODEMANGLE %s
-
-; CHECK-NODEMANGLE: error: {{.*}}.o: undefined symbol: _Z3fooi
-
-target triple = "wasm32-unknown-unknown"
-
-declare void @_Z3fooi(i32);
-
-define hidden void @_start() local_unnamed_addr {
-entry:
-    call void @_Z3fooi(i32 1)
-    ret void
-}

diff  --git a/lld/test/wasm/demangle.s b/lld/test/wasm/demangle.s
new file mode 100644
index 000000000000..7e1af46d64b8
--- /dev/null
+++ b/lld/test/wasm/demangle.s
@@ -0,0 +1,18 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: not wasm-ld -o %t.wasm %t.o 2>&1 | FileCheck %s
+
+# CHECK: error: {{.*}}.o: undefined symbol: foo(int)
+
+# RUN: not wasm-ld --no-demangle \
+# RUN:     -o %t.wasm %t.o 2>&1 | FileCheck -check-prefix=CHECK-NODEMANGLE %s
+
+# CHECK-NODEMANGLE: error: {{.*}}.o: undefined symbol: _Z3fooi
+
+  .globl  _start
+_start:
+  .functype _start () -> ()
+  i32.const 1
+  call  _Z3fooi
+  end_function
+
+.functype _Z3fooi (i32) -> ()

diff  --git a/lld/test/wasm/emit-relocs-fpic.s b/lld/test/wasm/emit-relocs-fpic.s
index e1adede20a5f..c70e1e675109 100644
--- a/lld/test/wasm/emit-relocs-fpic.s
+++ b/lld/test/wasm/emit-relocs-fpic.s
@@ -1,5 +1,5 @@
 # RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -o %t.o < %s
-# RUN: llc --relocation-model=pic -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 # RUN: wasm-ld -pie --export-all --no-gc-sections --no-entry --emit-relocs -o %t.wasm %t.o %t.ret32.o
 # RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/emit-relocs.ll b/lld/test/wasm/emit-relocs.ll
index cdf492ab8fbd..0317f9b0eb37 100644
--- a/lld/test/wasm/emit-relocs.ll
+++ b/lld/test/wasm/emit-relocs.ll
@@ -1,5 +1,5 @@
 ; RUN: llc -filetype=obj %s -o %t.o
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 ; RUN: wasm-ld --emit-relocs -o %t.wasm %t.o %t.ret32.o
 ; RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/entry-signature.ll b/lld/test/wasm/entry-signature.ll
deleted file mode 100644
index f7f3d481acfc..000000000000
--- a/lld/test/wasm/entry-signature.ll
+++ /dev/null
@@ -1,10 +0,0 @@
-; Verify that the entry point signature can be flexible.
-; RUN: llc -filetype=obj %s -o %t.o
-; RUN: wasm-ld -o %t1.wasm %t.o
-
-target triple = "wasm32-unknown-unknown-wasm"
-
-define hidden i32 @_start(i32, i64) local_unnamed_addr #0 {
-entry:
-  ret i32 0
-}

diff  --git a/lld/test/wasm/entry-signature.s b/lld/test/wasm/entry-signature.s
new file mode 100644
index 000000000000..b6f355c13193
--- /dev/null
+++ b/lld/test/wasm/entry-signature.s
@@ -0,0 +1,8 @@
+# Verify that the entry point signature can be flexible.
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: wasm-ld -o %t1.wasm %t.o
+
+  .globl  _start
+_start:
+  .functype _start (i64) -> (f32)
+  end_function

diff  --git a/lld/test/wasm/export-empty.test b/lld/test/wasm/export-empty.test
index 1c0f7bbc779d..03fc3d209c31 100644
--- a/lld/test/wasm/export-empty.test
+++ b/lld/test/wasm/export-empty.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.o
 RUN: not wasm-ld --export "" %t.o -o %t.wasm 2>&1 | FileCheck --match-full-lines %s
 
 CHECK: wasm-ld: error: symbol exported via --export not found: 

diff  --git a/lld/test/wasm/export-optional-lazy.ll b/lld/test/wasm/export-optional-lazy.ll
deleted file mode 100644
index c37a3e5183eb..000000000000
--- a/lld/test/wasm/export-optional-lazy.ll
+++ /dev/null
@@ -1,25 +0,0 @@
-; Optional linker-synthetic symbols are only created if they are undefined
-; in the final output.
-; This test is for a regression where an explicit --export of an lazy archive
-; symbol caused an undefined reference to an optional symbol to occur *after*
-; the optional symbols were created.
-
-; RUN: llc -filetype=obj %s -o %t.o
-; RUN: llc -filetype=obj %S/Inputs/optional-symbol.ll -o %t.a1.o
-; RUN: rm -f %t.a
-; RUN: llvm-ar rcs %t.a %t.a1.o
-; RUN: wasm-ld --export=get_optional %t.o %t.a -o %t.wasm
-; RUN: obj2yaml %t.wasm | FileCheck %s
-
-target triple = "wasm32-unknown-unknown"
-
-define void @_start() {
-entry:
-  ret void
-}
-
-; CHECK:      FunctionNames:
-; CHECK-NEXT:   - Index:           0
-; CHECK-NEXT:     Name:            _start
-; CHECK-NEXT:   - Index:           1
-; CHECK-NEXT:     Name:            get_optional

diff  --git a/lld/test/wasm/export-optional-lazy.test b/lld/test/wasm/export-optional-lazy.test
new file mode 100644
index 000000000000..6304d6bb2cd5
--- /dev/null
+++ b/lld/test/wasm/export-optional-lazy.test
@@ -0,0 +1,18 @@
+Optional linker-synthetic symbols are only created if they are undefined
+in the final output.
+This test is for a regression where an explicit --export of an lazy archive
+symbol caused an undefined reference to an optional symbol to occur *after*
+the optional symbols were created.
+
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/optional-symbol.s -o %t.a1.o
+RUN: rm -f %t.a
+RUN: llvm-ar rcs %t.a %t.a1.o
+RUN: wasm-ld --export=get_optional %t.o %t.a -o %t.wasm
+RUN: obj2yaml %t.wasm | FileCheck %s
+
+CHECK:      FunctionNames:
+CHECK-NEXT:   - Index:           0
+CHECK-NEXT:     Name:            _start
+CHECK-NEXT:   - Index:           1
+CHECK-NEXT:     Name:            get_optional

diff  --git a/lld/test/wasm/export-table.test b/lld/test/wasm/export-table.test
index e2d05f00d5a7..b218392652d6 100644
--- a/lld/test/wasm/export-table.test
+++ b/lld/test/wasm/export-table.test
@@ -1,4 +1,4 @@
-# RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o
 # RUN: wasm-ld --export-table -o %t.wasm %t.start.o
 # RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/fatal-warnings.ll b/lld/test/wasm/fatal-warnings.ll
index d338420ef09c..01a0137a2f45 100644
--- a/lld/test/wasm/fatal-warnings.ll
+++ b/lld/test/wasm/fatal-warnings.ll
@@ -1,5 +1,5 @@
 ; RUN: llc -filetype=obj %s -o %t.main.o
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 ; RUN: wasm-ld -o %t.wasm %t.main.o %t.ret32.o 2>&1 | FileCheck %s -check-prefix=CHECK-WARN
 ; RUN: not wasm-ld --fatal-warnings -o %t.wasm %t.main.o %t.ret32.o 2>&1 | FileCheck %s -check-prefix=CHECK-FATAL
 

diff  --git a/lld/test/wasm/function-imports-first.ll b/lld/test/wasm/function-imports-first.ll
index 73c113438f01..b2751e047bd4 100644
--- a/lld/test/wasm/function-imports-first.ll
+++ b/lld/test/wasm/function-imports-first.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 ; RUN: llc -filetype=obj %s -o %t.o
 ; RUN: wasm-ld -o %t.wasm %t.o %t.ret32.o
 ; RUN: obj2yaml %t.wasm | FileCheck %s

diff  --git a/lld/test/wasm/function-imports.ll b/lld/test/wasm/function-imports.ll
index 4fb1c64c72bf..5f2d6f9ee611 100644
--- a/lld/test/wasm/function-imports.ll
+++ b/lld/test/wasm/function-imports.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 ; RUN: llc -filetype=obj %s -o %t.o
 ; RUN: wasm-ld -o %t.wasm %t.ret32.o %t.o
 ; RUN: obj2yaml %t.wasm | FileCheck %s

diff  --git a/lld/test/wasm/function-index.test b/lld/test/wasm/function-index.test
index fbcde6cd8168..0b32551c5af6 100644
--- a/lld/test/wasm/function-index.test
+++ b/lld/test/wasm/function-index.test
@@ -1,5 +1,5 @@
-# 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: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret64.s -o %t.ret64.o
 # RUN: wasm-ld -r -o %t.wasm %t.ret32.o %t.ret64.o
 # RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/global-base.test b/lld/test/wasm/global-base.test
index 723b0d79af11..56efadd9d588 100644
--- a/lld/test/wasm/global-base.test
+++ b/lld/test/wasm/global-base.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.o
 
 RUN: wasm-ld --export=__global_base --export=__data_end --allow-undefined -o %t.wasm %t.o
 RUN: obj2yaml %t.wasm | FileCheck %s  -check-prefix=CHECK-1024

diff  --git a/lld/test/wasm/growable-table.test b/lld/test/wasm/growable-table.test
index cd52f2e1662f..00cff3fc416e 100644
--- a/lld/test/wasm/growable-table.test
+++ b/lld/test/wasm/growable-table.test
@@ -1,4 +1,4 @@
-# RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o
 # RUN: wasm-ld --export-table --growable-table -o %t.wasm %t.start.o
 # RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/import-attribute-mismatch.ll b/lld/test/wasm/import-attribute-mismatch.ll
deleted file mode 100644
index d3ba294a212b..000000000000
--- a/lld/test/wasm/import-attribute-mismatch.ll
+++ /dev/null
@@ -1,18 +0,0 @@
-; RUN: llc -filetype=obj %s -o %t1.o
-; RUN: llc -filetype=obj %S/Inputs/import-attributes.ll -o %t2.o
-; RUN: not wasm-ld --export call_foo --allow-undefined -o %t.wasm %t1.o %t2.o 2>&1 | FileCheck %s
-
-target triple = "wasm32-unknown-unknown-wasm"
-
-define void @_start() {
-  call void @foo();
-  ret void
-}
-
-declare void @foo() #0
-
-attributes #0 = { "wasm-import-module"="bar" }
-
-; CHECK: wasm-ld: error: import module mismatch for symbol: foo
-; CHECK: >>> defined as bar in {{.*}}1.o
-; CHECK: >>> defined as baz in {{.*}}2.o

diff  --git a/lld/test/wasm/import-attribute-mismatch.s b/lld/test/wasm/import-attribute-mismatch.s
new file mode 100644
index 000000000000..67aa1e39ef36
--- /dev/null
+++ b/lld/test/wasm/import-attribute-mismatch.s
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t1.o %s
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %S/Inputs/import-attributes.s -o %t2.o
+# RUN: not wasm-ld --export call_foo --allow-undefined -o %t.wasm %t1.o %t2.o 2>&1 | FileCheck %s
+
+  .globl  _start
+_start:
+  .functype _start () -> ()
+  call  foo
+  end_function
+
+.functype foo () -> ()
+.import_module  foo, bar
+
+# CHECK: wasm-ld: error: import module mismatch for symbol: foo
+# CHECK: >>> defined as bar in {{.*}}1.o
+# CHECK: >>> defined as baz in {{.*}}2.o

diff  --git a/lld/test/wasm/import-memory.test b/lld/test/wasm/import-memory.test
index d7a257199dbb..bc9e64fe578e 100644
--- a/lld/test/wasm/import-memory.test
+++ b/lld/test/wasm/import-memory.test
@@ -1,4 +1,4 @@
-# RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o
 # RUN: wasm-ld --import-memory -o %t.wasm %t.start.o
 # RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/import-table.test b/lld/test/wasm/import-table.test
index 440509b3483c..4d1b4c9a7832 100644
--- a/lld/test/wasm/import-table.test
+++ b/lld/test/wasm/import-table.test
@@ -1,4 +1,4 @@
-# RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o
 # RUN: wasm-ld --import-table -o %t.wasm %t.start.o
 # RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/invalid-stack-size.test b/lld/test/wasm/invalid-stack-size.test
index 90c9fda113e6..645e1a49f8d6 100644
--- a/lld/test/wasm/invalid-stack-size.test
+++ b/lld/test/wasm/invalid-stack-size.test
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.o
 ; RUN: not wasm-ld -o %t.wasm -z stack-size=1 %t.o 2>&1 | FileCheck %s
 
 ; CHECK: error: stack size must be 16-byte aligned

diff  --git a/lld/test/wasm/large-memory.test b/lld/test/wasm/large-memory.test
index 0713a8b02dd1..40270c519518 100644
--- a/lld/test/wasm/large-memory.test
+++ b/lld/test/wasm/large-memory.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.o
 
 ; Verify we can parse large integers such as when we ask for 2G of total
 ; memory.

diff  --git a/lld/test/wasm/load-undefined.test b/lld/test/wasm/load-undefined.test
index 1b8d259d5b8d..3171d4a4a4aa 100644
--- a/lld/test/wasm/load-undefined.test
+++ b/lld/test/wasm/load-undefined.test
@@ -1,9 +1,9 @@
 ; 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 %S/Inputs/ret64.ll -o %t.o
-; RUN: llc -filetype=obj %S/Inputs/ret32.ll -o %t2.o
-; RUN: llc -filetype=obj %S/Inputs/start.ll -o %t.start.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret64.s -o %t.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t2.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o
 ; RUN: rm -f %t2.a
 ; RUN: llvm-ar rcs %t2.a %t2.o
 ; RUN: wasm-ld %t.start.o --no-gc-sections %t2.a %t.o -o %t.wasm -u ret32 --undefined ret64

diff  --git a/lld/test/wasm/no-tls.ll b/lld/test/wasm/no-tls.ll
new file mode 100644
index 000000000000..54bb9cee0169
--- /dev/null
+++ b/lld/test/wasm/no-tls.ll
@@ -0,0 +1,48 @@
+; Testing that __tls_size and __tls_align are correctly emitted when there are
+; no thread_local variables.
+
+; RUN: llc -mattr=+bulk-memory,+atomics -filetype=obj %s -o %t.o
+
+target triple = "wasm32-unknown-unknown"
+
+define void @_start() local_unnamed_addr {
+entry:
+  ret void
+}
+
+; RUN: wasm-ld -no-gc-sections --shared-memory --max-memory=131072 --allow-undefined -o %t.wasm %t.o
+; RUN: obj2yaml %t.wasm | FileCheck %s
+; CHECK:       - Type:            GLOBAL
+; CHECK-NEXT:    Globals:
+
+; __stack_pointer
+; CHECK-NEXT:      - Index:           0
+; CHECK-NEXT:        Type:            I32
+; CHECK-NEXT:        Mutable:         true
+; CHECK-NEXT:        InitExpr:
+; CHECK-NEXT:          Opcode:          I32_CONST
+; CHECK-NEXT:          Value:           66576
+
+; __tls_base
+; CHECK-NEXT:      - Index:           1
+; CHECK-NEXT:        Type:            I32
+; CHECK-NEXT:        Mutable:         true
+; CHECK-NEXT:        InitExpr:
+; CHECK-NEXT:          Opcode:          I32_CONST
+; CHECK-NEXT:          Value:           0
+
+; __tls_size
+; CHECK-NEXT:      - Index:           2
+; CHECK-NEXT:        Type:            I32
+; CHECK-NEXT:        Mutable:         false
+; CHECK-NEXT:        InitExpr:
+; CHECK-NEXT:          Opcode:          I32_CONST
+; CHECK-NEXT:          Value:           0
+
+; __tls_align
+; CHECK-NEXT:      - Index:           3
+; CHECK-NEXT:        Type:            I32
+; CHECK-NEXT:        Mutable:         false
+; CHECK-NEXT:        InitExpr:
+; CHECK-NEXT:          Opcode:          I32_CONST
+; CHECK-NEXT:          Value:           1

diff  --git a/lld/test/wasm/no-tls.test b/lld/test/wasm/no-tls.test
deleted file mode 100644
index 225d78a96856..000000000000
--- a/lld/test/wasm/no-tls.test
+++ /dev/null
@@ -1,41 +0,0 @@
-; Testing that __tls_size and __tls_align are correctly emitted when there are
-; no thread_local variables.
-
-RUN: llc -mattr=+bulk-memory,+atomics -filetype=obj %p/Inputs/start.ll -o %t.o
-
-RUN: wasm-ld -no-gc-sections --shared-memory --max-memory=131072 --allow-undefined -o %t.wasm %t.o
-RUN: obj2yaml %t.wasm | FileCheck %s
-CHECK:       - Type:            GLOBAL
-CHECK-NEXT:    Globals:
-
-; __stack_pointer
-CHECK-NEXT:      - Index:           0
-CHECK-NEXT:        Type:            I32
-CHECK-NEXT:        Mutable:         true
-CHECK-NEXT:        InitExpr:
-CHECK-NEXT:          Opcode:          I32_CONST
-CHECK-NEXT:          Value:           66576
-
-; __tls_base
-CHECK-NEXT:      - Index:           1
-CHECK-NEXT:        Type:            I32
-CHECK-NEXT:        Mutable:         true
-CHECK-NEXT:        InitExpr:
-CHECK-NEXT:          Opcode:          I32_CONST
-CHECK-NEXT:          Value:           0
-
-; __tls_size
-CHECK-NEXT:      - Index:           2
-CHECK-NEXT:        Type:            I32
-CHECK-NEXT:        Mutable:         false
-CHECK-NEXT:        InitExpr:
-CHECK-NEXT:          Opcode:          I32_CONST
-CHECK-NEXT:          Value:           0
-
-; __tls_align
-CHECK-NEXT:      - Index:           3
-CHECK-NEXT:        Type:            I32
-CHECK-NEXT:        Mutable:         false
-CHECK-NEXT:        InitExpr:
-CHECK-NEXT:          Opcode:          I32_CONST
-CHECK-NEXT:          Value:           1

diff  --git a/lld/test/wasm/optional-symbol.ll b/lld/test/wasm/optional-symbol.ll
deleted file mode 100644
index ac1a4212fbf0..000000000000
--- a/lld/test/wasm/optional-symbol.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: llc -filetype=obj -o %t.o %s
-; RUN: wasm-ld --export=get_handle %t.o -o %t.wasm
-
-target triple = "wasm32-unknown-unknown"
-
- at __dso_handle = external global i8*
-
-define i8** @get_handle() {
-  ret i8** @__dso_handle
-}
-
-define void @_start() {
-  ret void
-}

diff  --git a/lld/test/wasm/optional-symbol.s b/lld/test/wasm/optional-symbol.s
new file mode 100644
index 000000000000..bac98838e6ae
--- /dev/null
+++ b/lld/test/wasm/optional-symbol.s
@@ -0,0 +1,13 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: wasm-ld --export=get_handle %t.o -o %t.wasm
+
+  .globl  get_handle
+get_handle:
+  .functype get_handle () -> (i32)
+  i32.const __dso_handle
+  end_function
+
+  .globl  _start
+_start:
+  .functype _start () -> ()
+  end_function

diff  --git a/lld/test/wasm/pic-static.ll b/lld/test/wasm/pic-static.ll
index 65b47175865e..d9fe0eacc98b 100644
--- a/lld/test/wasm/pic-static.ll
+++ b/lld/test/wasm/pic-static.ll
@@ -1,7 +1,7 @@
 ; Test that PIC code can be linked into static binaries.
 ; In this case the GOT entries will end up as internalized wasm globals with
 ; fixed values.
-; RUN: llc -relocation-model=pic -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 ; RUN: llc -relocation-model=pic -filetype=obj %s -o %t.o
 ; RUN: wasm-ld --allow-undefined --export-all -o %t.wasm %t.o %t.ret32.o
 ; RUN: obj2yaml %t.wasm | FileCheck %s

diff  --git a/lld/test/wasm/relocatable.ll b/lld/test/wasm/relocatable.ll
index a43a06e4be58..1bf039108614 100644
--- a/lld/test/wasm/relocatable.ll
+++ b/lld/test/wasm/relocatable.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %p/Inputs/hello.ll -o %t.hello.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hello.s -o %t.hello.o
 ; RUN: llc -filetype=obj %s -o %t.o
 ; RUN: wasm-ld -r -o %t.wasm %t.hello.o %t.o
 ; RUN: obj2yaml %t.wasm | FileCheck %s

diff  --git a/lld/test/wasm/responsefile.test b/lld/test/wasm/responsefile.test
index 85ac41f93f2b..36209d48edda 100644
--- a/lld/test/wasm/responsefile.test
+++ b/lld/test/wasm/responsefile.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj -o %t.o %p/Inputs/ret32.ll
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.o
 
 RUN: echo "%/t.o -o %/t.wasm -e ret32" > %t.rsp
 RUN: wasm-ld @%t.rsp --initial-memory=655360

diff  --git a/lld/test/wasm/shared-needed.ll b/lld/test/wasm/shared-needed.ll
index f0afb1098501..00ecdb68202e 100644
--- a/lld/test/wasm/shared-needed.ll
+++ b/lld/test/wasm/shared-needed.ll
@@ -1,5 +1,5 @@
 ; RUN: llc -filetype=obj %s -o %t.o
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 
 ; RUN: wasm-ld -shared -o %t1.so %t.o
 ; RUN: obj2yaml %t1.so | FileCheck %s -check-prefix=SO1

diff  --git a/lld/test/wasm/signature-mismatch-export.ll b/lld/test/wasm/signature-mismatch-export.ll
index 55ca66ba81bd..80c05c33913f 100644
--- a/lld/test/wasm/signature-mismatch-export.ll
+++ b/lld/test/wasm/signature-mismatch-export.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 ; RUN: llc -filetype=obj %s -o %t.main.o
 ; RUN: wasm-ld --export=ret32 -o %t.wasm %t.main.o %t.ret32.o
 ; RUN: obj2yaml %t.wasm | FileCheck %s

diff  --git a/lld/test/wasm/signature-mismatch-unknown.ll b/lld/test/wasm/signature-mismatch-unknown.ll
index 9bbad0065dcd..c78bff556eee 100644
--- a/lld/test/wasm/signature-mismatch-unknown.ll
+++ b/lld/test/wasm/signature-mismatch-unknown.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 ; RUN: llc -filetype=obj %s -o %t.main.o
 ; RUN: wasm-ld --fatal-warnings -o %t.wasm %t.ret32.o %t.main.o
 ; RUN: wasm-ld --fatal-warnings -o %t.wasm %t.main.o %t.ret32.o
@@ -7,7 +7,7 @@
 ; references ret32:
 ; %t.main.o: Does not call ret32 directly; used the wrong signature.
 ; %t.call-ret32.o: Calls ret32 directly; uses the correct signature.
-; RUN: llc -filetype=obj %p/Inputs/call-ret32.ll -o %t.call-ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/call-ret32.s -o %t.call-ret32.o
 ; RUN: wasm-ld --export=call_ret32 --fatal-warnings -o %t.wasm %t.main.o %t.call-ret32.o %t.ret32.o
 ; RUN: wasm-ld --export=call_ret32 --fatal-warnings -o %t.wasm %t.call-ret32.o %t.main.o %t.ret32.o
 

diff  --git a/lld/test/wasm/signature-mismatch-weak.ll b/lld/test/wasm/signature-mismatch-weak.ll
index 4d2b02cc9ed3..bf94d5361b38 100644
--- a/lld/test/wasm/signature-mismatch-weak.ll
+++ b/lld/test/wasm/signature-mismatch-weak.ll
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=obj %p/Inputs/weak-symbol1.ll -o %t.weak.o
-; RUN: llc -filetype=obj %p/Inputs/strong-symbol.ll -o %t.strong.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/weak-symbol1.s -o %t.weak.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/strong-symbol.s -o %t.strong.o
 ; RUN: llc -filetype=obj %s -o %t.o
 ; RUN: wasm-ld -o %t.wasm %t.o %t.strong.o %t.weak.o 2>&1 | FileCheck %s
 

diff  --git a/lld/test/wasm/signature-mismatch.ll b/lld/test/wasm/signature-mismatch.ll
index bb9204ea7e45..b797b013820b 100644
--- a/lld/test/wasm/signature-mismatch.ll
+++ b/lld/test/wasm/signature-mismatch.ll
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
-; RUN: llc -filetype=obj %p/Inputs/call-ret32.ll -o %t.call.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/call-ret32.s -o %t.call.o
 ; RUN: llc -filetype=obj %s -o %t.main.o
 
 ; RUN: wasm-ld --export=call_ret32 --export=ret32 -o %t.wasm %t.main.o %t.ret32.o %t.call.o 2>&1 | FileCheck %s -check-prefix=WARN
@@ -76,7 +76,7 @@ declare i32 @ret32(i32, i64, i32) local_unnamed_addr
 ; RELOC-NEXT:       - Index:           3
 ; RELOC-NEXT:         Kind:            FUNCTION
 ; RELOC-NEXT:         Name:            call_ret32
-; RELOC-NEXT:         Flags:           [ VISIBILITY_HIDDEN ]
+; RELOC-NEXT:         Flags:           [ ]
 ; RELOC-NEXT:         Function:        3
 ; RELOC-NEXT:       - Index:           4
 ; RELOC-NEXT:         Kind:            DATA

diff  --git a/lld/test/wasm/stack-first.test b/lld/test/wasm/stack-first.test
index 805acfb6fa6f..9d7f077d58cf 100644
--- a/lld/test/wasm/stack-first.test
+++ b/lld/test/wasm/stack-first.test
@@ -3,7 +3,7 @@
 ; stack size of 512.  This means (since the stack grows down) the stack pointer
 ; global should be initialized to 512.
 
-RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.o
 RUN: wasm-ld -z stack-size=512 --stack-first --export=__data_end --export=__heap_base -o %t.wasm %t.o
 RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/strip-all.test b/lld/test/wasm/strip-all.test
index 7b7c25963bc7..ae3314f30676 100644
--- a/lld/test/wasm/strip-all.test
+++ b/lld/test/wasm/strip-all.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o
 RUN: wasm-ld --strip-all -o %t.wasm %t.start.o
 RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/strip-debug.test b/lld/test/wasm/strip-debug.test
index 6ee27f8c8a77..12a9dc7816f5 100644
--- a/lld/test/wasm/strip-debug.test
+++ b/lld/test/wasm/strip-debug.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.start.o
 RUN: wasm-ld --strip-debug -o %t.wasm %t.start.o
 RUN: obj2yaml %t.wasm | FileCheck %s
 

diff  --git a/lld/test/wasm/symbol-type-mismatch.ll b/lld/test/wasm/symbol-type-mismatch.ll
deleted file mode 100644
index 4738c4bd00b9..000000000000
--- a/lld/test/wasm/symbol-type-mismatch.ll
+++ /dev/null
@@ -1,11 +0,0 @@
-; RUN: llc -filetype=obj %s -o %t.o
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
-; RUN: not wasm-ld -o %t.wasm %t.o %t.ret32.o 2>&1 | FileCheck %s
-
-target triple = "wasm32-unknown-unknown"
-
- at ret32 = extern_weak global i32, align 4
-
-; CHECK: error: symbol type mismatch: ret32
-; CHECK: >>> defined as WASM_SYMBOL_TYPE_DATA in {{.*}}symbol-type-mismatch.ll.tmp.o
-; CHECK: >>> defined as WASM_SYMBOL_TYPE_FUNCTION in {{.*}}.ret32.o

diff  --git a/lld/test/wasm/symbol-type-mismatch.s b/lld/test/wasm/symbol-type-mismatch.s
new file mode 100644
index 000000000000..d68abc3d349f
--- /dev/null
+++ b/lld/test/wasm/symbol-type-mismatch.s
@@ -0,0 +1,9 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
+# RUN: not wasm-ld -o %t.wasm %t.o %t.ret32.o 2>&1 | FileCheck %s
+
+.weak ret32
+
+# CHECK: error: symbol type mismatch: ret32
+# CHECK: >>> defined as WASM_SYMBOL_TYPE_DATA in {{.*}}symbol-type-mismatch.s.tmp.o
+# CHECK: >>> defined as WASM_SYMBOL_TYPE_FUNCTION in {{.*}}.ret32.o

diff  --git a/lld/test/wasm/trace-symbol.ll b/lld/test/wasm/trace-symbol.ll
index e589de0f6d43..25154004d6b0 100644
--- a/lld/test/wasm/trace-symbol.ll
+++ b/lld/test/wasm/trace-symbol.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 ; RUN: llc -filetype=obj -o %t.start.o %s
 ; RUN: wasm-ld -o %t.wasm %t.start.o %t.ret32.o -y ret32 -y _start | FileCheck %s -check-prefix=BOTH
 ; RUN: wasm-ld -o %t.wasm %t.ret32.o %t.start.o -y ret32 -y _start | FileCheck %s -check-prefix=REVERSED

diff  --git a/lld/test/wasm/trace.test b/lld/test/wasm/trace.test
index 023a2ccb2cc0..ae6f6335c4e0 100644
--- a/lld/test/wasm/trace.test
+++ b/lld/test/wasm/trace.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.foo.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.foo.o
 
 # Check -t
 RUN: wasm-ld %t.foo.o -o %t.t.out.wasm -t 2>&1 | FileCheck %s

diff  --git a/lld/test/wasm/undefined-entry.test b/lld/test/wasm/undefined-entry.test
index 3106a76510f4..a5bca16a0de0 100644
--- a/lld/test/wasm/undefined-entry.test
+++ b/lld/test/wasm/undefined-entry.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 RUN: not wasm-ld -o %t.wasm %t.ret32.o 2>&1 | FileCheck %s
 RUN: not wasm-ld --allow-undefined -o %t.wasm %t.ret32.o 2>&1 | FileCheck %s
 RUN: not wasm-ld -entry=foo -o %t.wasm %t.ret32.o 2>&1 | FileCheck %s -check-prefix=CHECK-CUSTOM

diff  --git a/lld/test/wasm/version.ll b/lld/test/wasm/version.ll
deleted file mode 100644
index 84932b029c9e..000000000000
--- a/lld/test/wasm/version.ll
+++ /dev/null
@@ -1,15 +0,0 @@
-; RUN: llc -filetype=obj %s -o %t.o
-; RUN: wasm-ld -o %t.wasm %t.o
-; RUN: llvm-readobj --file-headers %t.wasm | FileCheck %s
-
-target triple = "wasm32-unknown-unknown"
-
-define hidden void @_start() local_unnamed_addr #0 {
-entry:
-    ret void
-}
-
-; CHECK: Format: WASM
-; CHECK: Arch: wasm32
-; CHECK: AddressSize: 32bit
-; CHECK: Version: 0x1

diff  --git a/lld/test/wasm/version.s b/lld/test/wasm/version.s
new file mode 100644
index 000000000000..2ce86f109fef
--- /dev/null
+++ b/lld/test/wasm/version.s
@@ -0,0 +1,13 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: wasm-ld -o %t.wasm %t.o
+# RUN: llvm-readobj --file-headers %t.wasm | FileCheck %s
+
+  .globl  _start
+_start:
+  .functype _start () -> ()
+  end_function
+
+# CHECK: Format: WASM
+# CHECK: Arch: wasm32
+# CHECK: AddressSize: 32bit
+# CHECK: Version: 0x1

diff  --git a/lld/test/wasm/visibility-hidden.ll b/lld/test/wasm/visibility-hidden.ll
index 99acd5651f7b..36c29a8e4738 100644
--- a/lld/test/wasm/visibility-hidden.ll
+++ b/lld/test/wasm/visibility-hidden.ll
@@ -1,5 +1,5 @@
 ; RUN: llc -filetype=obj -o %t.o %s
-; RUN: llc -filetype=obj %S/Inputs/hidden.ll -o %t2.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hidden.s -o %t2.o
 ; RUN: rm -f %t2.a
 ; RUN: llvm-ar rcs %t2.a %t2.o
 

diff  --git a/lld/test/wasm/weak-symbols.ll b/lld/test/wasm/weak-symbols.ll
index 70357b23101d..43e9014ff322 100644
--- a/lld/test/wasm/weak-symbols.ll
+++ b/lld/test/wasm/weak-symbols.ll
@@ -1,5 +1,5 @@
-; 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: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/weak-symbol1.s -o %t1.o
+; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/weak-symbol2.s -o %t2.o
 ; RUN: llc -filetype=obj %s -o %t.o
 ; RUN: wasm-ld --export-dynamic -o %t.wasm %t.o %t1.o %t2.o
 ; RUN: obj2yaml %t.wasm | FileCheck %s

diff  --git a/lld/test/wasm/whole-archive.test b/lld/test/wasm/whole-archive.test
index 814acbf432e7..34b5932aeec8 100644
--- a/lld/test/wasm/whole-archive.test
+++ b/lld/test/wasm/whole-archive.test
@@ -1,5 +1,5 @@
-RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
-RUN: llc -filetype=obj %p/Inputs/ret32.ll -o %t.ret32.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/start.s -o %t.o
+RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ret32.s -o %t.ret32.o
 RUN: rm -f %t.a
 RUN: llvm-ar rcs %t.a %t.ret32.o
 


        


More information about the llvm-branch-commits mailing list