[llvm-branch-commits] [lld] a85165c - [ELF][test] Make tests less address sensitive and delete redundant tests

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 16 19:46:00 PDT 2020


Author: Fangrui Song
Date: 2020-06-16T19:44:57-07:00
New Revision: a85165ccb9cf05a31a9e33defdd9baff5a6d55f7

URL: https://github.com/llvm/llvm-project/commit/a85165ccb9cf05a31a9e33defdd9baff5a6d55f7
DIFF: https://github.com/llvm/llvm-project/commit/a85165ccb9cf05a31a9e33defdd9baff5a6d55f7.diff

LOG: [ELF][test] Make tests less address sensitive and delete redundant tests

(cherry picked from commit 09ac859c136b406231ef7547f3800111dd00bc7e)

Added: 
    

Modified: 
    lld/test/ELF/linkerscript/common-assign.s
    lld/test/ELF/linkerscript/double-bss.test
    lld/test/ELF/linkerscript/merge-sections-syms.s
    lld/test/ELF/linkerscript/noload.s
    lld/test/ELF/linkerscript/rosegment.test
    lld/test/ELF/many-alloc-sections.s

Removed: 
    lld/test/ELF/linkerscript/at-self-reference.s


################################################################################
diff  --git a/lld/test/ELF/linkerscript/at-self-reference.s b/lld/test/ELF/linkerscript/at-self-reference.s
deleted file mode 100644
index 87b8cfb42b41..000000000000
--- a/lld/test/ELF/linkerscript/at-self-reference.s
+++ /dev/null
@@ -1,63 +0,0 @@
-# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: echo "SECTIONS { \
-# RUN:  . = 0x1000; \
-# RUN:  .aaa : AT(ADDR(.aaa)) { *(.aaa) } \
-# RUN:  .bbb : AT(ADDR(.bbb)) { *(.bbb) } \
-# RUN: }" > %t.script
-# RUN: ld.lld %t --script %t.script -o %t2
-# RUN: llvm-readobj -l %t2 | FileCheck %s
-
-# CHECK:      ProgramHeaders [
-# CHECK-NEXT:  ProgramHeader {
-# CHECK-NEXT:    Type: PT_LOAD (0x1)
-# CHECK-NEXT:    Offset: 0x1000
-# CHECK-NEXT:    VirtualAddress: 0x1000
-# CHECK-NEXT:    PhysicalAddress: 0x1000
-# CHECK-NEXT:    FileSize: 3
-# CHECK-NEXT:    MemSize: 3
-# CHECK-NEXT:    Flags [ (0x5)
-# CHECK-NEXT:      PF_R (0x4)
-# CHECK-NEXT:      PF_X (0x1)
-# CHECK-NEXT:    ]
-# CHECK-NEXT:    Alignment: 4096
-# CHECK-NEXT:  }
-# CHECK-NEXT:  ProgramHeader {
-# CHECK-NEXT:    Type: PT_LOAD (0x1)
-# CHECK-NEXT:    Offset: 0x1008
-# CHECK-NEXT:    VirtualAddress: 0x1008
-# CHECK-NEXT:    PhysicalAddress: 0x1008
-# CHECK-NEXT:    FileSize: 9
-# CHECK-NEXT:    MemSize: 9
-# CHECK-NEXT:    Flags [ (0x5)
-# CHECK-NEXT:      PF_R (0x4)
-# CHECK-NEXT:      PF_X (0x1)
-# CHECK-NEXT:    ]
-# CHECK-NEXT:    Alignment: 4096
-# CHECK-NEXT:  }
-# CHECK-NEXT:  ProgramHeader {
-# CHECK-NEXT:    Type: PT_GNU_STACK (0x6474E551)
-# CHECK-NEXT:    Offset: 0x0
-# CHECK-NEXT:    VirtualAddress: 0x0
-# CHECK-NEXT:    PhysicalAddress: 0x0
-# CHECK-NEXT:    FileSize: 0
-# CHECK-NEXT:    MemSize: 0
-# CHECK-NEXT:    Flags [ (0x6)
-# CHECK-NEXT:      PF_R (0x4)
-# CHECK-NEXT:      PF_W (0x2)
-# CHECK-NEXT:    ]
-# CHECK-NEXT:    Alignment: 0
-# CHECK-NEXT:  }
-# CHECK-NEXT:]
-
-.global _start
-_start:
- nop
-
-
-.section .aaa, "a"
-.asciz "aa"
-
-.section .bbb, "a"
-.align 8
-.quad 0

diff  --git a/lld/test/ELF/linkerscript/common-assign.s b/lld/test/ELF/linkerscript/common-assign.s
index 4b8ad2cf3b24..ef0ad14ce92d 100644
--- a/lld/test/ELF/linkerscript/common-assign.s
+++ b/lld/test/ELF/linkerscript/common-assign.s
@@ -6,7 +6,7 @@
 
 # CHECK:       Symbol {
 # CHECK:         Name: bar
