aboutsummaryrefslogtreecommitdiff
path: root/test/ELF/lto
diff options
context:
space:
mode:
Diffstat (limited to 'test/ELF/lto')
-rw-r--r--test/ELF/lto/Inputs/libcall-archive.s2
-rw-r--r--test/ELF/lto/amdgcn.ll12
-rw-r--r--test/ELF/lto/cache.ll22
-rw-r--r--test/ELF/lto/data-ordering-lto.s2
-rw-r--r--test/ELF/lto/defsym.ll4
-rw-r--r--test/ELF/lto/dynamic-list.ll2
-rw-r--r--test/ELF/lto/emit-llvm.ll14
-rw-r--r--test/ELF/lto/libcall-archive.ll7
-rw-r--r--test/ELF/lto/ltopasses-custom.ll4
-rw-r--r--test/ELF/lto/opt-remarks.ll10
-rw-r--r--test/ELF/lto/ppc64le.ll12
-rw-r--r--test/ELF/lto/r600.ll12
-rw-r--r--test/ELF/lto/relocatable.ll9
-rw-r--r--test/ELF/lto/section-name.ll4
-rw-r--r--test/ELF/lto/shlib-undefined.ll2
-rw-r--r--test/ELF/lto/symbol-ordering-lto.s2
-rw-r--r--test/ELF/lto/thinlto-obj-path.ll3
-rw-r--r--test/ELF/lto/thinlto-object-suffix-replace.ll12
-rw-r--r--test/ELF/lto/undefined-puts.ll2
-rw-r--r--test/ELF/lto/version-script.ll2
-rw-r--r--test/ELF/lto/wrap-2.ll8
21 files changed, 120 insertions, 27 deletions
diff --git a/test/ELF/lto/Inputs/libcall-archive.s b/test/ELF/lto/Inputs/libcall-archive.s
new file mode 100644
index 000000000000..6ca6e5fa821e
--- /dev/null
+++ b/test/ELF/lto/Inputs/libcall-archive.s
@@ -0,0 +1,2 @@
+.globl __sync_val_compare_and_swap_8
+__sync_val_compare_and_swap_8:
diff --git a/test/ELF/lto/amdgcn.ll b/test/ELF/lto/amdgcn.ll
new file mode 100644
index 000000000000..4281e209fd97
--- /dev/null
+++ b/test/ELF/lto/amdgcn.ll
@@ -0,0 +1,12 @@
+; REQUIRES: amdgpu
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld %t.o -o %t
+
+; Make sure the amdgcn triple is handled
+
+target triple = "amdgcn-amd-amdhsa"
+target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
+
+define void @_start() {
+ ret void
+}
diff --git a/test/ELF/lto/cache.ll b/test/ELF/lto/cache.ll
index 3f2bea9f2cdf..fe123989f22d 100644
--- a/test/ELF/lto/cache.ll
+++ b/test/ELF/lto/cache.ll
@@ -1,4 +1,6 @@
; REQUIRES: x86
+; NetBSD: noatime mounts currently inhibit 'touch' from updating atime
+; UNSUPPORTED: system-netbsd
; RUN: opt -module-hash -module-summary %s -o %t.o
; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o %t2.o
@@ -13,12 +15,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: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=128k:prune_interval=0s -o %t3 %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: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=32k:prune_interval=0s -o %t3 %t2.o %t.o
; RUN: ls %t.cache | count 4
@@ -31,6 +37,20 @@
; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=1:prune_interval=0s -o %t3 %t2.o %t.o
; RUN: ls %t.cache | count 3
+; Check that we remove the least recently used file first.
+; RUN: rm -fr %t.cache
+; RUN: mkdir %t.cache
+; RUN: echo xyz > %t.cache/llvmcache-old
+; RUN: touch -t 198002011200 %t.cache/llvmcache-old
+; RUN: echo xyz > %t.cache/llvmcache-newer
+; RUN: touch -t 198002021200 %t.cache/llvmcache-newer
+; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=3:prune_interval=0s -o %t3 %t2.o %t.o
+; RUN: ls %t.cache | FileCheck %s
+
+; CHECK-NOT: llvmcache-old
+; CHECK: llvmcache-newer
+; CHECK-NOT: llvmcache-old
+
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
diff --git a/test/ELF/lto/data-ordering-lto.s b/test/ELF/lto/data-ordering-lto.s
index bdacccc35400..f3cd52bd02b5 100644
--- a/test/ELF/lto/data-ordering-lto.s
+++ b/test/ELF/lto/data-ordering-lto.s
@@ -8,7 +8,7 @@
# RUN: echo "pat " >> %t_order_lto.txt
# RUN: ld.lld --symbol-ordering-file %t_order_lto.txt %t.o %t.bc -o %t2.out
-# RUN: llvm-readelf -t %t2.out| FileCheck %s
+# RUN: llvm-readelf --symbols %t2.out| FileCheck %s
# Check that the order is tin -> dipsy -> pat.
diff --git a/test/ELF/lto/defsym.ll b/test/ELF/lto/defsym.ll
index e5f0a4875f59..671f589da18d 100644
--- a/test/ELF/lto/defsym.ll
+++ b/test/ELF/lto/defsym.ll
@@ -3,14 +3,14 @@
; RUN: llvm-as %s -o %t.o
; RUN: llvm-as %S/Inputs/defsym-bar.ll -o %t1.o
; RUN: ld.lld %t.o %t1.o -shared -o %t.so -defsym=bar2=bar3 -save-temps
-; RUN: llvm-readelf -t %t.so.lto.o | FileCheck --check-prefix=OBJ %s
+; RUN: llvm-readelf --symbols %t.so.lto.o | FileCheck --check-prefix=OBJ %s
; RUN: llvm-objdump -d %t.so | FileCheck %s
; ThinLTO
; RUN: opt -module-summary %s -o %t.o
; RUN: opt -module-summary %S/Inputs/defsym-bar.ll -o %t1.o
; RUN: ld.lld %t.o %t1.o -shared -o %t2.so -defsym=bar2=bar3 -save-temps
-; RUN: llvm-readelf -t %t2.so1.lto.o | FileCheck --check-prefix=OBJ %s
+; RUN: llvm-readelf --symbols %t2.so1.lto.o | FileCheck --check-prefix=OBJ %s
; RUN: llvm-objdump -d %t2.so | FileCheck %s --check-prefix=THIN
; OBJ: UND bar2
diff --git a/test/ELF/lto/dynamic-list.ll b/test/ELF/lto/dynamic-list.ll
index c5473d833380..84b667b0eb0c 100644
--- a/test/ELF/lto/dynamic-list.ll
+++ b/test/ELF/lto/dynamic-list.ll
@@ -4,7 +4,7 @@
; RUN: ld.lld -o %t --dynamic-list %t.list -pie %t.o
; RUN: llvm-readobj -dyn-symbols %t | FileCheck %s
-; CHECK: Name: foo@
+; CHECK: Name: foo
; CHECK-NEXT: Value: 0x1010
; CHECK-NEXT: Size: 1
; CHECK-NEXT: Binding: Global (0x1)
diff --git a/test/ELF/lto/emit-llvm.ll b/test/ELF/lto/emit-llvm.ll
new file mode 100644
index 000000000000..bf38c982f02e
--- /dev/null
+++ b/test/ELF/lto/emit-llvm.ll
@@ -0,0 +1,14 @@
+; REQUIRES: x86
+
+; RUN: opt -module-hash -module-summary %s -o %t.o
+; RUN: ld.lld --plugin-opt=emit-llvm -o %t.out.o %t.o
+; RUN: llvm-dis < %t.out.o -o - | FileCheck %s
+
+; CHECK: define internal void @main()
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @main() {
+ ret void
+}
diff --git a/test/ELF/lto/libcall-archive.ll b/test/ELF/lto/libcall-archive.ll
index 731e25938bd3..7e8ac183317d 100644
--- a/test/ELF/lto/libcall-archive.ll
+++ b/test/ELF/lto/libcall-archive.ll
@@ -1,10 +1,15 @@
+; REQUIRES: x86
; RUN: rm -f %t.a
; RUN: llvm-as -o %t.o %s
; RUN: llvm-as -o %t2.o %S/Inputs/libcall-archive.ll
-; RUN: llvm-ar rcs %t.a %t2.o
+; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -o %t3.o %S/Inputs/libcall-archive.s
+; RUN: llvm-ar rcs %t.a %t2.o %t3.o
; RUN: ld.lld -o %t %t.o %t.a
; RUN: llvm-nm %t | FileCheck %s
+; RUN: ld.lld -o %t2 %t.o --start-lib %t2.o %t3.o --end-lib
+; RUN: llvm-nm %t2 | FileCheck %s
+; CHECK-NOT: T __sync_val_compare_and_swap_8
; CHECK: T _start
; CHECK: T memcpy
diff --git a/test/ELF/lto/ltopasses-custom.ll b/test/ELF/lto/ltopasses-custom.ll
index a75000d5cfd3..23f15642682a 100644
--- a/test/ELF/lto/ltopasses-custom.ll
+++ b/test/ELF/lto/ltopasses-custom.ll
@@ -27,11 +27,11 @@ define void @barrier() {
; RUN: not ld.lld -m elf_x86_64 %t.o -o %t2.so \
; RUN: --lto-newpm-passes=iamnotapass -shared 2>&1 | \
; RUN: FileCheck %s --check-prefix=INVALID
-; INVALID: unable to parse pass pipeline description: iamnotapass
+; INVALID: unable to parse pass pipeline description 'iamnotapass': unknown pass name 'iamnotapass'
; Check that invalid AA pipelines are rejected gracefully.
; RUN: not ld.lld -m elf_x86_64 %t.o -o %t2.so \
; RUN: --lto-newpm-passes=globaldce --lto-aa-pipeline=patatino \
; RUN: -shared 2>&1 | \
; RUN: FileCheck %s --check-prefix=INVALIDAA
-; INVALIDAA: unable to parse AA pipeline description: patatino
+; INVALIDAA: unknown alias analysis name 'patatino'
diff --git a/test/ELF/lto/opt-remarks.ll b/test/ELF/lto/opt-remarks.ll
index 19b141feb258..bef7e016a1c0 100644
--- a/test/ELF/lto/opt-remarks.ll
+++ b/test/ELF/lto/opt-remarks.ll
@@ -23,9 +23,10 @@
; YAML-NEXT: - Callee: tinkywinky
; YAML-NEXT: - String: ' inlined into '
; YAML-NEXT: - Caller: main
-; YAML-NEXT: - String: ' with cost='
+; YAML-NEXT: - String: ' with '
+; YAML-NEXT: - String: '(cost='
; YAML-NEXT: - Cost: '0'
-; YAML-NEXT: - String: ' (threshold='
+; YAML-NEXT: - String: ', threshold='
; YAML-NEXT: - Threshold: '337'
; YAML-NEXT: - String: ')'
; YAML-NEXT: ...
@@ -39,9 +40,10 @@
; YAML-HOT-NEXT: - Callee: tinkywinky
; YAML-HOT-NEXT: - String: ' inlined into '
; YAML-HOT-NEXT: - Caller: main
-; YAML-HOT-NEXT: - String: ' with cost='
+; YAML-HOT-NEXT: - String: ' with '
+; YAML-HOT-NEXT: - String: '(cost='
; YAML-HOT-NEXT: - Cost: '0'
-; YAML-HOT-NEXT: - String: ' (threshold='
+; YAML-HOT-NEXT: - String: ', threshold='
; YAML-HOT-NEXT: - Threshold: '337'
; YAML-HOT-NEXT: - String: ')'
; YAML-HOT-NEXT: ...
diff --git a/test/ELF/lto/ppc64le.ll b/test/ELF/lto/ppc64le.ll
new file mode 100644
index 000000000000..917b47231843
--- /dev/null
+++ b/test/ELF/lto/ppc64le.ll
@@ -0,0 +1,12 @@
+; REQUIRES: ppc
+
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld %t.o -o %t
+
+target datalayout = "e-m:e-i64:64-n32:64"
+target triple = "powerpc64le-unknown-linux-gnu"
+
+define void @__start() {
+ entry:
+ ret void
+}
diff --git a/test/ELF/lto/r600.ll b/test/ELF/lto/r600.ll
new file mode 100644
index 000000000000..1c95edcb4c56
--- /dev/null
+++ b/test/ELF/lto/r600.ll
@@ -0,0 +1,12 @@
+; REQUIRES: amdgpu
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld %t.o -o %t
+
+; Make sure the r600 triple is handled
+
+target triple = "r600-mesa-mesa3d"
+target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
+
+define void @_start() {
+ ret void
+}
diff --git a/test/ELF/lto/relocatable.ll b/test/ELF/lto/relocatable.ll
index 2ec9144a37b0..5a0ed4252bfe 100644
--- a/test/ELF/lto/relocatable.ll
+++ b/test/ELF/lto/relocatable.ll
@@ -41,6 +41,15 @@
; CHECK-NEXT: Section: .text.foo
; CHECK-NEXT: }
; CHECK-NEXT: Symbol {
+; CHECK-NEXT: Name:
+; CHECK-NEXT: Value: 0x0
+; CHECK-NEXT: Size: 0
+; CHECK-NEXT: Binding: Local
+; CHECK-NEXT: Type: Section
+; CHECK-NEXT: Other: 0
+; CHECK-NEXT: Section: .llvm_addrsig
+; CHECK-NEXT: }
+; CHECK-NEXT: Symbol {
; CHECK-NEXT: Name: foo
; CHECK-NEXT: Value: 0x0
; CHECK-NEXT: Size: 1
diff --git a/test/ELF/lto/section-name.ll b/test/ELF/lto/section-name.ll
index 483184716a07..0ecc3778aef7 100644
--- a/test/ELF/lto/section-name.ll
+++ b/test/ELF/lto/section-name.ll
@@ -1,9 +1,9 @@
; REQUIRES: x86
; RUN: llvm-as %s -o %t.o
; RUN: ld.lld %t.o -o %t.so -shared
-; RUN: llvm-readelf -s %t.so | FileCheck %s
+; RUN: llvm-readelf -S %t.so | FileCheck %s
; RUN: ld.lld %t.o -o %t.so -shared --gc-sections
-; RUN: llvm-readelf -s %t.so | FileCheck --check-prefix=GC %s
+; RUN: llvm-readelf -S %t.so | FileCheck --check-prefix=GC %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
diff --git a/test/ELF/lto/shlib-undefined.ll b/test/ELF/lto/shlib-undefined.ll
index 6d37bfa6b304..eec40cc2771b 100644
--- a/test/ELF/lto/shlib-undefined.ll
+++ b/test/ELF/lto/shlib-undefined.ll
@@ -6,7 +6,7 @@
; RUN: ld.lld -o %t %t.o %t2.so
; RUN: llvm-readobj -dyn-symbols %t | FileCheck %s
-; CHECK: Name: __progname@
+; CHECK: Name: __progname
; CHECK-NEXT: Value: 0x201010
; CHECK-NEXT: Size: 1
; CHECK-NEXT: Binding: Global (0x1)
diff --git a/test/ELF/lto/symbol-ordering-lto.s b/test/ELF/lto/symbol-ordering-lto.s
index 530b63c669a4..6a35c60772a6 100644
--- a/test/ELF/lto/symbol-ordering-lto.s
+++ b/test/ELF/lto/symbol-ordering-lto.s
@@ -8,7 +8,7 @@
# RUN: echo "pat " >> %t_order_lto.txt
# RUN: ld.lld --symbol-ordering-file %t_order_lto.txt %t.o %t.bc -o %t2.out
-# RUN: llvm-readelf -t %t2.out| FileCheck %s
+# RUN: llvm-readelf --symbols %t2.out| FileCheck %s
# Check that the order is tin -> _start -> pat.
diff --git a/test/ELF/lto/thinlto-obj-path.ll b/test/ELF/lto/thinlto-obj-path.ll
index bb69bb876a28..2806d164a54c 100644
--- a/test/ELF/lto/thinlto-obj-path.ll
+++ b/test/ELF/lto/thinlto-obj-path.ll
@@ -7,7 +7,8 @@
; RUN: rm -f %t4.o
; RUN: ld.lld --plugin-opt=thinlto-index-only --plugin-opt=obj-path=%t4.o -shared %t1.o %t2.o -o %t3
; RUN: llvm-readobj -h %t4.o | FileCheck %s
-; RUN: llvm-nm %t4.o | count 0
+; RUN: llvm-nm %t4.o 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS
+; NO-SYMBOLS: no symbols
; CHECK: Format: ELF64-x86-64
diff --git a/test/ELF/lto/thinlto-object-suffix-replace.ll b/test/ELF/lto/thinlto-object-suffix-replace.ll
index 05ce942c70f8..c58a1f2ded0e 100644
--- a/test/ELF/lto/thinlto-object-suffix-replace.ll
+++ b/test/ELF/lto/thinlto-object-suffix-replace.ll
@@ -29,12 +29,12 @@
; RUN: -o %t3 2>&1 | FileCheck %s --check-prefix=ERR1
; ERR1: --plugin-opt=thinlto-object-suffix-replace= expects 'old;new' format, but got abc:def
-; Ensure lld generates error if old suffix doesn't exist in file name
-; RUN: rm -f %t1.o
-; RUN: not ld.lld --plugin-opt=thinlto-index-only \
-; RUN: --plugin-opt=thinlto-object-suffix-replace=".abc;.o" -shared %t1.thinlink.bc \
-; RUN: -o %t3 2>&1 | FileCheck %s --check-prefix=ERR2
-; ERR2: error: -thinlto-object-suffix-replace=.abc;.o was given, but {{.*}} does not end with the suffix
+; If filename does not end with old suffix, no suffix change should occur,
+; so ".thinlto.bc" will simply be appended to the input file name.
+; RUN: rm -f %t1.thinlink.bc.thinlto.bc
+; RUN: ld.lld --plugin-opt=thinlto-index-only \
+; RUN: --plugin-opt=thinlto-object-suffix-replace=".abc;.o" -shared %t1.thinlink.bc -o /dev/null
+; RUN: ls %t1.thinlink.bc.thinlto.bc
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
diff --git a/test/ELF/lto/undefined-puts.ll b/test/ELF/lto/undefined-puts.ll
index 6c3dc76be12a..f34abe68206c 100644
--- a/test/ELF/lto/undefined-puts.ll
+++ b/test/ELF/lto/undefined-puts.ll
@@ -25,4 +25,4 @@ declare i32 @printf(i8*, ...)
; CHECK: DynamicSymbols [
; CHECK: Symbol {
-; CHECK: Name: puts@
+; CHECK: Name: puts
diff --git a/test/ELF/lto/version-script.ll b/test/ELF/lto/version-script.ll
index 35a36b5a8d78..eae5a35a6ff4 100644
--- a/test/ELF/lto/version-script.ll
+++ b/test/ELF/lto/version-script.ll
@@ -21,7 +21,7 @@ define void @bar() {
; DSO: DynamicSymbols [
; DSO: Symbol {
-; DSO: Name: @ (0)
+; DSO: Name:
; DSO: Value: 0x0
; DSO: Size: 0
; DSO: Binding: Local
diff --git a/test/ELF/lto/wrap-2.ll b/test/ELF/lto/wrap-2.ll
index 4e82d4a0e8b0..997725fb8def 100644
--- a/test/ELF/lto/wrap-2.ll
+++ b/test/ELF/lto/wrap-2.ll
@@ -28,11 +28,15 @@
; THIN-NEXT: jmp{{.*}}<bar>
; Check that bar and __wrap_bar retain their original binding.
-; BIND: Name: __wrap_bar
+; BIND: Name: bar
; BIND-NEXT: Value:
; BIND-NEXT: Size:
; BIND-NEXT: Binding: Local
-; BIND: Name: bar
+; BIND: Name: __real_bar
+; BIND-NEXT: Value:
+; BIND-NEXT: Size:
+; BIND-NEXT: Binding: Local
+; BIND: Name: __wrap_bar
; BIND-NEXT: Value:
; BIND-NEXT: Size:
; BIND-NEXT: Binding: Local