[lld] r282014 - Make test less dependent on the section order.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 13:48:54 PDT 2016


Author: rafael
Date: Tue Sep 20 15:48:54 2016
New Revision: 282014

URL: http://llvm.org/viewvc/llvm-project?rev=282014&view=rev
Log:
Make test less dependent on the section order.

This means either relaxing CHECKs or listing more sections and
addresses in linker scripts.

Modified:
    lld/trunk/test/ELF/arm-thumb-interwork-thunk.s
    lld/trunk/test/ELF/linkerscript/align-empty.s
    lld/trunk/test/ELF/linkerscript/common.s
    lld/trunk/test/ELF/linkerscript/data-segment-relro.s
    lld/trunk/test/ELF/linkerscript/multi-sections-constraint.s
    lld/trunk/test/ELF/linkerscript/repsection-va.s
    lld/trunk/test/ELF/linkerscript/sections-constraint.s
    lld/trunk/test/ELF/linkerscript/symbols-synthetic.s

Modified: lld/trunk/test/ELF/arm-thumb-interwork-thunk.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-thumb-interwork-thunk.s?rev=282014&r1=282013&r2=282014&view=diff
==============================================================================
--- lld/trunk/test/ELF/arm-thumb-interwork-thunk.s (original)
+++ lld/trunk/test/ELF/arm-thumb-interwork-thunk.s Tue Sep 20 15:48:54 2016
@@ -6,7 +6,8 @@
 // RUN:       .arm_caller : { *(.arm_caller) } \
 // RUN:       .thumb_caller : { *(.thumb_caller) } \
 // RUN:       .R_ARM_JUMP24_callee_2 : { *(.R_ARM_JUMP24_callee_high) } \
-// RUN:       .R_ARM_THM_JUMP_callee_2 : { *(.R_ARM_THM_JUMP_callee_high) } } " > %t.script
+// RUN:       .R_ARM_THM_JUMP_callee_2 : { *(.R_ARM_THM_JUMP_callee_high) } \
+// RUN:       .got.plt 0x1894 : {  }  } " > %t.script
 // RUN: ld.lld --script %t.script %t -o %t2 2>&1
 // RUN: llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-THUMB -check-prefix=CHECK-ABS-THUMB %s
 // RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-ARM -check-prefix=CHECK-ABS-ARM %s

Modified: lld/trunk/test/ELF/linkerscript/align-empty.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/align-empty.s?rev=282014&r1=282013&r2=282014&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/align-empty.s (original)
+++ lld/trunk/test/ELF/linkerscript/align-empty.s Tue Sep 20 15:48:54 2016
@@ -4,11 +4,14 @@
 # RUN: echo "SECTIONS { \
 # RUN:  abc : { } \
 # RUN:  . = ALIGN(0x1000); \
-# RUN:  .text : { *(.text) } \
+# RUN:  foo : { *(foo) } \
 # RUN: }" > %t.script
 # RUN: ld.lld -o %t1 --script %t.script %t -shared
 # RUN: llvm-objdump -section-headers %t1 | FileCheck %s
 # CHECK:      Sections:
 # CHECK-NEXT: Idx Name          Size      Address
 # CHECK-NEXT:   0               00000000 0000000000000000
-# CHECK-NEXT:   1 .text         00000000 0000000000001000
+# CHECK-NEXT:   1 foo           00000001 0000000000001000
+
+        .section foo, "a"
+        .byte 0

Modified: lld/trunk/test/ELF/linkerscript/common.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/common.s?rev=282014&r1=282013&r2=282014&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/common.s (original)
+++ lld/trunk/test/ELF/linkerscript/common.s Tue Sep 20 15:48:54 2016
@@ -7,15 +7,15 @@
 # q2 alignment is greater than q1, so it should have smaller offset
 # because of sorting
 # CHECK:       Section {
-# CHECK:         Index: 1
-# CHECK-NEXT:    Name: .common (1)
-# CHECK-NEXT:    Type: SHT_NOBITS (0x8)
-# CHECK-NEXT:    Flags [ (0x3)
-# CHECK-NEXT:      SHF_ALLOC (0x2)
-# CHECK-NEXT:      SHF_WRITE (0x1)
+# CHECK:         Index:
+# CHECK:         Name: .common
+# CHECK-NEXT:    Type: SHT_NOBITS
+# CHECK-NEXT:    Flags [
+# CHECK-NEXT:      SHF_ALLOC
+# CHECK-NEXT:      SHF_WRITE
 # CHECK-NEXT:    ]
 # CHECK-NEXT:    Address: 0x200
