Skip to content

Commit

Permalink
[ELF][test] Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Sep 25, 2021
1 parent 99951a5 commit a892c0e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lld/test/ELF/common-page.s
Expand Up @@ -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
3 changes: 3 additions & 0 deletions lld/test/ELF/linkerscript/memory-err.s
Expand Up @@ -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 } \
Expand Down
13 changes: 13 additions & 0 deletions 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:
1 change: 1 addition & 0 deletions lld/test/ELF/warn-backrefs.s
Expand Up @@ -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
Expand Down

0 comments on commit a892c0e

Please sign in to comment.