[lld] 1044ee8 - [ELF][test] Improve llvm-objdump -t tests

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 10:49:21 PST 2020


Author: Fangrui Song
Date: 2020-03-04T10:48:36-08:00
New Revision: 1044ee827af606bedd4d3dabd83414147ca33059

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

LOG: [ELF][test] Improve llvm-objdump -t tests

In many cases, llvm-nm or llvm-readelf is more suitable.

Added: 
    

Modified: 
    lld/test/ELF/end.s
    lld/test/ELF/gnu-ifunc-empty.s
    lld/test/ELF/linkerscript/alignof.test
    lld/test/ELF/linkerscript/early-assign-symbol.s
    lld/test/ELF/linkerscript/expr-sections.test
    lld/test/ELF/linkerscript/non-absolute2.test
    lld/test/ELF/linkerscript/operators.test
    lld/test/ELF/linkerscript/page-size.s
    lld/test/ELF/linkerscript/provide-shared.s
    lld/test/ELF/linkerscript/sizeof.s
    lld/test/ELF/linkerscript/sizeofheaders.s
    lld/test/ELF/linkerscript/symbol-assignexpr.s
    lld/test/ELF/linkerscript/symbol-conflict.s
    lld/test/ELF/linkerscript/symbol-memoryexpr.s
    lld/test/ELF/linkerscript/undef.s
    lld/test/ELF/relocatable-tls.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/end.s b/lld/test/ELF/end.s
index c10943d70488..e30f05ba9148 100644
--- a/lld/test/ELF/end.s
+++ b/lld/test/ELF/end.s
@@ -23,9 +23,9 @@
 // DEFAULT-NEXT:     Value: 0x202161
 // DEFAULT: ]
 
-// RUN: ld.lld -r %t.o -o %t2
-// RUN: llvm-objdump -t %t2 | FileCheck %s --check-prefix=RELOCATABLE
-// RELOCATABLE: 0000000000000000 *UND* 00000000 _end
+// RUN: ld.lld -r %t.o -o %t
+// RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=RELOCATABLE
+// RELOCATABLE: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _end
 
 .global _start,_end
 .text

diff  --git a/lld/test/ELF/gnu-ifunc-empty.s b/lld/test/ELF/gnu-ifunc-empty.s
index 90798532f973..b3efabd64e53 100644
--- a/lld/test/ELF/gnu-ifunc-empty.s
+++ b/lld/test/ELF/gnu-ifunc-empty.s
@@ -5,10 +5,13 @@
 
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: ld.lld -static %t.o -o %t.exe
-// RUN: llvm-objdump -syms %t.exe | FileCheck %s
+// RUN: llvm-readelf -S -s %t.exe | FileCheck %s
 
-// CHECK: 0000000000200000 .text 00000000 .hidden __rela_iplt_end
-// CHECK: 0000000000200000 .text 00000000 .hidden __rela_iplt_start
+// CHECK: Name  Type     Address          Off
+// CHECK: .text PROGBITS 0000000000201120 000120
+// CHECK:    Value         Size Type   Bind   Vis    Ndx Name
+// CHECK: 0000000000200000    0 NOTYPE LOCAL  HIDDEN   1 __rela_iplt_end
+// CHECK: 0000000000200000    0 NOTYPE LOCAL  HIDDEN   1 __rela_iplt_start
 
 .globl _start
 _start:

diff  --git a/lld/test/ELF/linkerscript/alignof.test b/lld/test/ELF/linkerscript/alignof.test
index 07263df44a02..6a3d16d6764a 100644
--- a/lld/test/ELF/linkerscript/alignof.test
+++ b/lld/test/ELF/linkerscript/alignof.test
@@ -1,11 +1,11 @@
 # REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/alignof.s -o %t
