mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 07:06:38 +00:00
[lld-macho] Find objects in library search path (#78628)
Find object files in library search path just like Apple's linker, this makes building with some older MacOS SDKs easier since clang runs with `-lcrt1.10.6.o`
This commit is contained in:
parent
07b5829fca
commit
46a9135d61
@ -90,6 +90,10 @@ static std::optional<StringRef> findLibrary(StringRef name) {
|
||||
return entry->second;
|
||||
|
||||
auto doFind = [&] {
|
||||
// Special case for Csu support files required for Mac OS X 10.7 and older
|
||||
// (crt1.o)
|
||||
if (name.ends_with(".o"))
|
||||
return findPathCombination(name, config->librarySearchPaths, {""});
|
||||
if (config->searchDylibsFirst) {
|
||||
if (std::optional<StringRef> path =
|
||||
findPathCombination("lib" + name, config->librarySearchPaths,
|
||||
|
14
lld/test/MachO/link-csu-object.s
Normal file
14
lld/test/MachO/link-csu-object.s
Normal file
@ -0,0 +1,14 @@
|
||||
# REQUIRES: x86
|
||||
# RUN: mkdir -p %t
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s -o %t/hello.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o
|
||||
# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out
|
||||
# RUN: llvm-nm %t/a.out | FileCheck %s
|
||||
|
||||
# CHECK: _main
|
||||
# CHECK: _print_hello
|
||||
|
||||
.globl _main
|
||||
_main:
|
||||
call _print_hello
|
||||
ret
|
Loading…
x
Reference in New Issue
Block a user