From: Fangrui Song Date: Fri, 1 May 2020 18:04:20 +0000 (-0700) Subject: [ELF][test] Improve tests X-Git-Tag: llvmorg-12-init~7201 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c86b08a6f62e67b0a6cbbee3f70a2b009daa857;p=platform%2Fupstream%2Fllvm.git [ELF][test] Improve tests Prepare for the upcomong change that removes unneeded sh_offset advancement for empty sections whose PT_LOAD are removed. --- diff --git a/lld/test/ELF/linkerscript/empty-sections-expressions.test b/lld/test/ELF/linkerscript/empty-sections-expressions.test index 3f1da48..ebc43f4 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 051f3f9..682190c 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