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

Conversation

nico
Copy link
Contributor

@nico nico commented Dec 17, 2024

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.

Contains tests for the scenarios fixed in lld/COFF in llvm#120292.
They pass without code changes, but I didn't see existing tests
for this.
@llvmbot
Copy link
Member

llvmbot commented Dec 17, 2024

@llvm/pr-subscribers-lld

Author: Nico Weber (nico)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/120294.diff

4 Files Affected:

  • (added) lld/test/ELF/Inputs/eager.s (+7)
  • (added) lld/test/ELF/lto/Inputs/eager.ll (+10)
  • (modified) lld/test/ELF/lto/start-lib.ll (+7-3)
  • (modified) lld/test/ELF/start-lib.s (+6-3)
diff --git a/lld/test/ELF/Inputs/eager.s b/lld/test/ELF/Inputs/eager.s
new file mode 100644
index 00000000000000..1c6b6852bc7821
--- /dev/null
+++ b/lld/test/ELF/Inputs/eager.s
@@ -0,0 +1,7 @@
+.globl eager
+eager:
+  retq
+
+.globl ogre
+ogre:
+  retq
diff --git a/lld/test/ELF/lto/Inputs/eager.ll b/lld/test/ELF/lto/Inputs/eager.ll
new file mode 100644
index 00000000000000..ffd550e6f9cd26
--- /dev/null
+++ b/lld/test/ELF/lto/Inputs/eager.ll
@@ -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
+}
diff --git a/lld/test/ELF/lto/start-lib.ll b/lld/test/ELF/lto/start-lib.ll
index 39f62a7b1074fb..6d508c6478ec26 100644
--- a/lld/test/ELF/lto/start-lib.ll
+++ b/lld/test/ELF/lto/start-lib.ll
@@ -3,18 +3,19 @@
 ; 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
@@ -22,6 +23,9 @@
 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
 }
diff --git a/lld/test/ELF/start-lib.s b/lld/test/ELF/start-lib.s
index 04ac5a6323d05a..5bd0bd628bf3fe 100644
--- a/lld/test/ELF/start-lib.s
+++ b/lld/test/ELF/start-lib.s
@@ -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
@@ -32,3 +34,4 @@
 
 .globl _start
 _start:
+  callq eager

@llvmbot
Copy link
Member

llvmbot commented Dec 17, 2024

@llvm/pr-subscribers-lld-elf

Author: Nico Weber (nico)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/120294.diff

4 Files Affected:

  • (added) lld/test/ELF/Inputs/eager.s (+7)
  • (added) lld/test/ELF/lto/Inputs/eager.ll (+10)
  • (modified) lld/test/ELF/lto/start-lib.ll (+7-3)
  • (modified) lld/test/ELF/start-lib.s (+6-3)
diff --git a/lld/test/ELF/Inputs/eager.s b/lld/test/ELF/Inputs/eager.s
new file mode 100644
index 00000000000000..1c6b6852bc7821
--- /dev/null
+++ b/lld/test/ELF/Inputs/eager.s
@@ -0,0 +1,7 @@
+.globl eager
+eager:
+  retq
+
+.globl ogre
+ogre:
+  retq
diff --git a/lld/test/ELF/lto/Inputs/eager.ll b/lld/test/ELF/lto/Inputs/eager.ll
new file mode 100644
index 00000000000000..ffd550e6f9cd26
--- /dev/null
+++ b/lld/test/ELF/lto/Inputs/eager.ll
@@ -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
+}
diff --git a/lld/test/ELF/lto/start-lib.ll b/lld/test/ELF/lto/start-lib.ll
index 39f62a7b1074fb..6d508c6478ec26 100644
--- a/lld/test/ELF/lto/start-lib.ll
+++ b/lld/test/ELF/lto/start-lib.ll
@@ -3,18 +3,19 @@
 ; 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
@@ -22,6 +23,9 @@
 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
 }
diff --git a/lld/test/ELF/start-lib.s b/lld/test/ELF/start-lib.s
index 04ac5a6323d05a..5bd0bd628bf3fe 100644
--- a/lld/test/ELF/start-lib.s
+++ b/lld/test/ELF/start-lib.s
@@ -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
@@ -32,3 +34,4 @@
 
 .globl _start
 _start:
+  callq eager

@nico nico merged commit b05071d into llvm:main Dec 19, 2024
11 checks passed
@nico nico deleted the lld-elf-test branch December 19, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants