[lld] 5c86b08 - [ELF][test] Improve tests
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri May 1 11:28:06 PDT 2020
Author: Fangrui Song
Date: 2020-05-01T11:27:51-07:00
New Revision: 5c86b08a6f62e67b0a6cbbee3f70a2b009daa857
URL: https://github.com/llvm/llvm-project/commit/5c86b08a6f62e67b0a6cbbee3f70a2b009daa857
DIFF: https://github.com/llvm/llvm-project/commit/5c86b08a6f62e67b0a6cbbee3f70a2b009daa857.diff
LOG: [ELF][test] Improve tests
Prepare for the upcomong change that removes unneeded sh_offset
advancement for empty sections whose PT_LOAD are removed.
Added:
Modified:
lld/test/ELF/linkerscript/empty-sections-expressions.test
lld/test/ELF/linkerscript/nobits-offset.s
Removed:
################################################################################
diff --git a/lld/test/ELF/linkerscript/empty-sections-expressions.test b/lld/test/ELF/linkerscript/empty-sections-expressions.test
index 3f1da48f325a..ebc43f453a32 100644
--- a/lld/test/ELF/linkerscript/empty-sections-expressions.test
+++ b/lld/test/ELF/linkerscript/empty-sections-expressions.test
@@ -2,19 +2,25 @@
# RUN: echo ".text; nop; .data; .byte 0" \
# RUN: | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t.o
# RUN: ld.lld -o %t --script %s %t.o
-# RUN: llvm-readelf -program-headers %t | FileCheck %s
+# RUN: llvm-readelf -S -l %t | FileCheck %s
## Check we do not remove the empty output sections used in LOADADDR/ADDR
## expressions and hence can evaluate the correct addresses.
+# CHECK: Name Type Address Off Size
+# CHECK-NEXT: NULL 0000000000000000 000000 000000
+# CHECK-NEXT: .empty PROGBITS 0000000000080000 001000 000000
+# CHECK-NEXT: .text PROGBITS 0000000000080000 001000 000001
+# CHECK-NEXT: .data PROGBITS 0000000000080001 001001 000001
+
# CHECK: Program Headers:
# CHECK-NEXT: Type Offset VirtAddr PhysAddr
# CHECK-NEXT: LOAD 0x001000 0x0000000000080000 0x0000000000080000
# CHECK-NEXT: LOAD 0x001001 0x0000000000080001 0x0000000000082000
# CHECK: Section to Segment mapping:
-# CHECK: 00 .empty .text
-# CHECK-NEXT: 01 .data
+# CHECK: 00 .empty .text {{$}}
+# CHECK-NEXT: 01 .data {{$}}
SECTIONS {
. = 0x00080000;
diff --git a/lld/test/ELF/linkerscript/nobits-offset.s b/lld/test/ELF/linkerscript/nobits-offset.s
index 051f3f99da3b..682190c0d78f 100644
--- a/lld/test/ELF/linkerscript/nobits-offset.s
+++ b/lld/test/ELF/linkerscript/nobits-offset.s
@@ -12,13 +12,16 @@
## sh_offset to sh_addr modulo max-page-size, so that p_vaddr=p_offset (mod
## p_align).
-# CHECK: Name Type Address Off Size ES Flg Lk Inf Al
-# CHECK: .bss NOBITS 0000000000000400 001400 000001 00 WA 0 0 1024
+# CHECK: Name Type Address Off Size
+# CHECK-NEXT: NULL 0000000000000000 000000 000000
+# CHECK-NEXT: .text PROGBITS 0000000000000000 001000 000000
+# CHECK-NEXT: .sec1 NOBITS 0000000000000000 001000 000001
+# CHECK-NEXT: .bss NOBITS 0000000000000400 001400 000001
-# CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
-# CHECK: LOAD 0x001400 0x0000000000000400 0x0000000000000400 0x000000 0x000001 RW 0x1000
+# CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
+# CHECK-NEXT: LOAD 0x001400 0x0000000000000400 0x0000000000000400 0x000000 0x000001 RW 0x1000
-# CHECK: 00 .bss
+# CHECK: 00 .bss {{$}}
.bss
.p2align 10
More information about the llvm-commits
mailing list