[lld] aad2238 - [ELF] Improve INCLUDE cycle tests
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 27 17:14:58 PDT 2024
Author: Fangrui Song
Date: 2024-07-27T17:14:53-07:00
New Revision: aad2238f786c0bd8deade0dc68cfc3811c7633df
URL: https://github.com/llvm/llvm-project/commit/aad2238f786c0bd8deade0dc68cfc3811c7633df
DIFF: https://github.com/llvm/llvm-project/commit/aad2238f786c0bd8deade0dc68cfc3811c7633df.diff
LOG: [ELF] Improve INCLUDE cycle tests
And demonstrate the incorrect diagnostic when a linker script is
included multiple times (#93947).
Added:
Modified:
lld/test/ELF/linkerscript/include-cycle.s
Removed:
################################################################################
diff --git a/lld/test/ELF/linkerscript/include-cycle.s b/lld/test/ELF/linkerscript/include-cycle.s
index e93ed904f05a3..bbd4cfb9b65d5 100644
--- a/lld/test/ELF/linkerscript/include-cycle.s
+++ b/lld/test/ELF/linkerscript/include-cycle.s
@@ -1,15 +1,30 @@
# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
-# RUN: echo "INCLUDE \"%t1.script\"" > %t1.script
-# RUN: not ld.lld %t.o %t1.script 2>&1 | FileCheck %s
+# RUN: not ld.lld a.o -T 1.lds 2>&1 | FileCheck %s --check-prefix=ERR1
+# ERR1: error: 1.lds:1: there is a cycle in linker script INCLUDEs
-# RUN: echo "INCLUDE \"%t2.script\"" > %t1.script
-# RUN: echo "INCLUDE \"%t1.script\"" > %t2.script
-# RUN: not ld.lld %t.o %t1.script 2>&1 | FileCheck %s
+# RUN: not ld.lld a.o -T 2a.lds 2>&1 | FileCheck %s --check-prefix=ERR2
+# ERR2: error: 2a.lds:1: there is a cycle in linker script INCLUDEs
-# CHECK: there is a cycle in linker script INCLUDEs
+# RUN: not ld.lld a.o -T 3.lds 2>&1 | FileCheck %s --check-prefix=ERR3
+# ERR3: error: 3.lds:2: there is a cycle in linker script INCLUDEs
+#--- 0.lds
+BYTE(42)
+#--- 1.lds
+INCLUDE "1.lds"
+#--- 2a.lds
+INCLUDE "2b.lds"
+#--- 2b.lds
+INCLUDE "2a.lds"
+#--- 3.lds
+SECTIONS {
+ foo : { INCLUDE "0.lds" INCLUDE "0.lds" }
+}
+
+#--- a.s
.globl _start
_start:
ret
More information about the llvm-commits
mailing list