[PATCH] D120938: [lld-macho][nfc] Rename some tests for consistency
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 3 14:04:53 PST 2022
int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added projects: lld-macho, All.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Now all the tests that cover symbol resolution / precedence have
"resolution" in their filename.
I also added a couple of extra comments.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120938
Files:
lld/test/MachO/archive-symbol-resolution.s
lld/test/MachO/resolution.s
lld/test/MachO/symbol-order.s
lld/test/MachO/symbol-resolution.s
Index: lld/test/MachO/resolution.s
===================================================================
--- /dev/null
+++ lld/test/MachO/resolution.s
@@ -1,50 +0,0 @@
-# REQUIRES: x86
-# RUN: rm -rf %t; split-file %s %t
-# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/libresolution.s -o %t/libresolution.o
-# RUN: %lld -dylib -install_name \
-# RUN: @executable_path/libresolution.dylib %t/libresolution.o -o %t/libresolution.dylib
-# RUN: %lld -dylib -install_name \
-# RUN: @executable_path/libresolution2.dylib %t/libresolution.o -o %t/libresolution2.dylib
-# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/resolution.s -o %t/resolution.o
-
-## Check that we select the symbol defined in the first dylib passed on the
-## command line.
-# RUN: %lld -o %t/dylib-first -L%t -lresolution -lresolution2 %t/resolution.o
-# RUN: llvm-objdump --macho --bind %t/dylib-first | FileCheck %s --check-prefix=DYLIB-FIRST
-# DYLIB-FIRST: libresolution _foo
-
-# RUN: %lld -o %t/dylib2-first -L%t -lresolution2 -lresolution %t/resolution.o
-# RUN: llvm-objdump --macho --bind %t/dylib2-first | FileCheck %s --check-prefix=DYLIB2-FIRST
-# DYLIB2-FIRST: libresolution2 _foo
-
-## Also check that defined symbols take precedence over dylib symbols.
-# DYLIB-FIRST-NOT: libresolution _bar
-# DYLIB-FIRST-NOT: libresolution _baz
-
-## Check that we pick the dylib symbol over the undefined symbol in the object
-## file, even if the object file appears first on the command line.
-# RUN: %lld -o %t/obj-first -L%t %t/resolution.o -lresolution
-# RUN: llvm-objdump --macho --bind %t/obj-first | FileCheck %s --check-prefix=OBJ-FIRST
-# OBJ-FIRST: libresolution _foo
-## But defined symbols should still take precedence.
-# OBJ-FIRST-NOT: libresolution _bar
-# OBJ-FIRST-NOT: libresolution _baz
-
-#--- libresolution.s
-.globl _foo, _bar, _baz
-_foo:
-_bar:
-_baz:
-
-#--- resolution.s
-.globl _main, _bar
-# Global defined symbol
-_bar:
-# Local defined symbol
-_baz:
-
-_main:
- movq _foo at GOTPCREL(%rip), %rsi
- movq _bar at GOTPCREL(%rip), %rsi
- movq _baz at GOTPCREL(%rip), %rsi
- ret
Index: lld/test/MachO/archive-symbol-resolution.s
===================================================================
--- lld/test/MachO/archive-symbol-resolution.s
+++ lld/test/MachO/archive-symbol-resolution.s
@@ -10,6 +10,8 @@
# RUN: llvm-ar rcs %t/libf2_g.a %t/f2.o %t/g.o
# RUN: llvm-ar rcs %t/libfg.a %t/fg.o
+## (Strong) dylib symbols and archive symbols have equal precedence.
+
# RUN: %lld %t/libf1.dylib %t/libf2_g.a %t/test.o -o %t/test.out -lSystem
# RUN: llvm-objdump --syms --macho --lazy-bind %t/test.out | FileCheck %s --check-prefix DYLIB-FIRST
# DYLIB-FIRST: SYMBOL TABLE:
@@ -27,6 +29,8 @@
# ARCHIVE-FIRST-NEXT: segment section address dylib symbol
# ARCHIVE-FIRST-EMPTY:
+## Once an archive member is fetched, all the extern symbols in that member
+## take precedence over dylib symbols of the same name.
# RUN: %lld %t/libf1.dylib %t/libfg.a %t/test.o -o %t/test.out -lSystem
# RUN: llvm-objdump --syms --macho --lazy-bind %t/test.out | FileCheck %s --check-prefix ARCHIVE-PRIORITY
# ARCHIVE-PRIORITY: SYMBOL TABLE:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120938.412834.patch
Type: text/x-patch
Size: 3186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220303/35411ae7/attachment.bin>
More information about the llvm-commits
mailing list