[lld] a892c0e - [ELF][test] Improve test coverage
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 25 11:57:59 PDT 2021
Author: Fangrui Song
Date: 2021-09-25T11:57:54-07:00
New Revision: a892c0e49e8de6daf141af23b396cf21b4471299
URL: https://github.com/llvm/llvm-project/commit/a892c0e49e8de6daf141af23b396cf21b4471299
DIFF: https://github.com/llvm/llvm-project/commit/a892c0e49e8de6daf141af23b396cf21b4471299.diff
LOG: [ELF][test] Improve test coverage
Added:
lld/test/ELF/start-group.s
Modified:
lld/test/ELF/common-page.s
lld/test/ELF/linkerscript/memory-err.s
lld/test/ELF/warn-backrefs.s
Removed:
################################################################################
diff --git a/lld/test/ELF/common-page.s b/lld/test/ELF/common-page.s
index bdde23feecfba..a11b6993d3607 100644
--- a/lld/test/ELF/common-page.s
+++ b/lld/test/ELF/common-page.s
@@ -221,3 +221,8 @@ _start:
# CHECK-COMMON-NEXT: PF_W (0x2)
# CHECK-COMMON-NEXT: ]
# CHECK-COMMON-NEXT: Alignment: 0
+
+# RUN: not ld.lld -z max-page-size=0x10001 -z common-page-size=0x1001 %t -o /dev/null 2>&1 | FileCheck %s --check-prefix=INVALID
+
+# INVALID: error: max-page-size: value isn't a power of 2
+# INVALID-NEXT: error: common-page-size: value isn't a power of 2
diff --git a/lld/test/ELF/linkerscript/memory-err.s b/lld/test/ELF/linkerscript/memory-err.s
index 214b618f4ec0f..0b1a077176adf 100644
--- a/lld/test/ELF/linkerscript/memory-err.s
+++ b/lld/test/ELF/linkerscript/memory-err.s
@@ -35,6 +35,9 @@
# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR5 %s
# ERR5: error: memory region 'ram' not declared
+# RUN: echo 'SECTIONS { .text : { *(.text) } AT> ram }' > %t.script
+# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR5 %s
+
## Check region overflow.
# RUN: echo 'MEMORY { ram (rwx) : ORIGIN = 0, LENGTH = 2K } \
diff --git a/lld/test/ELF/start-group.s b/lld/test/ELF/start-group.s
new file mode 100644
index 0000000000000..724ca16c60456
--- /dev/null
+++ b/lld/test/ELF/start-group.s
@@ -0,0 +1,13 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+
+# RUN: not ld.lld --start-group --start-group %t.o 2>&1 | FileCheck %s --check-prefix=NESTED
+# NESTED: nested --start-group
+
+# RUN: not ld.lld --end-group 2>&1 | FileCheck %s --check-prefix=END
+# RUN: not ld.lld '-)' 2>&1 | FileCheck %s --check-prefix=END
+# END: stray --end-group
+
+.globl _start
+_start:
diff --git a/lld/test/ELF/warn-backrefs.s b/lld/test/ELF/warn-backrefs.s
index b34f1d67edd6e..a6866869054a4 100644
--- a/lld/test/ELF/warn-backrefs.s
+++ b/lld/test/ELF/warn-backrefs.s
@@ -31,6 +31,7 @@
# RUN: echo 'GROUP("%t2.a" "%t1.o")' > %t2.lds
# RUN: ld.lld --fatal-warnings --warn-backrefs %t2.lds -o /dev/null
# RUN: ld.lld --fatal-warnings --warn-backrefs '-(' %t2.a %t1.o '-)' -o /dev/null
+# RUN: ld.lld --fatal-warnings --warn-backrefs --start-group %t2.a %t1.o --end-group -o /dev/null
## A backward reference from %t1.o to %t2.a (added by %t3.lds).
# RUN: echo 'GROUP("%t2.a")' > %t3.lds
More information about the llvm-commits
mailing list