Skip to content

[lld/ELF] Add tests for start-lib / end-lib with eager loads #120294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lld/test/ELF/Inputs/eager.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.globl eager
eager:
retq

.globl ogre
ogre:
retq
10 changes: 10 additions & 0 deletions lld/test/ELF/lto/Inputs/eager.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @eager() {
ret void
}

define void @ogre() {
ret void
}
10 changes: 7 additions & 3 deletions lld/test/ELF/lto/start-lib.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,29 @@
; RUN: llvm-as %s -o %t1.o
; RUN: llvm-as %p/Inputs/start-lib1.ll -o %t2.o
; RUN: llvm-as %p/Inputs/start-lib2.ll -o %t3.o
; RUN: llvm-as %p/Inputs/eager.ll -o %t-eager.o
;
; RUN: ld.lld -shared -o %t3 %t1.o %t2.o %t3.o
; RUN: ld.lld -shared -o %t3 %t1.o %t2.o %t3.o %t-eager.o
; RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST1 %s
; TEST1: Name: foo
; TEST1: Name: bar
;
; RUN: ld.lld -shared -o %t3 -u bar %t1.o --start-lib %t2.o %t3.o
; RUN: ld.lld -shared -o %t3 -u bar %t1.o --start-lib %t2.o %t3.o %t-eager.o
; RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST2 %s
; TEST2-NOT: Name: foo
; TEST2: Name: bar
;
; RUN: ld.lld -shared -o %t3 %t1.o --start-lib %t2.o %t3.o
; RUN: ld.lld -shared -o %t3 %t1.o --start-lib %t2.o %t3.o %t-eager.o
; RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST3 %s
; TEST3-NOT: Name: foo
; TEST3-NOT: Name: bar

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

declare void @eager()

define void @_start() {
call void @eager()
ret void
}
9 changes: 6 additions & 3 deletions lld/test/ELF/start-lib.s
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
// RUN: %p/Inputs/start-lib1.s -o %t2.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
// RUN: %p/Inputs/start-lib2.s -o %t3.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
// RUN: %p/Inputs/eager.s -o %t-eager.o

// RUN: ld.lld -o %t3 %t1.o %t2.o %t3.o
// RUN: ld.lld -o %t3 %t1.o %t2.o %t3.o %t-eager.o
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=TEST1 %s
// TEST1: Name: foo
// TEST1: Name: bar

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

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

.globl _start
_start:
callq eager
Loading