-# CHECK-NEXT:     Value: 0x134
+# CHECK-NEXT:     Value: [[BAR:.*]]
 # CHECK-NEXT:     Size: 4
 # CHECK-NEXT:     Binding: Global
 # CHECK-NEXT:     Type: Object
@@ -15,7 +15,7 @@
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Symbol {
 # CHECK-NEXT:     Name: foo
-# CHECK-NEXT:     Value: 0x138
+# CHECK-NEXT:     Value: [[FOO:.*]]
 # CHECK-NEXT:     Size: 4
 # CHECK-NEXT:     Binding: Global
 # CHECK-NEXT:     Type: Object
@@ -24,7 +24,7 @@
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Symbol {
 # CHECK-NEXT:     Name: pfoo
-# CHECK-NEXT:     Value: 0x138
+# CHECK-NEXT:     Value: [[FOO]]
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Binding: Global
 # CHECK-NEXT:     Type: None
@@ -33,7 +33,7 @@
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Symbol {
 # CHECK-NEXT:     Name: pbar
-# CHECK-NEXT:     Value: 0x134
+# CHECK-NEXT:     Value: [[BAR]]
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Binding: Global
 # CHECK-NEXT:     Type: None

diff  --git a/lld/test/ELF/linkerscript/double-bss.test b/lld/test/ELF/linkerscript/double-bss.test
index 32b796d01c2e..7a7a6519db49 100644
--- a/lld/test/ELF/linkerscript/double-bss.test
+++ b/lld/test/ELF/linkerscript/double-bss.test
@@ -2,9 +2,9 @@
 # RUN: echo '.short 0; .bss; .zero 4; .comm q,128,8' \
 # RUN:   | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t
 # RUN: ld.lld -o %t1 --script %s %t
-# RUN: llvm-objdump -section-headers %t1 | FileCheck %s
-# CHECK:      .bss1          00000004 0000000000000122 BSS
-# CHECK-NEXT: .bss2          00000080 0000000000000128 BSS
+# RUN: llvm-readelf -S %t1 | FileCheck %s
+# CHECK:      .bss1 NOBITS
+# CHECK-NEXT: .bss2 NOBITS
 
 SECTIONS {
   . = SIZEOF_HEADERS;

diff  --git a/lld/test/ELF/linkerscript/merge-sections-syms.s b/lld/test/ELF/linkerscript/merge-sections-syms.s
index 421749b6f1b9..229cfc6fcb13 100644
--- a/lld/test/ELF/linkerscript/merge-sections-syms.s
+++ b/lld/test/ELF/linkerscript/merge-sections-syms.s
@@ -6,38 +6,10 @@
 # RUN:   .rodata : { *(.aaa) *(.bbb) A = .; *(.ccc) B = .; } \
 # RUN: }" > %t.script
 # RUN: ld.lld -o %t.so --script %t.script %t.o -shared
-# RUN: llvm-readobj --dyn-symbols %t.so | FileCheck %s
-
-# CHECK:      DynamicSymbols [
-# CHECK-NEXT:   Symbol {
-# CHECK-NEXT:     Name:
-# CHECK-NEXT:     Value:
-# CHECK-NEXT:     Size:
-# CHECK-NEXT:     Binding:
-# CHECK-NEXT:     Type:
-# CHECK-NEXT:     Other:
-# CHECK-NEXT:     Section:
-# CHECK-NEXT:   }
-# CHECK-NEXT:   Symbol {
-# CHECK-NEXT:     Name: A
-# CHECK-NEXT:     Value: 0x226
-# CHECK-NEXT:     Size:
-# CHECK-NEXT:     Binding:
-# CHECK-NEXT:     Type:
-# CHECK-NEXT:     Other:
-# CHECK-NEXT:     Section:
-# CHECK-NEXT:   }
-# CHECK-NEXT:   Symbol {
-# CHECK-NEXT:     Name: B
-# CHECK-NEXT:     Value: 0x227
-# CHECK-NEXT:     Size:
-# CHECK-NEXT:     Binding:
-# CHECK-NEXT:     Type:
-# CHECK-NEXT:     Other:
-# CHECK-NEXT:     Section:
-# CHECK-NEXT:   }
-# CHECK-NEXT: ]
+# RUN: llvm-nm -D %t.so | FileCheck %s
 
+# CHECK: 0000000000000226 R A
+# CHECK: 0000000000000227 R B
 
 .section .aaa,"a"
 .byte 11

diff  --git a/lld/test/ELF/linkerscript/noload.s b/lld/test/ELF/linkerscript/noload.s
index 18b509134afc..eb6ace45adcd 100644
--- a/lld/test/ELF/linkerscript/noload.s
+++ b/lld/test/ELF/linkerscript/noload.s
@@ -5,53 +5,14 @@
 # RUN:        .data_noload_b (0x10000) (NOLOAD) : { *(.data_noload_b) } \
 # RUN:        .text (0x20000) : { *(.text) } };" > %t.script
 # RUN: ld.lld -o %t --script %t.script %t.o
-# RUN: llvm-readobj --sections -l  %t | FileCheck %s
+# RUN: llvm-readelf -S -l %t | FileCheck %s
 
-# CHECK:      Section {
-# CHECK:        Index: 1
-# CHECK-NEXT:   Name: .data_noload_a
-# CHECK-NEXT:   Type: SHT_NOBITS
-# CHECK-NEXT:   Flags [
-# CHECK-NEXT:     SHF_ALLOC
-# CHECK-NEXT:     SHF_WRITE
-# CHECK-NEXT:   ]
-# CHECK-NEXT:   Address: 0x0
-# CHECK-NEXT:   Offset: 0xE8
-# CHECK-NEXT:   Size: 4096
-# CHECK-NEXT:   Link: 0
-# CHECK-NEXT:   Info: 0
-# CHECK-NEXT:   AddressAlignment: 1
-# CHECK-NEXT:   EntrySize: 0
-# CHECK-NEXT: }
-# CHECK-NEXT: Section {
-# CHECK-NEXT:   Index: 2
-# CHECK-NEXT:   Name: .data_noload_b
-# CHECK-NEXT:   Type: SHT_NOBITS
-# CHECK-NEXT:   Flags [
-# CHECK-NEXT:     SHF_ALLOC
-# CHECK-NEXT:     SHF_WRITE
-# CHECK-NEXT:   ]
-# CHECK-NEXT:   Address: 0x10000
-# CHECK-NEXT:   Offset: 0xE8
-# CHECK-NEXT:   Size: 4096
-# CHECK-NEXT:   Link: 0
-# CHECK-NEXT:   Info: 0
-# CHECK-NEXT:   AddressAlignment: 1
-# CHECK-NEXT:   EntrySize: 0
-# CHECK-NEXT: }
-# CHECK:      ProgramHeader {
-# CHECK-NEXT:   Type: PT_LOAD (0x1)
-# CHECK-NEXT:   Offset: 0x1000
-# CHECK-NEXT:   VirtualAddress: 0x20000
-# CHECK-NEXT:   PhysicalAddress: 0x20000
-# CHECK-NEXT:   FileSize: 1
-# CHECK-NEXT:   MemSize: 1
-# CHECK-NEXT:   Flags [ (0x5)
-# CHECK-NEXT:     PF_R (0x4)
-# CHECK-NEXT:     PF_X (0x1)
-# CHECK-NEXT:   ]
-# CHECK-NEXT:   Alignment: 4096
-# CHECK-NEXT: }
+# CHECK:      Name           Type   Address          Off               Size
+# CHECK:      .data_noload_a NOBITS 0000000000000000 [[OFF:[0-9a-f]+]] 001000
+# CHECK-NEXT: .data_noload_b NOBITS 0000000000010000 [[OFF]]           001000
+
+# CHECK:      Type Offset   VirtAddr           PhysAddr
+# CHECK-NEXT: LOAD 0x001000 0x0000000000020000 0x0000000000020000
 
 .section .text,"ax", at progbits
   nop

diff  --git a/lld/test/ELF/linkerscript/rosegment.test b/lld/test/ELF/linkerscript/rosegment.test
index 41479e609d24..72b9414daca1 100644
--- a/lld/test/ELF/linkerscript/rosegment.test
+++ b/lld/test/ELF/linkerscript/rosegment.test
@@ -4,23 +4,11 @@
 # Test that with linker scripts we don't create a RO PT_LOAD.
 
 # RUN: ld.lld -o %t1 --script %s %t -shared
-# RUN: llvm-readobj -l %t1 | FileCheck %s
+# RUN: llvm-readelf -l %t1 | FileCheck %s
 
 SECTIONS {
 }
 
-# CHECK-NOT:  Type: PT_LOAD
-
-# CHECK:      Type: PT_LOAD
-# CHECK:      Flags [
-# CHECK-NEXT:   PF_R
-# CHECK-NEXT:   PF_X
-# CHECK-NEXT: ]
-
-# CHECK:      Type: PT_LOAD
-# CHECK:      Flags [
-# CHECK-NEXT:   PF_R
-# CHECK-NEXT:   PF_W
-# CHECK-NEXT: ]
-
-# CHECK-NOT:  Type: PT_LOAD
+# CHECK:      Type {{.*}} Flg Align
+# CHECK-NEXT: LOAD {{.*}} R E 0x1000
+# CHECK-NEXT: LOAD {{.*}} RW  0x1000

diff  --git a/lld/test/ELF/many-alloc-sections.s b/lld/test/ELF/many-alloc-sections.s
index 12c7a5ce3bc1..3b42dad87a90 100644
--- a/lld/test/ELF/many-alloc-sections.s
+++ b/lld/test/ELF/many-alloc-sections.s
@@ -6,7 +6,7 @@
 
 // Test that _start is in the correct section.
 // CHECK:      Name: _start
-// CHECK-NEXT: Value: 0x120
+// CHECK-NEXT: Value:
 // CHECK-NEXT: Size: 0
 // CHECK-NEXT: Binding: Global
 // CHECK-NEXT: Type: None


        


More information about the llvm-branch-commits mailing list