-# CHECK-NEXT:    Offset: 0x158
+# CHECK-NEXT:    Offset: 0x
 # CHECK-NEXT:    Size: 256
 # CHECK-NEXT:    Link: 0
 # CHECK-NEXT:    Info: 0
@@ -23,22 +23,22 @@
 # CHECK-NEXT:    EntrySize: 0
 # CHECK-NEXT:  }
 # CHECK:       Symbol {
-# CHECK:         Name: q1 (8)
+# CHECK:         Name: q1
 # CHECK-NEXT:    Value: 0x280
 # CHECK-NEXT:    Size: 128
-# CHECK-NEXT:    Binding: Global (0x1)
-# CHECK-NEXT:    Type: Object (0x1)
+# CHECK-NEXT:    Binding: Global
+# CHECK-NEXT:    Type: Object
 # CHECK-NEXT:    Other: 0
-# CHECK-NEXT:    Section: .common (0x1)
+# CHECK-NEXT:    Section: .common
 # CHECK-NEXT:  }
 # CHECK-NEXT:  Symbol {
-# CHECK-NEXT:    Name: q2 (11)
+# CHECK-NEXT:    Name: q2
 # CHECK-NEXT:    Value: 0x200
 # CHECK-NEXT:    Size: 128
-# CHECK-NEXT:    Binding: Global (0x1)
-# CHECK-NEXT:    Type: Object (0x1)
+# CHECK-NEXT:    Binding: Global
+# CHECK-NEXT:    Type: Object
 # CHECK-NEXT:    Other: 0
-# CHECK-NEXT:    Section: .common (0x1)
+# CHECK-NEXT:    Section: .common
 # CHECK-NEXT:  }
 
 .globl _start

Modified: lld/trunk/test/ELF/linkerscript/data-segment-relro.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/data-segment-relro.s?rev=282014&r1=282013&r2=282014&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/data-segment-relro.s (original)
+++ lld/trunk/test/ELF/linkerscript/data-segment-relro.s Tue Sep 20 15:48:54 2016
@@ -24,8 +24,8 @@
 # RUN: llvm-readobj -s %t2 | FileCheck %s
 
 # CHECK:       Section {
-# CHECK:         Index: 4
-# CHECK-NEXT:    Name: .got
+# CHECK:         Index:
+# CHECK:         Name: .got
 # CHECK-NEXT:    Type: SHT_PROGBITS
 # CHECK-NEXT:    Flags [
 # CHECK-NEXT:      SHF_ALLOC
@@ -40,7 +40,7 @@
 # CHECK-NEXT:    EntrySize:
 # CHECK-NEXT:  }
 # CHECK-NEXT:  Section {
-# CHECK-NEXT:    Index: 5
+# CHECK-NEXT:    Index:
 # CHECK-NEXT:    Name: .got.plt
 # CHECK-NEXT:    Type: SHT_PROGBITS
 # CHECK-NEXT:    Flags [

Modified: lld/trunk/test/ELF/linkerscript/multi-sections-constraint.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/multi-sections-constraint.s?rev=282014&r1=282013&r2=282014&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/multi-sections-constraint.s (original)
+++ lld/trunk/test/ELF/linkerscript/multi-sections-constraint.s Tue Sep 20 15:48:54 2016
@@ -1,6 +1,7 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: echo "SECTIONS { \
+# RUN:  .text : { *(.text) } \
 # RUN:  . = 0x1000; .aaa : ONLY_IF_RO { *(.aaa.*) } \
 # RUN:  . = 0x2000; .aaa : ONLY_IF_RW { *(.aaa.*) } } " > %t.script
 # RUN: ld.lld -o %t1 --script %t.script %t
@@ -8,14 +9,11 @@
 
 # CHECK:      Sections:
 # CHECK-NEXT: Idx Name          Size      Address          Type
-# CHECK-NEXT:   0               00000000 0000000000000000
-# CHECK-NEXT:   1 .aaa          00000010 0000000000002000 DATA
-# CHECK-NEXT:   2 .text         00000001 0000000000002010 TEXT DATA
-# CHECK-NEXT:   3 .symtab       00000030 0000000000000000
-# CHECK-NEXT:   4 .shstrtab     00000026 0000000000000000
-# CHECK-NEXT:   5 .strtab       00000008 0000000000000000
+# CHECK: .aaa          00000010 0000000000002000 DATA
+
 
 # RUN: echo "SECTIONS { \
