Skip to content

Commit b05071d

Browse files
authored
[lld/ELF] Add tests for start-lib / end-lib with eager loads (#120294)
Contains tests for the scenarios fixed in lld/COFF in #120292. They pass without code changes, but I didn't see existing tests for this.
1 parent 2b6713d commit b05071d

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

lld/test/ELF/Inputs/eager.s

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.globl eager
2+
eager:
3+
retq
4+
5+
.globl ogre
6+
ogre:
7+
retq

lld/test/ELF/lto/Inputs/eager.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
2+
target triple = "x86_64-unknown-linux-gnu"
3+
4+
define void @eager() {
5+
ret void
6+
}
7+
8+
define void @ogre() {
9+
ret void
10+
}

lld/test/ELF/lto/start-lib.ll

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,29 @@
33
; RUN: llvm-as %s -o %t1.o
44
; RUN: llvm-as %p/Inputs/start-lib1.ll -o %t2.o
55
; RUN: llvm-as %p/Inputs/start-lib2.ll -o %t3.o
6+
; RUN: llvm-as %p/Inputs/eager.ll -o %t-eager.o
67
;
7-
; RUN: ld.lld -shared -o %t3 %t1.o %t2.o %t3.o
8+
; RUN: ld.lld -shared -o %t3 %t1.o %t2.o %t3.o %t-eager.o
89
; RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST1 %s
910
; TEST1: Name: foo
1011
; TEST1: Name: bar
1112
;
12-
; RUN: ld.lld -shared -o %t3 -u bar %t1.o --start-lib %t2.o %t3.o
13+
; RUN: ld.lld -shared -o %t3 -u bar %t1.o --start-lib %t2.o %t3.o %t-eager.o
1314
; RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST2 %s
1415
; TEST2-NOT: Name: foo
1516
; TEST2: Name: bar
1617
;
17-
; RUN: ld.lld -shared -o %t3 %t1.o --start-lib %t2.o %t3.o
18+
; RUN: ld.lld -shared -o %t3 %t1.o --start-lib %t2.o %t3.o %t-eager.o
1819
; RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST3 %s
1920
; TEST3-NOT: Name: foo
2021
; TEST3-NOT: Name: bar
2122

2223
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
2324
target triple = "x86_64-unknown-linux-gnu"
2425

26+
declare void @eager()
27+
2528
define void @_start() {
29+
call void @eager()
2630
ret void
2731
}

lld/test/ELF/start-lib.s

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
// RUN: %p/Inputs/start-lib1.s -o %t2.o
66
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
77
// RUN: %p/Inputs/start-lib2.s -o %t3.o
8+
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
9+
// RUN: %p/Inputs/eager.s -o %t-eager.o
810

9-
// RUN: ld.lld -o %t3 %t1.o %t2.o %t3.o
11+
// RUN: ld.lld -o %t3 %t1.o %t2.o %t3.o %t-eager.o
1012
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST1 %s
1113
// TEST1: Name: foo
1214
// TEST1: Name: bar
1315

14-
// RUN: ld.lld -o %t3 %t1.o -u bar --start-lib %t2.o %t3.o
16+
// RUN: ld.lld -o %t3 %t1.o -u bar --start-lib %t2.o %t3.o %t-eager.o
1517
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST2 %s
1618
// TEST2-NOT: Name: foo
1719
// TEST2: Name: bar
1820

19-
// RUN: ld.lld -o %t3 %t1.o --start-lib %t2.o %t3.o
21+
// RUN: ld.lld -o %t3 %t1.o --start-lib %t2.o %t3.o %t-eager.o
2022
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST3 %s
2123
// TEST3-NOT: Name: foo
2224
// TEST3-NOT: Name: bar
@@ -32,3 +34,4 @@
3234

3335
.globl _start
3436
_start:
37+
callq eager

0 commit comments

Comments
 (0)