[lld] fb9bfb2 - [lld][macho][nfc] Make tests less britle by not expecting ordering in symbol table dump.
Vy Nguyen via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 6 06:45:54 PST 2022
Author: Vy Nguyen
Date: 2022-01-06T09:45:44-05:00
New Revision: fb9bfb2c59b7b0f2cb9e7f5e2e5e1e48935fbb18
URL: https://github.com/llvm/llvm-project/commit/fb9bfb2c59b7b0f2cb9e7f5e2e5e1e48935fbb18
DIFF: https://github.com/llvm/llvm-project/commit/fb9bfb2c59b7b0f2cb9e7f5e2e5e1e48935fbb18.diff
LOG: [lld][macho][nfc] Make tests less britle by not expecting ordering in symbol table dump.
(parial)fixes PR/53026
Differential Revision: https://reviews.llvm.org/D116718
Added:
Modified:
lld/test/MachO/dead-strip.s
lld/test/MachO/icf-scale.s
lld/test/MachO/start-end.s
Removed:
################################################################################
diff --git a/lld/test/MachO/dead-strip.s b/lld/test/MachO/dead-strip.s
index a9744377f72d..01272a11fea4 100644
--- a/lld/test/MachO/dead-strip.s
+++ b/lld/test/MachO/dead-strip.s
@@ -24,26 +24,26 @@
# EXEC-NEXT: __ref_section
# EXEC-NEXT: __common
# EXEC-LABEL: SYMBOL TABLE:
-# EXEC-NEXT: l {{.*}} _ref_data
-# EXEC-NEXT: l {{.*}} _ref_local
-# EXEC-NEXT: l {{.*}} _ref_from_no_dead_strip_globl
-# EXEC-NEXT: l {{.*}} _no_dead_strip_local
-# EXEC-NEXT: l {{.*}} _ref_from_no_dead_strip_local
-# EXEC-NEXT: l {{.*}} _ref_private_extern_u
-# EXEC-NEXT: l {{.*}} _main
-# EXEC-NEXT: l {{.*}} _ref_private_extern
-# EXEC-NEXT: g {{.*}} _ref_com
-# EXEC-NEXT: g {{.*}} _no_dead_strip_globl
-# EXEC-NEXT: g {{.*}} __mh_execute_header
+# EXEC-DAG: l {{.*}} _ref_data
+# EXEC-DAG: l {{.*}} _ref_local
+# EXEC-DAG: l {{.*}} _ref_from_no_dead_strip_globl
+# EXEC-DAG: l {{.*}} _no_dead_strip_local
+# EXEC-DAG: l {{.*}} _ref_from_no_dead_strip_local
+# EXEC-DAG: l {{.*}} _ref_private_extern_u
+# EXEC-DAG: l {{.*}} _main
+# EXEC-DAG: l {{.*}} _ref_private_extern
+# EXEC-DAG: g {{.*}} _no_dead_strip_globl
+# EXEC-DAG: g {{.*}} _ref_com
+# EXEC-DAG: g {{.*}} __mh_execute_header
# EXECDATA-LABEL: Indirect symbols
# EXECDATA-NEXT: name
# EXECDATA-NEXT: _ref_com
# EXECDATA-LABEL: Contents of (__DATA,__ref_section) section
# EXECDATA-NEXT: 04 00 00 00 00 00 00 00 05 00 00 00 00 00 00 00
# EXECDATA-LABEL: Exports trie:
-# EXECDATA-NEXT: __mh_execute_header
-# EXECDATA-NEXT: _ref_com
-# EXECDATA-NEXT: _no_dead_strip_globl
+# EXECDATA-DAG: _ref_com
+# EXECDATA-DAG: _no_dead_strip_globl
+# EXECDATA-DAG: __mh_execute_header
# MAP: _main
# RUN: %lld -dylib -dead_strip -u _ref_private_extern_u %t/basics.o -o %t/basics.dylib
@@ -53,17 +53,17 @@
# RUN: llvm-objdump --syms %t/basics.dylib | \
# RUN: FileCheck --check-prefix=DYLIB --implicit-check-not _unref %s
# DYLIB-LABEL: SYMBOL TABLE:
-# DYLIB-NEXT: l {{.*}} _ref_data
-# DYLIB-NEXT: l {{.*}} _ref_local
-# DYLIB-NEXT: l {{.*}} _ref_from_no_dead_strip_globl
-# DYLIB-NEXT: l {{.*}} _no_dead_strip_local
-# DYLIB-NEXT: l {{.*}} _ref_from_no_dead_strip_local
-# DYLIB-NEXT: l {{.*}} _ref_private_extern_u
-# DYLIB-NEXT: l {{.*}} _ref_private_extern
-# DYLIB-NEXT: g {{.*}} _ref_com
-# DYLIB-NEXT: g {{.*}} _unref_com
-# DYLIB-NEXT: g {{.*}} _unref_extern
-# DYLIB-NEXT: g {{.*}} _no_dead_strip_globl
+# DYLIB-DAG: l {{.*}} _ref_data
+# DYLIB-DAG: l {{.*}} _ref_local
+# DYLIB-DAG: l {{.*}} _ref_from_no_dead_strip_globl
+# DYLIB-DAG: l {{.*}} _no_dead_strip_local
+# DYLIB-DAG: l {{.*}} _ref_from_no_dead_strip_local
+# DYLIB-DAG: l {{.*}} _ref_private_extern_u
+# DYLIB-DAG: l {{.*}} _ref_private_extern
+# DYLIB-DAG: g {{.*}} _ref_com
+# DYLIB-DAG: g {{.*}} _unref_com
+# DYLIB-DAG: g {{.*}} _unref_extern
+# DYLIB-DAG: g {{.*}} _no_dead_strip_globl
## Extern symbols aren't stripped from executables with -export_dynamic
# RUN: %lld -lSystem -dead_strip -export_dynamic -u _ref_private_extern_u \
@@ -77,19 +77,19 @@
# EXECDYN-NEXT: __ref_section
# EXECDYN-NEXT: __common
# EXECDYN-LABEL: SYMBOL TABLE:
-# EXECDYN-NEXT: l {{.*}} _ref_data
-# EXECDYN-NEXT: l {{.*}} _ref_local
-# EXECDYN-NEXT: l {{.*}} _ref_from_no_dead_strip_globl
-# EXECDYN-NEXT: l {{.*}} _no_dead_strip_local
-# EXECDYN-NEXT: l {{.*}} _ref_from_no_dead_strip_local
-# EXECDYN-NEXT: l {{.*}} _ref_private_extern_u
-# EXECDYN-NEXT: l {{.*}} _main
-# EXECDYN-NEXT: l {{.*}} _ref_private_extern
-# EXECDYN-NEXT: g {{.*}} _ref_com
-# EXECDYN-NEXT: g {{.*}} _unref_com
-# EXECDYN-NEXT: g {{.*}} _unref_extern
-# EXECDYN-NEXT: g {{.*}} _no_dead_strip_globl
-# EXECDYN-NEXT: g {{.*}} __mh_execute_header
+# EXECDYN-DAG: l {{.*}} _ref_data
+# EXECDYN-DAG: l {{.*}} _ref_local
+# EXECDYN-DAG: l {{.*}} _ref_from_no_dead_strip_globl
+# EXECDYN-DAG: l {{.*}} _no_dead_strip_local
+# EXECDYN-DAG: l {{.*}} _ref_from_no_dead_strip_local
+# EXECDYN-DAG: l {{.*}} _ref_private_extern_u
+# EXECDYN-DAG: l {{.*}} _main
+# EXECDYN-DAG: l {{.*}} _ref_private_extern
+# EXECDYN-DAG: g {{.*}} _ref_com
+# EXECDYN-DAG: g {{.*}} _unref_com
+# EXECDYN-DAG: g {{.*}} _unref_extern
+# EXECDYN-DAG: g {{.*}} _no_dead_strip_globl
+# EXECDYN-DAG: g {{.*}} __mh_execute_header
## Absolute symbol handling.
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \
diff --git a/lld/test/MachO/icf-scale.s b/lld/test/MachO/icf-scale.s
index 28c4ea7f776f..bae76edb52af 100644
--- a/lld/test/MachO/icf-scale.s
+++ b/lld/test/MachO/icf-scale.s
@@ -13,16 +13,19 @@
## 1 Ki times. The resulting folded program should retain one instance for each
## of the four unique functions.
+## The symtab does not have a particular order. And even though we can expect
+## some partial order, it is not possible to express that in FileCheck syntax.
+## So just use -DAG
# CHECK-LABEL: SYMBOL TABLE:
-# CHECK: [[#%x,G0:]] g F __TEXT,__text _g000000
-# CHECK: [[#%x,G1:]] g F __TEXT,__text _g100000
-# CHECK: [[#%x,G2:]] g F __TEXT,__text _g200000
-# CHECK: [[#%x,G3:]] g F __TEXT,__text _g300000
+# CHECK-DAG: [[#%x,G0:]] g F __TEXT,__text _g000000
+# CHECK-DAG: [[#%x,G0]] g F __TEXT,__text _g033333
+# CHECK-DAG: [[#%x,G1:]] g F __TEXT,__text _g100000
+# CHECK-DAG: [[#%x,G1]] g F __TEXT,__text _g133333
+# CHECK-DAG: [[#%x,G2:]] g F __TEXT,__text _g200000
+# CHECK-DAG: [[#%x,G2]] g F __TEXT,__text _g233333
+# CHECK-DAG: [[#%x,G3:]] g F __TEXT,__text _g300000
+# CHECK-DAG: [[#%x,G3]] g F __TEXT,__text _g333333
## . . . many intervening _gXXXXXX symbols
-# CHECK: [[#%x,G0]] g F __TEXT,__text _g033333
-# CHECK: [[#%x,G1]] g F __TEXT,__text _g133333
-# CHECK: [[#%x,G2]] g F __TEXT,__text _g233333
-# CHECK: [[#%x,G3]] g F __TEXT,__text _g333333
# CHECK-LABEL: Disassembly of section __TEXT,__text:
# CHECK-DAG: [[#%x,G0]] <_g033333>:
diff --git a/lld/test/MachO/start-end.s b/lld/test/MachO/start-end.s
index 3ca0048939b0..f8f389ddf0ac 100644
--- a/lld/test/MachO/start-end.s
+++ b/lld/test/MachO/start-end.s
@@ -239,8 +239,8 @@
# SEG-NOT: segment$end$__WHAT
# SEG-NOT: segment$start$__UFLAG_SEG
# SEG-NOT: segment$start$__UFLAG_SEG
-# SEG: segment$start$REGULAR
-# SEG: segment$end$REGULAR
+# SEG-DAG: segment$end$REGULAR
+# SEG-DAG: segment$start$REGULAR
# SEG: cmd LC_SEGMENT_64
# SEG-NEXT: cmdsize
More information about the llvm-commits
mailing list