[ELF][test] Improve test coverage

This commit is contained in:
Fangrui Song 2021-09-25 11:57:54 -07:00
parent 99951a5684
commit a892c0e49e
4 changed files with 22 additions and 0 deletions

View File

@ -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

View File

@ -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 } \

View File

@ -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:

View File

@ -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