-# RUN: ld.lld -o %t1 --script %s %t
-# RUN: llvm-objdump -t %t1 | FileCheck %s
-# CHECK:      SYMBOL TABLE:
-# CHECK:      0000000000000008         *ABS*     00000000 _aaa
-# CHECK-NEXT: 0000000000000010         *ABS*     00000000 _bbb
-# CHECK-NEXT: 0000000000000020         *ABS*     00000000 _ccc
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/alignof.s -o %t.o
+# RUN: ld.lld -o %t --script %s %t.o
+# RUN: llvm-readelf -s %t | FileCheck %s
+# CHECK:         Value         Size Type   Bind   Vis     Ndx Name
+# CHECK:      0000000000000008    0 NOTYPE GLOBAL DEFAULT ABS _aaa
+# CHECK-NEXT: 0000000000000010    0 NOTYPE GLOBAL DEFAULT ABS _bbb
+# CHECK-NEXT: 0000000000000020    0 NOTYPE GLOBAL DEFAULT ABS _ccc
 
 SECTIONS {
   .aaa : { *(.aaa) }
@@ -19,6 +19,6 @@ SECTIONS {
 ## Check that we error out if trying to get alignment of
 ## section that does not exist.
 # RUN: echo "SECTIONS { _aaa = ALIGNOF(.foo); }" > %t.script
-# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR %s
 # ERR: {{.*}}.script:1: undefined section .foo

diff  --git a/lld/test/ELF/linkerscript/early-assign-symbol.s b/lld/test/ELF/linkerscript/early-assign-symbol.s
index 7271204221a3..056f3302a596 100644
--- a/lld/test/ELF/linkerscript/early-assign-symbol.s
+++ b/lld/test/ELF/linkerscript/early-assign-symbol.s
@@ -6,25 +6,25 @@
 
 # RUN: echo "SECTIONS { aaa = foo | 1; .text  : { *(.text*) } }" > %t3.script
 # RUN: ld.lld -o %t --script %t3.script %t.o
-# RUN: llvm-objdump -t %t | FileCheck --check-prefix=VAL1 %s
+# RUN: llvm-nm -p %t | FileCheck --check-prefix=VAL1 %s
 
-# VAL1: 0000000000000000 .text 00000000 foo
-# VAL1: 0000000000000001 .text 00000000 aaa
+# VAL1: 0000000000000000 T foo
+# VAL1: 0000000000000001 T aaa
 
 # RUN: echo "SECTIONS { aaa = ABSOLUTE(foo - 1) + 1; .text  : { *(.text*) } }" > %t.script
 # RUN: ld.lld -o %t --script %t.script %t.o
-# RUN: llvm-objdump -t %t | FileCheck --check-prefix=VAL %s
+# RUN: llvm-nm -p %t | FileCheck --check-prefix=VAL %s
 
 # RUN: echo "SECTIONS { aaa = 1 + ABSOLUTE(foo - 1); .text  : { *(.text*) } }" > %t.script
 # RUN: ld.lld -o %t --script %t.script %t.o
-# RUN: llvm-objdump -t %t | FileCheck --check-prefix=VAL %s
+# RUN: llvm-nm -p %t | FileCheck --check-prefix=VAL %s
 
 # RUN: echo "SECTIONS { aaa = ABSOLUTE(foo); .text  : { *(.text*) } }" > %t4.script
 # RUN: ld.lld -o %t --script %t4.script %t.o
-# RUN: llvm-objdump -t %t | FileCheck --check-prefix=VAL %s
+# RUN: llvm-nm -p %t | FileCheck --check-prefix=VAL %s
 
-# VAL: 0000000000000000 .text 00000000 foo
-# VAL: 0000000000000000 *ABS* 00000000 aaa
+# VAL: 0000000000000000 T foo
+# VAL: 0000000000000000 A aaa
 
 .section .text
 .globl foo

diff  --git a/lld/test/ELF/linkerscript/expr-sections.test b/lld/test/ELF/linkerscript/expr-sections.test
index 1d16cc2239e9..cb17e1b77538 100644
--- a/lld/test/ELF/linkerscript/expr-sections.test
+++ b/lld/test/ELF/linkerscript/expr-sections.test
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
 # RUN: ld.lld -o %t.so --script %s %t.o -shared
-# RUN: llvm-objdump -t -h %t.so | FileCheck %s
+# RUN: llvm-readelf -S -s %t.so | FileCheck %s
 
 SECTIONS {
   . = . + 4;
@@ -13,11 +13,12 @@ SECTIONS {
   }
 };
 
-# CHECK:  5 .text         00000000 000000000000014c
+# CHECK: [ 5] .text PROGBITS 000000000000014c
 
-# CHECK: 000000000000014d         .text		 00000000 foo1
-# CHECK: 000000000000014d         .text		 00000000 bar1
-# CHECK: 0000000000000000         .text		 00000000 foo2
-# CHECK: 0000000000000000         .text		 00000000 bar2
-# CHECK: 000000000000014d         .text		 00000000 foo3
-# CHECK: 000000000000014d         .text		 00000000 bar3
+# CHECK:    Value         Size Type   Bind   Vis     Ndx Name
+# CHECK: 000000000000014d    0 NOTYPE GLOBAL DEFAULT   5 foo1
+# CHECK: 000000000000014d    0 NOTYPE GLOBAL DEFAULT   5 bar1
+# CHECK: 0000000000000000    0 NOTYPE GLOBAL DEFAULT   5 foo2
+# CHECK: 0000000000000000    0 NOTYPE GLOBAL DEFAULT   5 bar2
+# CHECK: 000000000000014d    0 NOTYPE GLOBAL DEFAULT   5 foo3
+# CHECK: 000000000000014d    0 NOTYPE GLOBAL DEFAULT   5 bar3

diff  --git a/lld/test/ELF/linkerscript/non-absolute2.test b/lld/test/ELF/linkerscript/non-absolute2.test
index 2d08354a0369..a2e3e45f1eb5 100644
--- a/lld/test/ELF/linkerscript/non-absolute2.test
+++ b/lld/test/ELF/linkerscript/non-absolute2.test
@@ -1,17 +1,12 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux /dev/null -o %t1.o
 # RUN: ld.lld -shared %t1.o --script %s -o %t
-# RUN: llvm-objdump -section-headers -t %t | FileCheck %s
+# RUN: llvm-readelf -s %t | FileCheck %s
 
 SECTIONS {
   A = . + 0x1;
   . += 0x1000;
 }
 
-# CHECK:       Sections:
-# CHECK-NEXT:  Idx Name          Size     VMA
-# CHECK-NEXT:    0               00000000 0000000000000000
-# CHECK-NEXT:    1 .dynsym       00000030 0000000000001000
-# CHECK:         5 .text         00000000 000000000000106c
-
-# CHECK: 0000000000000001         .dynsym            00000000 A
+# CHECK:    Value         Size Type   Bind   Vis     Ndx Name
+# CHECK: 0000000000000001    0 NOTYPE GLOBAL DEFAULT   1 A

diff  --git a/lld/test/ELF/linkerscript/operators.test b/lld/test/ELF/linkerscript/operators.test
index 7a3c2565d5df..1d40c81321d9 100644
--- a/lld/test/ELF/linkerscript/operators.test
+++ b/lld/test/ELF/linkerscript/operators.test
@@ -1,7 +1,7 @@
 # REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t
-# RUN: ld.lld %t --script %s -o %t2
-# RUN: llvm-objdump -t %t2 | FileCheck %s
+# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o %t.o
+# RUN: ld.lld %t.o -T %s -o %t
+# RUN: llvm-nm -p %t | FileCheck %s
 
 SECTIONS {
   _start = .;
@@ -48,83 +48,83 @@ SECTIONS {
   logicalor4 = 1 || 1;
 }
 
-# CHECK: 00000000000006 *ABS* 00000000 plus
-# CHECK: 00000000000004 *ABS* 00000000 minus
-# CHECK: 00000000000003 *ABS* 00000000 div
-# CHECK: 00000000000006 *ABS* 00000000 mod
-# CHECK: 00000000000007 *ABS* 00000000 mul
-# CHECK: 00000000000005 *ABS* 00000000 nospace
-# CHECK: 00000000000015 *ABS* 00000000 braces
-# CHECK: 000000000000aa *ABS* 00000000 and
-# CHECK: 00000000000001 *ABS* 00000000 ternary1
-# CHECK: 00000000000002 *ABS* 00000000 ternary2
-# CHECK: 00000000000002 *ABS* 00000000 less
-# CHECK: 00000000000001 *ABS* 00000000 lesseq
-# CHECK: 00000000000002 *ABS* 00000000 greater
-# CHECK: 00000000000001 *ABS* 00000000 greatereq
-# CHECK: 00000000000001 *ABS* 00000000 eq
-# CHECK: 00000000000002 *ABS* 00000000 neq
-# CHECK: 00000000000003 *ABS* 00000000 plusassign
-# CHECK: 00000000000002 *ABS* 00000000 unary
-# CHECK: 00000000000020 *ABS* 00000000 lshift
-# CHECK: 0000000000001f *ABS* 00000000 rshift
-# CHECK: 00000000000009 *ABS* 00000000 precedence1
-# CHECK: 00000000000009 *ABS* 00000000 precedence2
-# CHECK: 00000000001000 *ABS* 00000000 maxpagesize
-# CHECK: 00000000001000 *ABS* 00000000 commonpagesize
-# CHECK: 0000000000ffff *ABS* 00000000 datasegmentalign
-# CHECK: 0000000000fff0 *ABS* 00000000 datasegmentalign2
-# CHECK: 0000000000ffe0 .text 00000000 minus_rel
-# CHECK: 0000000000fff0 *ABS* 00000000 minus_abs
-# CHECK: 00000000000016 *ABS* 00000000 max
-# CHECK: 0000000000000b *ABS* 00000000 min
-# CHECK: 00000000000000 *ABS* 00000000 logicaland1
-# CHECK: 00000000000000 *ABS* 00000000 logicaland2
-# CHECK: 00000000000000 *ABS* 00000000 logicaland3
-# CHECK: 00000000000001 *ABS* 00000000 logicaland4
-# CHECK: 00000000000000 *ABS* 00000000 logicalor1
-# CHECK: 00000000000001 *ABS* 00000000 logicalor2
-# CHECK: 00000000000001 *ABS* 00000000 logicalor3
-# CHECK: 00000000000001 *ABS* 00000000 logicalor4
+# CHECK:      00000000000006 A plus
+# CHECK-NEXT: 00000000000004 A minus
+# CHECK-NEXT: 00000000000003 A div
+# CHECK-NEXT: 00000000000006 A mod
+# CHECK-NEXT: 00000000000007 A mul
+# CHECK-NEXT: 00000000000005 A nospace
+# CHECK-NEXT: 00000000000015 A braces
+# CHECK-NEXT: 000000000000aa A and
+# CHECK-NEXT: 00000000000001 A ternary1
+# CHECK-NEXT: 00000000000002 A ternary2
+# CHECK-NEXT: 00000000000002 A less
+# CHECK-NEXT: 00000000000001 A lesseq
+# CHECK-NEXT: 00000000000002 A greater
+# CHECK-NEXT: 00000000000001 A greatereq
+# CHECK-NEXT: 00000000000001 A eq
+# CHECK-NEXT: 00000000000002 A neq
+# CHECK-NEXT: 00000000000003 A plusassign
+# CHECK-NEXT: 00000000000002 A unary
+# CHECK-NEXT: 00000000000020 A lshift
+# CHECK-NEXT: 0000000000001f A rshift
+# CHECK-NEXT: 00000000000009 A precedence1
+# CHECK-NEXT: 00000000000009 A precedence2
+# CHECK-NEXT: 00000000001000 A maxpagesize
+# CHECK-NEXT: 00000000001000 A commonpagesize
+# CHECK-NEXT: 0000000000ffff A datasegmentalign
+# CHECK-NEXT: 0000000000fff0 A datasegmentalign2
+# CHECK-NEXT: 0000000000ffe0 T minus_rel
+# CHECK-NEXT: 0000000000fff0 A minus_abs
+# CHECK-NEXT: 00000000000016 A max
+# CHECK-NEXT: 0000000000000b A min
+# CHECK-NEXT: 00000000000000 A logicaland1
+# CHECK-NEXT: 00000000000000 A logicaland2
+# CHECK-NEXT: 00000000000000 A logicaland3
+# CHECK-NEXT: 00000000000001 A logicaland4
+# CHECK-NEXT: 00000000000000 A logicalor1
+# CHECK-NEXT: 00000000000001 A logicalor2
+# CHECK-NEXT: 00000000000001 A logicalor3
+# CHECK-NEXT: 00000000000001 A logicalor4
 
 ## Mailformed number error.
 # RUN: echo "SECTIONS { . = 0x12Q41; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
+# RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=NUMERR %s
 # NUMERR: malformed number: 0x12Q41
 
 ## Missing closing bracket.
 # RUN: echo "SECTIONS { . = (1; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
+# RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=BRACKETERR %s
 # BRACKETERR: ) expected, but got ;
 
 ## Missing opening bracket.
 # RUN: echo "SECTIONS { . = 1); }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
+# RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=BRACKETERR2 %s
 # BRACKETERR2: ; expected, but got )
 
 ## Empty expression.
 # RUN: echo "SECTIONS { . = ; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
+# RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=ERREXPR %s
 # ERREXPR: malformed number: ;
 
 ## Div by zero error.
 # RUN: echo "SECTIONS { . = 1 / 0; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
+# RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=DIVZERO %s
 # DIVZERO: {{.*}}.script:1: division by zero
 
 ## Mod by zero error.
 # RUN: echo "SECTIONS { . = 1 % 0; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
+# RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=MODZERO %s
 # MODZERO: {{.*}}.script:1: modulo by zero
 
 ## Broken ternary operator expression.
 # RUN: echo "SECTIONS { . = 1 ? 2; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
+# RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=TERNERR %s
 # TERNERR: : expected, but got ;

diff  --git a/lld/test/ELF/linkerscript/page-size.s b/lld/test/ELF/linkerscript/page-size.s
index 5b8055598490..da8afb399c39 100644
--- a/lld/test/ELF/linkerscript/page-size.s
+++ b/lld/test/ELF/linkerscript/page-size.s
@@ -46,9 +46,9 @@
 
 # RUN: echo "SECTIONS { symbol = CONSTANT(MAXPAGESIZE); }" > %t.script
 # RUN: ld.lld -z max-page-size=0x4000 -o %t1 --script %t.script %t
-# RUN: llvm-objdump -t %t1 | FileCheck -check-prefix CHECK-SCRIPT %s
+# RUN: llvm-readelf -s %t1 | FileCheck -check-prefix CHECK-SCRIPT %s
 
-# CHECK-SCRIPT: 0000000000004000 *ABS* 00000000 symbol
+# CHECK-SCRIPT: 0000000000004000 0 NOTYPE GLOBAL DEFAULT ABS symbol
 
 # RUN: not ld.lld -z max-page-size=0x1001 -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR1 %s

diff  --git a/lld/test/ELF/linkerscript/provide-shared.s b/lld/test/ELF/linkerscript/provide-shared.s
index e3f1bdb2ea3d..31a297f0991b 100644
--- a/lld/test/ELF/linkerscript/provide-shared.s
+++ b/lld/test/ELF/linkerscript/provide-shared.s
@@ -4,9 +4,9 @@
 # RUN: ld.lld %t2.o -o %t2.so -shared
 # RUN: echo "SECTIONS { . = . + SIZEOF_HEADERS; PROVIDE(foo = 42);}" > %t.script
 # RUN: ld.lld -o %t --script %t.script %t.o %t2.so
-# RUN: llvm-objdump -t %t | FileCheck  %s
+# RUN: llvm-readelf -s %t | FileCheck  %s
 
-# CHECK: 000000000000002a         *ABS*           00000000 foo
+# CHECK: 000000000000002a 0 NOTYPE GLOBAL DEFAULT ABS foo
 
 .global _start
 _start:

diff  --git a/lld/test/ELF/linkerscript/sizeof.s b/lld/test/ELF/linkerscript/sizeof.s
index 0d7106fc8956..45c14284e5be 100644
--- a/lld/test/ELF/linkerscript/sizeof.s
+++ b/lld/test/ELF/linkerscript/sizeof.s
@@ -1,5 +1,5 @@
 # REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
 
 # RUN: echo "SECTIONS { \
 # RUN:   .aaa         : { *(.aaa) } \
@@ -8,32 +8,22 @@
 # RUN:   _aaa = SIZEOF(.aaa); \
 # RUN:   _bbb = SIZEOF(.bbb); \
 # RUN:   _ccc = SIZEOF(.ccc); \
+# RUN:   _ddd = SIZEOF(.not_exist); \
 # RUN: }" > %t.script
-# RUN: ld.lld -o %t1 --script %t.script %t
-# RUN: llvm-objdump -t -section-headers %t1 | FileCheck %s
-# CHECK:      Sections:
-# CHECK-NEXT:  Idx Name          Size
-# CHECK-NEXT:    0               00000000
-# CHECK-NEXT:    1 .aaa          00000008
-# CHECK-NEXT:    2 .bbb          00000010
-# CHECK-NEXT:    3 .ccc          00000018
-# CHECK:      SYMBOL TABLE:
-# CHECK-NEXT:                   .text 00000000 _start
-# CHECK-NEXT:  0000000000000008 *ABS* 00000000 _aaa
-# CHECK-NEXT:  0000000000000010 *ABS* 00000000 _bbb
-# CHECK-NEXT:  0000000000000018 *ABS* 00000000 _ccc
+# RUN: ld.lld -T %t.script %t.o -o %t
+# RUN: llvm-readelf -S -s %t | FileCheck %s
 
-## SIZEOF(.nonexistent_section) should return 0.
-# RUN: echo "SECTIONS { \
-# RUN:   .aaa         : { *(.aaa) } \
-# RUN:   .bbb         : { *(.bbb) } \
-# RUN:   .ccc         : { *(.ccc) } \
-# RUN:   _aaa = SIZEOF(.foo); \
-# RUN: }" > %t.script
-# RUN: ld.lld -o %t1 --script %t.script %t
-# RUN: llvm-objdump -t -section-headers %t1 | FileCheck -check-prefix=CHECK2 %s
+# CHECK:      Name Type     Address          Off    Size
+# CHECK:      .aaa PROGBITS 0000000000000000 001000 000008
+# CHECK-NEXT: .bbb PROGBITS 0000000000000008 001008 000010
+# CHECK-NEXT: .ccc PROGBITS 0000000000000018 001018 000018
 
-# CHECK2: 0000000000000000 *ABS* 00000000 _aaa
+# CHECK:        Value          Size Type   Bind   Vis     Ndx Name
+# CHECK:      0000000000000008    0 NOTYPE GLOBAL DEFAULT ABS _aaa
+# CHECK-NEXT: 0000000000000010    0 NOTYPE GLOBAL DEFAULT ABS _bbb
+# CHECK-NEXT: 0000000000000018    0 NOTYPE GLOBAL DEFAULT ABS _ccc
+## SIZEOF(.not_exist) has a value of 0.
+# CHECK-NEXT: 0000000000000000    0 NOTYPE GLOBAL DEFAULT ABS _ddd
 
 .global _start
 _start:

diff  --git a/lld/test/ELF/linkerscript/sizeofheaders.s b/lld/test/ELF/linkerscript/sizeofheaders.s
index 6a82442bc938..3293c4ea34e4 100644
--- a/lld/test/ELF/linkerscript/sizeofheaders.s
+++ b/lld/test/ELF/linkerscript/sizeofheaders.s
@@ -1,16 +1,16 @@
 # REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
 # RUN: echo " SECTIONS {             \
 # RUN:          . = SIZEOF_HEADERS;  \
 # RUN:          _size = SIZEOF_HEADERS;  \
 # RUN:          .text : {*(.text*)} \
 # RUN:          }" > %t.script
-# RUN: ld.lld -o %t1 --script %t.script %t
-# RUN: llvm-objdump -t %t1 | FileCheck %s
+# RUN: ld.lld -o %t --script %t.script %t.o
+# RUN: llvm-readelf -s %t | FileCheck %s
 
-#CHECK:      SYMBOL TABLE:
-#CHECK-NEXT:  00000000000000e8 .text 00000000 _start
-#CHECK-NEXT:  00000000000000e8 *ABS* 00000000 _size
+# CHECK:         Value         Size Type   Bind   Vis     Ndx Name
+# CHECK:      00000000000000e8    0 NOTYPE GLOBAL DEFAULT   1 _start
+# CHECK-NEXT: 00000000000000e8    0 NOTYPE GLOBAL DEFAULT ABS _size
 
 .global _start
 _start:

diff  --git a/lld/test/ELF/linkerscript/symbol-assignexpr.s b/lld/test/ELF/linkerscript/symbol-assignexpr.s
index 56e0827caf11..3bab4db7ab48 100644
--- a/lld/test/ELF/linkerscript/symbol-assignexpr.s
+++ b/lld/test/ELF/linkerscript/symbol-assignexpr.s
@@ -1,5 +1,5 @@
 # REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
 
 # RUN: echo "SECTIONS { \
 # RUN:         symbol = CONSTANT(MAXPAGESIZE); \
@@ -21,32 +21,31 @@
 # RUN:         bar = 0x5678; \
 # RUN:         baz = 0x9abc; \
 # RUN:       }" > %t.script
-# RUN: ld.lld -o %t1 --script %t.script %t
-# RUN: llvm-objdump -t %t1 | FileCheck %s
+# RUN: ld.lld -o %t -T %t.script %t.o
+# RUN: llvm-nm -p %t | FileCheck %s
 
-# CHECK:      SYMBOL TABLE:
-# CHECK-NEXT: 0000000000000000 .text 00000000 _start
-# CHECK-NEXT: 0000000000005678 *ABS* 00000000 bar
-# CHECK-NEXT: 0000000000009abc *ABS* 00000000 baz
-# CHECK-NEXT: 0000000000000001 .text 00000000 foo
-# CHECK-NEXT: 0000000000001000 *ABS* 00000000 symbol
-# CHECK-NEXT: 0000000000002234 *ABS* 00000000 symbol2
-# CHECK-NEXT: 0000000000002234 *ABS* 00000000 symbol3
-# CHECK-NEXT: 0000000000000ffc *ABS* 00000000 symbol4
-# CHECK-NEXT: 0000000000010ffc *ABS* 00000000 symbol5
-# CHECK-NEXT: 0000000000010ffc *ABS* 00000000 symbol6
-# CHECK-NEXT: 0000000000011000 *ABS* 00000000 symbol7
-# CHECK-NEXT: ffffffffffff0004 *ABS* 00000000 symbol8
-# CHECK-NEXT: fffffffffffffffc *ABS* 00000000 symbol9
-# CHECK-NEXT: fedcba9876543210 *ABS* 00000000 symbol10
-# CHECK-NEXT: 0000000000029000 *ABS* 00000000 symbol11
-# CHECK-NEXT: 0000000000001235 *ABS* 00000000 symbol12
-# CHECK-NEXT: 0000000000000000 *ABS* 00000000 symbol13
-# CHECK-NEXT: 0000000000000001 *ABS* 00000000 symbol14
-# CHECK-NEXT: 0000000000000001 *ABS* 00000000 symbol15
+# CHECK:      0000000000000000 T _start
+# CHECK-NEXT: 0000000000005678 A bar
+# CHECK-NEXT: 0000000000009abc A baz
+# CHECK-NEXT: 0000000000000001 T foo
+# CHECK-NEXT: 0000000000001000 A symbol
+# CHECK-NEXT: 0000000000002234 A symbol2
+# CHECK-NEXT: 0000000000002234 A symbol3
+# CHECK-NEXT: 0000000000000ffc A symbol4
+# CHECK-NEXT: 0000000000010ffc A symbol5
+# CHECK-NEXT: 0000000000010ffc A symbol6
+# CHECK-NEXT: 0000000000011000 A symbol7
+# CHECK-NEXT: ffffffffffff0004 A symbol8
+# CHECK-NEXT: fffffffffffffffc A symbol9
+# CHECK-NEXT: fedcba9876543210 A symbol10
+# CHECK-NEXT: 0000000000029000 A symbol11
+# CHECK-NEXT: 0000000000001235 A symbol12
+# CHECK-NEXT: 0000000000000000 A symbol13
+# CHECK-NEXT: 0000000000000001 A symbol14
+# CHECK-NEXT: 0000000000000001 A symbol15
 
 # RUN: echo "SECTIONS { symbol2 = symbol; }" > %t2.script
-# RUN: not ld.lld -o /dev/null --script %t2.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null -T %t2.script %t.o 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR %s
 # ERR: {{.*}}.script:1: symbol not found: symbol
 

diff  --git a/lld/test/ELF/linkerscript/symbol-conflict.s b/lld/test/ELF/linkerscript/symbol-conflict.s
index dcca7c13de6e..dc922b65dac8 100644
--- a/lld/test/ELF/linkerscript/symbol-conflict.s
+++ b/lld/test/ELF/linkerscript/symbol-conflict.s
@@ -3,8 +3,8 @@
 
 # RUN: echo "SECTIONS { . = SIZEOF_HEADERS; .text : {*(.text.*)} end = .;}" > %t.script
 # RUN: ld.lld -o %t1 --script %t.script %t
-# RUN: llvm-objdump -t %t1 | FileCheck %s
-# CHECK: 00000000000000e9         .text    00000000 end
+# RUN: llvm-nm %t1 | FileCheck %s
+# CHECK: 00000000000000e9 T end
 
 .global _start
 _start:

diff  --git a/lld/test/ELF/linkerscript/symbol-memoryexpr.s b/lld/test/ELF/linkerscript/symbol-memoryexpr.s
index 9214ba83ea51..ad01466e20d8 100644
--- a/lld/test/ELF/linkerscript/symbol-memoryexpr.s
+++ b/lld/test/ELF/linkerscript/symbol-memoryexpr.s
@@ -10,13 +10,12 @@
 # RUN:         end    = ORIGIN(ram) + LENGTH(ram); \
 # RUN:       }" > %t.script
 # RUN: ld.lld -o %t1 --script %t.script %t
-# RUN: llvm-objdump -t %t1 | FileCheck %s
+# RUN: llvm-nm -p %t1 | FileCheck %s
 
-# CHECK:      SYMBOL TABLE:
-# CHECK-NEXT: 0000000000008000 .text 00000000 _start
-# CHECK-NEXT: 0000000000008000 *ABS* 00000000 origin
-# CHECK-NEXT: 0000000000040000 *ABS* 00000000 length
-# CHECK-NEXT: 0000000000048000 *ABS* 00000000 end
+# CHECK:      0000000000008000 T _start
+# CHECK-NEXT: 0000000000008000 A origin
+# CHECK-NEXT: 0000000000040000 A length
+# CHECK-NEXT: 0000000000048000 A end
 
 # RUN: echo "SECTIONS { \
 # RUN:         no_exist_origin = ORIGIN(ram); \

diff  --git a/lld/test/ELF/linkerscript/undef.s b/lld/test/ELF/linkerscript/undef.s
index 85ad0767b5ed..f352466204c8 100644
--- a/lld/test/ELF/linkerscript/undef.s
+++ b/lld/test/ELF/linkerscript/undef.s
@@ -3,8 +3,8 @@
 
 # RUN: echo "SECTIONS { patatino = 0x1234; }" > %t.script
 # RUN: ld.lld -o %t1 --script %t.script %t
-# RUN: llvm-objdump -t %t1 | FileCheck %s
-# CHECK: 0000000000001234         *ABS*    00000000 patatino
+# RUN: llvm-nm %t1 | FileCheck %s
+# CHECK: 0000000000001234 A patatino
 
 .global _start
 _start:

diff  --git a/lld/test/ELF/relocatable-tls.s b/lld/test/ELF/relocatable-tls.s
index ff04dd2dfccb..07bdf459da43 100644
--- a/lld/test/ELF/relocatable-tls.s
+++ b/lld/test/ELF/relocatable-tls.s
@@ -4,13 +4,10 @@
 # RUN:   %S/Inputs/relocatable-tls.s -o %t2.o
 
 # RUN: ld.lld -r %t2.o -o %t3.r
-# RUN: llvm-objdump -t %t3.r | FileCheck --check-prefix=RELOCATABLE %s
-# RELOCATABLE: SYMBOL TABLE:
-# RELOCATABLE: 0000000000000000 *UND* 00000000 __tls_get_addr
+# RUN: llvm-nm %t3.r | FileCheck %s
+# CHECK: U __tls_get_addr
 
 # RUN: ld.lld -shared %t2.o %t3.r -o %t4.out
-# RUN: llvm-objdump -t %t4.out | FileCheck --check-prefix=DSO %s
-# DSO: SYMBOL TABLE:
-# DSO: 0000000000000000 *UND* 00000000 __tls_get_addr
+# RUN: llvm-nm %t4.out | FileCheck %s
 
 callq __tls_get_addr at PLT


        


More information about the llvm-commits mailing list