aboutsummaryrefslogtreecommitdiff
path: root/test/wasm/lto
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm/lto')
-rw-r--r--test/wasm/lto/archive.ll2
-rw-r--r--test/wasm/lto/cache.ll8
-rw-r--r--test/wasm/lto/export.ll6
-rw-r--r--test/wasm/lto/signature-mismatch.ll19
4 files changed, 30 insertions, 5 deletions
diff --git a/test/wasm/lto/archive.ll b/test/wasm/lto/archive.ll
index 89fa840cdec5..ab067d8cdce4 100644
--- a/test/wasm/lto/archive.ll
+++ b/test/wasm/lto/archive.ll
@@ -2,7 +2,7 @@
; RUN: rm -f %t.a
; RUN: llvm-ar rcs %t.a %t1.o
; RUN: llvm-as %s -o %t2.o
-; RUN: wasm-ld %t2.o %t.a -o %t3
+; RUN: wasm-ld --export-dynamic %t2.o %t.a -o %t3
; RUN: obj2yaml %t3 | FileCheck %s
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
diff --git a/test/wasm/lto/cache.ll b/test/wasm/lto/cache.ll
index b0a7820c1e19..6d52b973f0fa 100644
--- a/test/wasm/lto/cache.ll
+++ b/test/wasm/lto/cache.ll
@@ -1,5 +1,7 @@
; RUN: opt -module-hash -module-summary %s -o %t.o
; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o %t2.o
+; NetBSD: noatime mounts currently inhibit 'touch' from updating atime
+; UNSUPPORTED: system-netbsd
; RUN: rm -Rf %t.cache && mkdir %t.cache
; Create two files that would be removed by cache pruning due to age.
@@ -11,12 +13,16 @@
; RUN: ls %t.cache | count 4
; Create a file of size 64KB.
-; RUN: "%python" -c "print(' ' * 65536)" > %t.cache/llvmcache-foo
+; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo
; This should leave the file in place.
; RUN: wasm-ld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=128k:prune_interval=0s -o %t.wasm %t2.o %t.o
; RUN: ls %t.cache | count 5
+; Increase the age of llvmcache-foo, which will give it the oldest time stamp
+; so that it is processed and removed first.
+; RUN: %python -c 'import os,sys,time; t=time.time()-120; os.utime(sys.argv[1],(t,t))' %t.cache/llvmcache-foo
+
; This should remove it.
; RUN: wasm-ld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=32k:prune_interval=0s -o %t.wasm %t2.o %t.o
; RUN: ls %t.cache | count 4
diff --git a/test/wasm/lto/export.ll b/test/wasm/lto/export.ll
index 44ded6f147f6..0ff0be504eda 100644
--- a/test/wasm/lto/export.ll
+++ b/test/wasm/lto/export.ll
@@ -29,10 +29,10 @@ entry:
; CHECK-NEXT: - Name: __data_end
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 2
-; CHECK-NEXT: - Name: _start
-; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: hidden_function
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Index: 1
+; CHECK-NEXT: - Name: _start
+; CHECK-NEXT: Kind: FUNCTION
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Type: CODE
diff --git a/test/wasm/lto/signature-mismatch.ll b/test/wasm/lto/signature-mismatch.ll
new file mode 100644
index 000000000000..e48bb39cd8d9
--- /dev/null
+++ b/test/wasm/lto/signature-mismatch.ll
@@ -0,0 +1,19 @@
+; RUN: llc -filetype=obj -o %t.o %s
+; RUN: llvm-as %S/Inputs/archive.ll -o %t1.o
+; RUN: not wasm-ld --fatal-warnings %t.o %t1.o -o %t.wasm 2>&1 | FileCheck %s
+
+; Test that functions defined in bitcode correctly report signature
+; mistmaches with existing undefined sybmols in normal objects.
+
+target triple = "wasm32-unknown-unknown"
+
+; f is defined to take no argument in archive.ll which is compiled to bitcode
+declare void @f(i32);
+
+define void @_start() {
+ call void @f(i32 0)
+ ret void
+}
+
+; CHECK: >>> defined as (i32) -> void in {{.*}}signature-mismatch.ll.tmp1.o
+; CHECK: >>> defined as () -> void in lto.tmp