Starting with Xcode 16 (dyld-1122), Apple's binary utilities, e.g. `dyld_info` (but not dyld itself), will refuse to load binaries built against the macOS 15 SDK or newer that contain the same `LC_RPATH` entry multiple times: https://github.com/apple-oss-distributions/dyld/blob/rel/dyld-1122/mach_o/Policy.cpp#L246-L249 `ld-prime` deduplicates entries (regardless of the deployment target), we now do the same. We also match `ld-prime`'s and `ld64`'s behavior by warning on duplicate `-rpath` arguments. This can be disabled by the LLD-specific `--no-warn-duplicate-rpath` flag.
35 lines
1.1 KiB
ArmAsm
35 lines
1.1 KiB
ArmAsm
# REQUIRES: x86
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
|
|
# RUN: %lld -o %t %t.o
|
|
|
|
## Check that -rpath generates LC_RPATH.
|
|
# RUN: %lld -o %t %t.o -rpath /some/rpath -rpath /another/rpath
|
|
# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s
|
|
# CHECK: LC_RPATH
|
|
# CHECK-NEXT: cmdsize 24
|
|
# CHECK-NEXT: path /some/rpath
|
|
# CHECK: LC_RPATH
|
|
# CHECK-NEXT: cmdsize 32
|
|
# CHECK-NEXT: path /another/rpath
|
|
|
|
## Check that -rpath entries are deduplicated.
|
|
# RUN: not %lld %t.o -o /dev/null -rpath /some/rpath -rpath /other/rpath -rpath /some/rpath 2>&1 | \
|
|
# RUN: FileCheck --check-prefix=FATAL %s
|
|
# FATAL: error: duplicate -rpath '/some/rpath' ignored [--warn-duplicate-rpath]
|
|
|
|
# RUN: %lld -o %t-dup %t.o -rpath /some/rpath -rpath /other/rpath -rpath /some/rpath --no-warn-duplicate-rpath
|
|
# RUN: llvm-objdump --macho --all-headers %t-dup | FileCheck %s --check-prefix=DEDUP
|
|
# DEDUP: LC_RPATH
|
|
# DEDUP-NEXT: cmdsize 24
|
|
# DEDUP-NEXT: path /some/rpath
|
|
# DEDUP: LC_RPATH
|
|
# DEDUP-NEXT: cmdsize 32
|
|
# DEDUP-NEXT: path /other/rpath
|
|
# DEDUP-NOT: LC_RPATH
|
|
|
|
.text
|
|
.global _main
|
|
_main:
|
|
mov $0, %rax
|
|
ret
|