+# RUN:  .text : { *(.text) } \
 # RUN:  . = 0x1000; .aaa : ONLY_IF_RW { *(.aaa.*) } \
 # RUN:  . = 0x2000; .aaa : ONLY_IF_RO { *(.aaa.*) } } " > %t2.script
 # RUN: ld.lld -o %t2 --script %t2.script %t
@@ -23,12 +21,7 @@
 
 # REV:      Sections:
 # REV-NEXT: Idx Name          Size      Address          Type
-# REV-NEXT:   0               00000000 0000000000000000
-# REV-NEXT:   1 .aaa          00000010 0000000000001000 DATA
-# REV-NEXT:   2 .text         00000001 0000000000002000 TEXT DATA
-# REV-NEXT:   3 .symtab       00000030 0000000000000000
-# REV-NEXT:   4 .shstrtab     00000026 0000000000000000
-# REV-NEXT:   5 .strtab       00000008 0000000000000000
+# REV:  .aaa          00000010 0000000000001000 DATA
 
 .global _start
 _start:

Modified: lld/trunk/test/ELF/linkerscript/repsection-va.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/repsection-va.s?rev=282014&r1=282013&r2=282014&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/repsection-va.s (original)
+++ lld/trunk/test/ELF/linkerscript/repsection-va.s Tue Sep 20 15:48:54 2016
@@ -6,9 +6,10 @@
 # RUN: llvm-objdump -section-headers %t1 | FileCheck %s
 # CHECK:      Sections:
 # CHECK-NEXT: Idx Name          Size      Address          Type
-# CHECK-NEXT:   0               00000000 0000000000000000
-# CHECK-NEXT:   1 .foo          00000008 0000000000000158 DATA
-# CHECK-NEXT:   2 .text         00000001 0000000000000160 TEXT DATA
+# CHECK-NOT: .foo
+# CHECK:  .foo          00000008 {{.*}} DATA
+# CHECK-NOT: .foo
+
 
 .global _start
 _start:

Modified: lld/trunk/test/ELF/linkerscript/sections-constraint.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/sections-constraint.s?rev=282014&r1=282013&r2=282014&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/sections-constraint.s (original)
+++ lld/trunk/test/ELF/linkerscript/sections-constraint.s Tue Sep 20 15:48:54 2016
@@ -9,8 +9,8 @@
 # BASE: Sections:
 # BASE-NEXT: Idx Name          Size
 # BASE-NEXT:   0               00000000
-# BASE-NEXT:   1 .writable     00000004
-# BASE-NEXT:   2 .readable     00000004
+# BASE:   .writable     00000004
+# BASE:   .readable     00000004
 
 # RUN: echo "SECTIONS { \
 # RUN:  .foo : ONLY_IF_RO { *(.foo.*) } \
@@ -22,11 +22,10 @@
 # NO1: Sections:
 # NO1-NEXT: Idx Name          Size
 # NO1-NEXT: 0               00000000
-# NO1-NEXT: 1 .writable     00000004
-# NO1-NEXT: 2 .readable     00000004
-# NO1-NEXT: 3 .text         00000001
-# NO1-NEXT: 4 .foo.2        00000004
-# NO1-NEXT: 5 .foo.1        00000004
+# NO1:  .writable     00000004
+# NO1:  .readable     00000004
+# NO1:  .foo.2        00000004
+# NO1:  .foo.1        00000004
 
 .global _start
 _start:

Modified: lld/trunk/test/ELF/linkerscript/symbols-synthetic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/symbols-synthetic.s?rev=282014&r1=282013&r2=282014&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/symbols-synthetic.s (original)
+++ lld/trunk/test/ELF/linkerscript/symbols-synthetic.s Tue Sep 20 15:48:54 2016
@@ -25,6 +25,7 @@
 # RUN:             *(.eh_frame_hdr) \
 # RUN:             __eh_frame_hdr_end = .; \
 # RUN:             __eh_frame_hdr_end2 = ABSOLUTE(ALIGN(0x10)); } \
+# RUN:          .eh_frame : { } \
 # RUN:       }" > %t.script
 # RUN: ld.lld -o %t1 --eh-frame-hdr --script %t.script %t
 # RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=SIMPLE %s




More information about the llvm-commits mailing list