aboutsummaryrefslogtreecommitdiff
path: root/test/ELF/lto
diff options
context:
space:
mode:
Diffstat (limited to 'test/ELF/lto')
-rw-r--r--test/ELF/lto/Inputs/data-ordering-lto.ll6
-rw-r--r--test/ELF/lto/Inputs/linker-script-symbols-ipo.ll9
-rw-r--r--test/ELF/lto/Inputs/symbol-ordering-lto.ll10
-rw-r--r--test/ELF/lto/cache.ll14
-rw-r--r--test/ELF/lto/data-ordering-lto.s27
-rw-r--r--test/ELF/lto/keep-undefined.ll20
-rw-r--r--test/ELF/lto/linker-script-symbols-assign.ll48
-rw-r--r--test/ELF/lto/linker-script-symbols-ipo.ll32
-rw-r--r--test/ELF/lto/linker-script-symbols.ll29
-rw-r--r--test/ELF/lto/opt-level.ll21
-rw-r--r--test/ELF/lto/opt-remarks.ll25
-rw-r--r--test/ELF/lto/relocatable.ll55
-rw-r--r--test/ELF/lto/save-temps.ll7
-rw-r--r--test/ELF/lto/section-name.ll35
-rw-r--r--test/ELF/lto/shlib-undefined.ll2
-rw-r--r--test/ELF/lto/symbol-ordering-lto.s25
-rw-r--r--test/ELF/lto/thinlto.ll8
-rw-r--r--test/ELF/lto/verify-invalid.ll2
-rw-r--r--test/ELF/lto/wrap-1.ll2
-rw-r--r--test/ELF/lto/wrap-2.ll4
20 files changed, 351 insertions, 30 deletions
diff --git a/test/ELF/lto/Inputs/data-ordering-lto.ll b/test/ELF/lto/Inputs/data-ordering-lto.ll
new file mode 100644
index 000000000000..a95fa6d5a58a
--- /dev/null
+++ b/test/ELF/lto/Inputs/data-ordering-lto.ll
@@ -0,0 +1,6 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-scei-ps4"
+
+@pat = global i32 33, align 4
+@tin = global i32 33, align 4
+@dipsy = global i32 33, align 4
diff --git a/test/ELF/lto/Inputs/linker-script-symbols-ipo.ll b/test/ELF/lto/Inputs/linker-script-symbols-ipo.ll
new file mode 100644
index 000000000000..c872f9e1dd52
--- /dev/null
+++ b/test/ELF/lto/Inputs/linker-script-symbols-ipo.ll
@@ -0,0 +1,9 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+declare i32 @bar()
+
+define i32 @_start() {
+ %1 = tail call i32 @bar()
+ ret i32 %1
+}
diff --git a/test/ELF/lto/Inputs/symbol-ordering-lto.ll b/test/ELF/lto/Inputs/symbol-ordering-lto.ll
new file mode 100644
index 000000000000..164659ce27ba
--- /dev/null
+++ b/test/ELF/lto/Inputs/symbol-ordering-lto.ll
@@ -0,0 +1,10 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-scei-ps4"
+
+define i32 @tin() {
+ ret i32 22
+}
+
+define i32 @pat() {
+ ret i32 42
+}
diff --git a/test/ELF/lto/cache.ll b/test/ELF/lto/cache.ll
index 6731f522606f..5ab74f5c5457 100644
--- a/test/ELF/lto/cache.ll
+++ b/test/ELF/lto/cache.ll
@@ -7,7 +7,7 @@
; Create two files that would be removed by cache pruning due to age.
; We should only remove files matching the pattern "llvmcache-*".
; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/foo
-; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=1h -o %t3 %t2.o %t.o
+; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=1h:prune_interval=0s -o %t3 %t2.o %t.o
; Two cached objects, plus a timestamp file and "foo", minus the file we removed.
; RUN: ls %t.cache | count 4
@@ -16,13 +16,21 @@
; 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 -o %t3 %t2.o %t.o
+; 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
; This should remove it.
-; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=32k -o %t3 %t2.o %t.o
+; 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
+; Setting max number of files to 0 should disable the limit, not delete everything.
+; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=0:prune_interval=0s -o %t3 %t2.o %t.o
+; RUN: ls %t.cache | count 4
+
+; Delete everything except for the timestamp, "foo" and one cache file.
+; 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
+
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
new file mode 100644
index 000000000000..0364e587b908
--- /dev/null
+++ b/test/ELF/lto/data-ordering-lto.s
@@ -0,0 +1,27 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-scei-ps4 %s -o %t.o
+# RUN: llvm-as %p/Inputs/data-ordering-lto.ll -o %t.bc
+
+# Set up the symbol file
+# RUN: echo "tin " > %t_order_lto.txt
+# RUN: echo "dipsy " >> %t_order_lto.txt
+# 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-readobj -elf-output-style=GNU -t %t2.out| FileCheck %s
+
+# Check that the order is tin -> dipsy -> pat.
+
+# CHECK: Symbol table '.symtab' contains 5 entries:
+# CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
+# CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+# CHECK-NEXT: 1: 0000000000201000 0 NOTYPE GLOBAL DEFAULT 1 _start
+# CHECK-NEXT: 2: 0000000000202004 4 OBJECT GLOBAL DEFAULT 2 dipsy
+# CHECK-NEXT: 3: 0000000000202008 4 OBJECT GLOBAL DEFAULT 2 pat
+# CHECK-NEXT: 4: 0000000000202000 4 OBJECT GLOBAL DEFAULT 2 tin
+
+.globl _start
+_start:
+ movl $pat, %ecx
+ movl $dipsy, %ebx
+ movl $tin, %eax
diff --git a/test/ELF/lto/keep-undefined.ll b/test/ELF/lto/keep-undefined.ll
new file mode 100644
index 000000000000..cb0f4ce491f9
--- /dev/null
+++ b/test/ELF/lto/keep-undefined.ll
@@ -0,0 +1,20 @@
+; REQUIRES: x86
+; This test checks that symbols which are specified in "-u" switches
+; are kept over LTO if we link an executable.
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld -m elf_x86_64 %t.o -o %tout -u foo
+; RUN: llvm-nm %tout | FileCheck %s
+
+; CHECK: T foo
+
+target triple = "x86_64-unknown-linux-gnu"
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @foo() {
+ ret void
+}
+
+define void @_start() {
+ call void @foo()
+ ret void
+}
diff --git a/test/ELF/lto/linker-script-symbols-assign.ll b/test/ELF/lto/linker-script-symbols-assign.ll
new file mode 100644
index 000000000000..2ffdc823a484
--- /dev/null
+++ b/test/ELF/lto/linker-script-symbols-assign.ll
@@ -0,0 +1,48 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t.o
+
+; RUN: echo "foo = 1;" > %t.script
+; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 --script %t.script -save-temps
+; RUN: llvm-readobj -symbols %t2.lto.o | FileCheck %s
+
+; CHECK-NOT: bar
+; CHECK: Symbol {
+; CHECK: Name: foo
+; CHECK-NEXT: Value: 0x0
+; CHECK-NEXT: Size: 4
+; CHECK-NEXT: Binding: Weak
+; CHECK-NEXT: Type: Object
+; CHECK-NEXT: Other: 0
+; CHECK-NEXT: Section: .bss.foo
+; CHECK-NEXT: }
+; CHECK-NEXT:]
+
+; RUN: llvm-readobj -symbols %t2 | FileCheck %s --check-prefix=VAL
+; VAL: Symbol {
+; VAL: Name: foo
+; VAL-NEXT: Value: 0x1
+; VAL-NEXT: Size:
+; VAL-NEXT: Binding: Global
+; VAL-NEXT: Type: None
+; VAL-NEXT: Other:
+; VAL-NEXT: Section: Absolute
+; VAL-NEXT: }
+
+; RUN: echo "zed = 1;" > %t2.script
+; RUN: ld.lld -m elf_x86_64 %t.o -o %t3 --script %t2.script
+; RUN: llvm-readobj -symbols %t3 | FileCheck %s --check-prefix=ABS
+; ABS: Symbol {
+; ABS: Name: zed
+; ABS-NEXT: Value: 0x1
+; ABS-NEXT: Size: 0
+; ABS-NEXT: Binding: Global
+; ABS-NEXT: Type: None
+; ABS-NEXT: Other: 0
+; ABS-NEXT: Section: Absolute
+; ABS-NEXT: }
+
+target triple = "x86_64-unknown-linux-gnu"
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+@foo = global i32 0
+@bar = global i32 0
diff --git a/test/ELF/lto/linker-script-symbols-ipo.ll b/test/ELF/lto/linker-script-symbols-ipo.ll
new file mode 100644
index 000000000000..6ac1a83e1ec0
--- /dev/null
+++ b/test/ELF/lto/linker-script-symbols-ipo.ll
@@ -0,0 +1,32 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t1.o
+; RUN: llvm-as %S/Inputs/linker-script-symbols-ipo.ll -o %t2.o
+; RUN: echo "bar = foo;" > %t.script
+
+;; Check that without linkerscript bar is inlined.
+; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t3 -save-temps
+; RUN: llvm-objdump -d %t3 | FileCheck %s --check-prefix=IPO
+; IPO: Disassembly of section .text:
+; IPO: _start:
+; IPO-NEXT: 201000: {{.*}} movl $1, %eax
+; IPO-NEXT: 201005: {{.*}} retq
+
+;; Check that LTO does not do IPO for symbols assigned by script.
+; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t4 --script %t.script -save-temps
+; RUN: llvm-objdump -d %t4 | FileCheck %s --check-prefix=NOIPO
+; NOIPO: Disassembly of section .text:
+; NOIPO: foo:
+; NOIPO-NEXT: 201010: {{.*}} movl $2, %eax
+; NOIPO: _start:
+; NOIPO-NEXT: 201020: {{.*}} jmp -21 <foo>
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @bar() {
+ ret i32 1
+}
+
+define i32 @foo() {
+ ret i32 2
+}
diff --git a/test/ELF/lto/linker-script-symbols.ll b/test/ELF/lto/linker-script-symbols.ll
new file mode 100644
index 000000000000..c2a58b6e841d
--- /dev/null
+++ b/test/ELF/lto/linker-script-symbols.ll
@@ -0,0 +1,29 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t.o
+; RUN: echo "foo = bar;" > %t.script
+
+; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 --script %t.script -save-temps
+; RUN: llvm-readobj -symbols %t2.lto.o | FileCheck %s
+
+; CHECK-NOT: zed
+; CHECK: Symbol {
+; CHECK: Name: bar
+; CHECK-NEXT: Value:
+; CHECK-NEXT: Size:
+; CHECK-NEXT: Binding: Global
+; CHECK-NEXT: Type: Function
+; CHECK-NEXT: Other:
+; CHECK-NEXT: Section:
+; CHECK-NEXT: }
+; CHECK-NOT: zed
+
+target triple = "x86_64-unknown-linux-gnu"
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @bar() {
+ ret void
+}
+
+define void @zed() {
+ ret void
+}
diff --git a/test/ELF/lto/opt-level.ll b/test/ELF/lto/opt-level.ll
index 1065ca775751..57fa3041ac65 100644
--- a/test/ELF/lto/opt-level.ll
+++ b/test/ELF/lto/opt-level.ll
@@ -2,18 +2,31 @@
; RUN: llvm-as -o %t.o %s
; RUN: ld.lld -o %t0 -m elf_x86_64 -e main --lto-O0 %t.o
; RUN: llvm-nm %t0 | FileCheck --check-prefix=CHECK-O0 %s
+; RUN: ld.lld -o %t0 -m elf_x86_64 -e main --plugin-opt=O0 %t.o
+; RUN: llvm-nm %t0 | FileCheck --check-prefix=CHECK-O0 %s
; RUN: ld.lld -o %t2 -m elf_x86_64 -e main --lto-O2 %t.o
; RUN: llvm-nm %t2 | FileCheck --check-prefix=CHECK-O2 %s
; RUN: ld.lld -o %t2a -m elf_x86_64 -e main %t.o
; RUN: llvm-nm %t2a | FileCheck --check-prefix=CHECK-O2 %s
+; RUN: ld.lld -o %t2 -m elf_x86_64 -e main --plugin-opt=O2 %t.o
+; RUN: llvm-nm %t2 | FileCheck --check-prefix=CHECK-O2 %s
; Reject invalid optimization levels.
; RUN: not ld.lld -o %t3 -m elf_x86_64 -e main --lto-O6 %t.o 2>&1 | \
-; RUN: FileCheck --check-prefix=INVALID %s
-; INVALID: invalid optimization level for LTO: 6
+; RUN: FileCheck --check-prefix=INVALID1 %s
+; INVALID1: invalid optimization level for LTO: 6
+; RUN: not ld.lld -o %t3 -m elf_x86_64 -e main --plugin-opt=O6 %t.o 2>&1 | \
+; RUN: FileCheck --check-prefix=INVALID1 %s
+; RUN: not ld.lld -o %t3 -m elf_x86_64 -e main --plugin-opt=Ofoo %t.o 2>&1 | \
+; RUN: FileCheck --check-prefix=INVALID2 %s
+; INVALID2: --plugin-opt: number expected, but got 'foo'
+
; RUN: not ld.lld -o %t3 -m elf_x86_64 -e main --lto-O-1 %t.o 2>&1 | \
-; RUN: FileCheck --check-prefix=INVALIDNEGATIVE %s
-; INVALIDNEGATIVE: invalid optimization level for LTO: -1
+; RUN: FileCheck --check-prefix=INVALIDNEGATIVE1 %s
+; INVALIDNEGATIVE1: invalid optimization level for LTO: 4294967295
+; RUN: not ld.lld -o %t3 -m elf_x86_64 -e main --plugin-opt=O-1 %t.o 2>&1 | \
+; RUN: FileCheck --check-prefix=INVALIDNEGATIVE2 %s
+; INVALIDNEGATIVE2: invalid optimization level for LTO: 4294967295
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/opt-remarks.ll b/test/ELF/lto/opt-remarks.ll
index e29cc72bb3cc..19b141feb258 100644
--- a/test/ELF/lto/opt-remarks.ll
+++ b/test/ELF/lto/opt-remarks.ll
@@ -15,13 +15,13 @@
; CHECK-NEXT: ret i32 %a.i
; CHECK-NEXT: }
-; YAML: --- !Analysis
+; YAML: --- !Passed
; YAML-NEXT: Pass: inline
-; YAML-NEXT: Name: CanBeInlined
+; YAML-NEXT: Name: Inlined
; YAML-NEXT: Function: main
; YAML-NEXT: Args:
; YAML-NEXT: - Callee: tinkywinky
-; YAML-NEXT: - String: ' can be inlined into '
+; YAML-NEXT: - String: ' inlined into '
; YAML-NEXT: - Caller: main
; YAML-NEXT: - String: ' with cost='
; YAML-NEXT: - Cost: '0'
@@ -29,19 +29,9 @@
; YAML-NEXT: - Threshold: '337'
; YAML-NEXT: - String: ')'
; YAML-NEXT: ...
-; YAML-NEXT: --- !Passed
-; YAML-NEXT: Pass: inline
-; YAML-NEXT: Name: Inlined
-; YAML-NEXT: Function: main
-; YAML-NEXT: Args:
-; YAML-NEXT: - Callee: tinkywinky
-; YAML-NEXT: - String: ' inlined into '
-; YAML-NEXT: - Caller: main
-; YAML-NEXT: ...
-; YAML-HOT: ...
-; YAML-HOT: --- !Passed
-; YAML-HOT: Pass: inline
+; YAML-HOT: --- !Passed
+; YAML-HOT-NEXT: Pass: inline
; YAML-HOT-NEXT: Name: Inlined
; YAML-HOT-NEXT: Function: main
; YAML-HOT-NEXT: Hotness: 300
@@ -49,6 +39,11 @@
; 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: - Cost: '0'
+; YAML-HOT-NEXT: - String: ' (threshold='
+; YAML-HOT-NEXT: - Threshold: '337'
+; YAML-HOT-NEXT: - String: ')'
; YAML-HOT-NEXT: ...
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/test/ELF/lto/relocatable.ll b/test/ELF/lto/relocatable.ll
new file mode 100644
index 000000000000..ef21f84a621a
--- /dev/null
+++ b/test/ELF/lto/relocatable.ll
@@ -0,0 +1,55 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t1.o
+; RUN: ld.lld %t1.o -r -o %t
+; RUN: llvm-readobj -symbols %t | FileCheck %s
+
+; CHECK: Symbols [
+; CHECK-NEXT: Symbol {
+; CHECK-NEXT: Name:
+; CHECK-NEXT: Value: 0x0
+; CHECK-NEXT: Size: 0
+; CHECK-NEXT: Binding: Local
+; CHECK-NEXT: Type: None
+; CHECK-NEXT: Other: 0
+; CHECK-NEXT: Section: Undefined
+; 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: .text
+; 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: .text.foo
+; CHECK-NEXT: }
+; CHECK-NEXT: Symbol {
+; CHECK-NEXT: Name: foo
+; CHECK-NEXT: Value: 0x0
+; CHECK-NEXT: Size: 1
+; CHECK-NEXT: Binding: Global
+; CHECK-NEXT: Type: Function
+; CHECK-NEXT: Other: 0
+; CHECK-NEXT: Section: .text.foo
+; CHECK-NEXT: }
+; CHECK-NEXT: ]
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @foo() {
+ call void @bar()
+ ret void
+}
+
+define internal void @bar() {
+ ret void
+}
diff --git a/test/ELF/lto/save-temps.ll b/test/ELF/lto/save-temps.ll
index f7af99ed40af..c8e52ff4b4ec 100644
--- a/test/ELF/lto/save-temps.ll
+++ b/test/ELF/lto/save-temps.ll
@@ -9,6 +9,13 @@
; RUN: llvm-nm a.out.lto.o | FileCheck %s
; RUN: llvm-dis a.out.0.0.preopt.bc
+; RUN: rm -f a.out a.out.lto.bc a.out.lto.o
+; RUN: ld.lld -shared -m elf_x86_64 %t.o %t2.o --plugin-opt=save-temps
+; RUN: llvm-nm a.out | FileCheck %s
+; RUN: llvm-nm a.out.0.0.preopt.bc | FileCheck %s
+; RUN: llvm-nm a.out.lto.o | FileCheck %s
+; RUN: llvm-dis a.out.0.0.preopt.bc
+
target triple = "x86_64-unknown-linux-gnu"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/test/ELF/lto/section-name.ll b/test/ELF/lto/section-name.ll
new file mode 100644
index 000000000000..483184716a07
--- /dev/null
+++ b/test/ELF/lto/section-name.ll
@@ -0,0 +1,35 @@
+; 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: ld.lld %t.o -o %t.so -shared --gc-sections
+; 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"
+
+@foo = hidden global i32 42, section "foo_section"
+@bar = hidden global i32 42, section "bar_section"
+@zed = hidden global i32 42, section "zed_section"
+
+@__start_foo_section = external global i32
+@__stop_bar_section = external global i32
+
+define hidden i32* @use1() {
+ ret i32* @__start_foo_section
+}
+
+define i32* @use2() {
+ ret i32* @__stop_bar_section
+}
+
+; CHECK-NOT: zed_section
+; CHECK: foo_section PROGBITS
+; CHECK-NEXT: bar_section PROGBITS
+; CHECK-NOT: zed_section
+
+; GC-NOT: zed_section
+; GC-NOT: foo_section
+; GC: bar_section PROGBITS
+; GC-NOT: zed_section
+; GC-NOT: foo_section
diff --git a/test/ELF/lto/shlib-undefined.ll b/test/ELF/lto/shlib-undefined.ll
index 0250ed761927..6d37bfa6b304 100644
--- a/test/ELF/lto/shlib-undefined.ll
+++ b/test/ELF/lto/shlib-undefined.ll
@@ -1,6 +1,6 @@
; REQUIRES: x86
; RUN: llvm-as %s -o %t.o
-; RUN: echo .global __progname > %t2.s
+; RUN: echo ".global __progname; .data; .dc.a __progname" > %t2.s
; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t2.s -o %t2.o
; RUN: ld.lld -shared %t2.o -o %t2.so
; RUN: ld.lld -o %t %t.o %t2.so
diff --git a/test/ELF/lto/symbol-ordering-lto.s b/test/ELF/lto/symbol-ordering-lto.s
new file mode 100644
index 000000000000..4c29e54c476e
--- /dev/null
+++ b/test/ELF/lto/symbol-ordering-lto.s
@@ -0,0 +1,25 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-scei-ps4 %s -o %t.o
+# RUN: llvm-as %p/Inputs/symbol-ordering-lto.ll -o %t.bc
+
+# Set up the symbol file
+# RUN: echo "tin " > %t_order_lto.txt
+# RUN: echo "_start " >> %t_order_lto.txt
+# 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-readobj -elf-output-style=GNU -t %t2.out| FileCheck %s
+
+# Check that the order is tin -> _start -> pat.
+
+# CHECK: Symbol table '.symtab' contains 4 entries:
+# CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
+# CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+# CHECK-NEXT: 1: 0000000000201008 0 NOTYPE GLOBAL DEFAULT 1 _start
+# CHECK-NEXT: 2: 0000000000201020 6 FUNC GLOBAL DEFAULT 1 pat
+# CHECK-NEXT: 3: 0000000000201000 6 FUNC GLOBAL DEFAULT 1 tin
+
+.globl _start
+_start:
+ call pat
+ call tin
diff --git a/test/ELF/lto/thinlto.ll b/test/ELF/lto/thinlto.ll
index 99dd19130d28..37d2b88131f6 100644
--- a/test/ELF/lto/thinlto.ll
+++ b/test/ELF/lto/thinlto.ll
@@ -6,14 +6,14 @@
; First force single-threaded mode
; RUN: rm -f %t.lto.o %t1.lto.o
; RUN: ld.lld -save-temps --thinlto-jobs=1 -shared %t.o %t2.o -o %t
-; RUN: llvm-nm %t.lto.o | FileCheck %s --check-prefix=NM1
-; RUN: llvm-nm %t1.lto.o | FileCheck %s --check-prefix=NM2
+; RUN: llvm-nm %t1.lto.o | FileCheck %s --check-prefix=NM1
+; RUN: llvm-nm %t2.lto.o | FileCheck %s --check-prefix=NM2
; Next force multi-threaded mode
; RUN: rm -f %t2.lto.o %t21.lto.o
; RUN: ld.lld -save-temps --thinlto-jobs=2 -shared %t.o %t2.o -o %t2
-; RUN: llvm-nm %t2.lto.o | FileCheck %s --check-prefix=NM1
-; RUN: llvm-nm %t21.lto.o | FileCheck %s --check-prefix=NM2
+; RUN: llvm-nm %t21.lto.o | FileCheck %s --check-prefix=NM1
+; RUN: llvm-nm %t22.lto.o | FileCheck %s --check-prefix=NM2
; NM1: T f
; NM1-NOT: U g
diff --git a/test/ELF/lto/verify-invalid.ll b/test/ELF/lto/verify-invalid.ll
index 16d6a3e54f12..e6138a3cca62 100644
--- a/test/ELF/lto/verify-invalid.ll
+++ b/test/ELF/lto/verify-invalid.ll
@@ -4,6 +4,8 @@
; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT %s
; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -mllvm -debug-pass=Arguments \
; RUN: -disable-verify 2>&1 | FileCheck -check-prefix=DISABLE %s
+; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -mllvm -debug-pass=Arguments \
+; RUN: --plugin-opt=disable-verify 2>&1 | FileCheck -check-prefix=DISABLE %s
target triple = "x86_64-unknown-linux-gnu"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/test/ELF/lto/wrap-1.ll b/test/ELF/lto/wrap-1.ll
index 1dd9139808b6..83e09493fb5d 100644
--- a/test/ELF/lto/wrap-1.ll
+++ b/test/ELF/lto/wrap-1.ll
@@ -19,7 +19,7 @@
; Make sure that the 'r' (linker redefined) bit is set for bar and __wrap_bar
; in the resolutions file.
-; RESOLS: ,bar,r
+; RESOLS: ,bar,xr
; RESOLS: ,__wrap_bar,px
; RESOLS: ,__real_bar,pxr
diff --git a/test/ELF/lto/wrap-2.ll b/test/ELF/lto/wrap-2.ll
index 06ef4064e4d1..4e82d4a0e8b0 100644
--- a/test/ELF/lto/wrap-2.ll
+++ b/test/ELF/lto/wrap-2.ll
@@ -28,11 +28,11 @@
; THIN-NEXT: jmp{{.*}}<bar>
; Check that bar and __wrap_bar retain their original binding.
-; BIND: Name: bar
+; BIND: Name: __wrap_bar
; BIND-NEXT: Value:
; BIND-NEXT: Size:
; BIND-NEXT: Binding: Local
-; BIND: Name: __wrap_bar
+; BIND: Name: bar
; BIND-NEXT: Value:
; BIND-NEXT: Size:
; BIND-NEXT: Binding: Local