[lld] 1477964 - [lld][macho]Fix test to sort symbol table before dumping
Vy Nguyen via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 11 09:01:24 PDT 2022
Author: Vy Nguyen
Date: 2022-04-11T12:01:04-04:00
New Revision: 14779644133dd2d71a59ea66b4093401d874113d
URL: https://github.com/llvm/llvm-project/commit/14779644133dd2d71a59ea66b4093401d874113d
DIFF: https://github.com/llvm/llvm-project/commit/14779644133dd2d71a59ea66b4093401d874113d.diff
LOG: [lld][macho]Fix test to sort symbol table before dumping
Details: The test previously expected a specific order of those symbols, which is not guaranteed (could change simply due to hashing changes, etc).
So we change it to explicitly sort the symbols before checking contents.
PR/53026
Differential Revision: https://reviews.llvm.org/D116813
Added:
Modified:
lld/test/MachO/symtab.s
Removed:
################################################################################
diff --git a/lld/test/MachO/symtab.s b/lld/test/MachO/symtab.s
index a2232c93f9ffc..82282d530644f 100644
--- a/lld/test/MachO/symtab.s
+++ b/lld/test/MachO/symtab.s
@@ -6,16 +6,29 @@
# RUN: %lld -dylib %t/libfoo.o -o %t/libfoo.dylib
# RUN: %lld -lSystem %t/test.o %t/test2.o %t/libfoo.dylib -o %t/test
-# RUN: llvm-readobj --syms --macho-dysymtab %t/test | FileCheck %s
+# RUN: llvm-readobj --syms --sort-symbols=type,name --macho-dysymtab %t/test | FileCheck %s
# CHECK: Symbols [
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: _local
-# CHECK-NEXT: Type: Section (0xE)
-# CHECK-NEXT: Section: __data
+# CHECK-NEXT: Name: _dynamic
+# CHECK-NEXT: Extern
+# CHECK-NEXT: Type: Undef (0x0)
+# CHECK-NEXT: Section: (0x0)
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
-# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: Flags [ (0x200)
+# CHECK-NEXT: AltEntry (0x200)
# CHECK-NEXT: ]
-# CHECK-NEXT: Value: 0x1{{[0-9a-f]*}}
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: dyld_stub_binder
+# CHECK-NEXT: Extern
+# CHECK-NEXT: Type: Undef (0x0)
+# CHECK-NEXT: Section: (0x0)
+# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
+# CHECK-NEXT: Flags [ (0x100)
+# CHECK-NEXT: SymbolResolver (0x100)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: __dyld_private
@@ -27,30 +40,30 @@
# CHECK-NEXT: Value: 0x1{{[0-9a-f]*}}
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: _private_external
-# CHECK-NEXT: PrivateExtern
+# CHECK-NEXT: Name: _local
# CHECK-NEXT: Type: Section (0xE)
-# CHECK-NEXT: Section: __text (0x1)
+# CHECK-NEXT: Section: __data
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Value: 0x1{{[0-9a-f]*}}
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: _private_external_weak
-# CHECK-NEXT: PrivateExtern
+# CHECK-NEXT: Name: __mh_execute_header
+# CHECK-NEXT: Extern
# CHECK-NEXT: Type: Section (0xE)
# CHECK-NEXT: Section: __text (0x1)
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
-# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: Flags [ (0x10)
+# CHECK-NEXT: ReferencedDynamically (0x10)
# CHECK-NEXT: ]
-# CHECK-NEXT: Value: 0x1{{[0-9a-f]*}}
+# CHECK-NEXT: Value: 0x100000000
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: _main
+# CHECK-NEXT: Name: _external
# CHECK-NEXT: Extern
# CHECK-NEXT: Type: Section (0xE)
-# CHECK-NEXT: Section: __text (0x1)
+# CHECK-NEXT: Section: __data
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
@@ -68,47 +81,34 @@
# CHECK-NEXT: Value: 0x1{{[0-9a-f]*}}
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: _external
+# CHECK-NEXT: Name: _main
# CHECK-NEXT: Extern
# CHECK-NEXT: Type: Section (0xE)
-# CHECK-NEXT: Section: __data
+# CHECK-NEXT: Section: __text (0x1)
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Value: 0x1{{[0-9a-f]*}}
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: __mh_execute_header
-# CHECK-NEXT: Extern
+# CHECK-NEXT: Name: _private_external
+# CHECK-NEXT: PrivateExtern
# CHECK-NEXT: Type: Section (0xE)
# CHECK-NEXT: Section: __text (0x1)
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
-# CHECK-NEXT: Flags [ (0x10)
-# CHECK-NEXT: ReferencedDynamically (0x10)
-# CHECK-NEXT: ]
-# CHECK-NEXT: Value: 0x100000000
-# CHECK-NEXT: }
-# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: dyld_stub_binder
-# CHECK-NEXT: Extern
-# CHECK-NEXT: Type: Undef (0x0)
-# CHECK-NEXT: Section: (0x0)
-# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
-# CHECK-NEXT: Flags [ (0x100)
-# CHECK-NEXT: SymbolResolver (0x100)
+# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
-# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Value: 0x1{{[0-9a-f]*}}
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: _dynamic
-# CHECK-NEXT: Extern
-# CHECK-NEXT: Type: Undef (0x0)
-# CHECK-NEXT: Section: (0x0)
+# CHECK-NEXT: Name: _private_external_weak
+# CHECK-NEXT: PrivateExtern
+# CHECK-NEXT: Type: Section (0xE)
+# CHECK-NEXT: Section: __text (0x1)
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
-# CHECK-NEXT: Flags [ (0x200)
-# CHECK-NEXT: AltEntry (0x200)
+# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
-# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Value: 0x1{{[0-9a-f]*}}
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: Dysymtab {
More information about the llvm-commits
mailing list