[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
This commit is contained in:
Sam Clegg 2020-05-20 21:35:18 -07:00
parent 8ae21fb8d2
commit fd1c894a4a
85 changed files with 461 additions and 427 deletions

View File

@ -1,20 +0,0 @@
target triple = "wasm32-unknown-unknown"
@indirect_bar = internal local_unnamed_addr global i64 ()* @bar, align 4
@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
}

View File

@ -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)

View File

@ -1,11 +0,0 @@
target triple = "wasm32-unknown-unknown"
@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)

View File

@ -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)

View File

@ -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"); }
@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

View File

@ -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) -> ()

View File

@ -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
}

View File

@ -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

View File

@ -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" }

View File

@ -0,0 +1,8 @@
.globl call_foo
call_foo:
.functype call_foo () -> ()
call foo
end_function
.functype foo () -> ()
.import_module foo, baz

View File

@ -1,7 +0,0 @@
target triple = "wasm32-unknown-unknown"
@__dso_handle = external global i8*
define i8** @get_optional() {
ret i8** @__dso_handle
}

View File

@ -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

View File

@ -1,6 +0,0 @@
target triple = "wasm32-unknown-unknown"
define hidden i32 @ret32(float %arg) {
entry:
ret i32 0
}

View File

@ -0,0 +1,6 @@
.hidden ret32
.globl ret32
ret32:
.functype ret32 (f32) -> (i32)
i32.const 0
end_function

View File

@ -1,6 +0,0 @@
target triple = "wasm32-unknown-unknown"
define hidden i64 @ret64(double %arg) {
entry:
ret i64 1
}

View File

@ -0,0 +1,6 @@
.hidden ret64
.globl ret64
ret64:
.functype ret64 (f64) -> (i64)
i64.const 1
end_function

View File

@ -1,6 +0,0 @@
target triple = "wasm32-unknown-unknown"
define void @_start() local_unnamed_addr {
entry:
ret void
}

View File

@ -0,0 +1,4 @@
.globl _start
_start:
.functype _start () -> ()
end_function

View File

@ -1,6 +0,0 @@
target triple = "wasm32-unknown-unknown"
define i64 @weakFn() #0 {
entry:
ret i64 1
}

View File

@ -0,0 +1,6 @@
.globl weakFn
.type weakFn,@function
weakFn:
.functype weakFn () -> (i64)
i64.const 1
end_function

View File

@ -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)
}
@weakGlobal = weak global i32 1

View File

@ -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

View File

@ -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)
}
@weakGlobal = weak global i32 2

View File

@ -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

View File

@ -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"
@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: ...

64
lld/test/wasm/alias.s Normal file
View File

@ -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,@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: ...

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"
@a = global [1000 x i8] zeroinitializer, align 1
@b = global i32 0
; CHECK-NOT: - Type: DATA

43
lld/test/wasm/bss-only.s Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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
}

18
lld/test/wasm/demangle.s Normal file
View File

@ -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) -> ()

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

48
lld/test/wasm/no-tls.ll Normal file
View File

@ -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

View File

@ -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

View File

@ -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"
@__dso_handle = external global i8*
define i8** @get_handle() {
ret i8** @__dso_handle
}
define void @_start() {
ret void
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"
@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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

13
lld/test/wasm/version.s Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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