forked from OSchip/llvm-project
[mach-o]: support -Z option to skip standard library paths
llvm-svn: 212713
This commit is contained in:
parent
18af0573df
commit
73c532e8a9
|
@ -302,8 +302,11 @@ bool DarwinLdDriver::parse(int argc, const char *argv[],
|
|||
ctx.addModifiedSearchDir(libPath->getValue(), syslibRoots, false);
|
||||
}
|
||||
|
||||
ctx.addModifiedSearchDir("/usr/lib", syslibRoots, true);
|
||||
ctx.addModifiedSearchDir("/usr/local/lib", syslibRoots, true);
|
||||
// -Z suppresses the standard search paths.
|
||||
if (!parsedArgs->hasArg(OPT_Z)) {
|
||||
ctx.addModifiedSearchDir("/usr/lib", syslibRoots, true);
|
||||
ctx.addModifiedSearchDir("/usr/local/lib", syslibRoots, true);
|
||||
}
|
||||
|
||||
// Now that we've constructed the final set of search paths, print out what
|
||||
// we'll be using for testing purposes.
|
||||
|
|
|
@ -66,6 +66,8 @@ def bundle_loader : Separate<["-"], "bundle_loader">,
|
|||
def grp_libs : OptionGroup<"libs">, HelpText<"LIBRARY OPTIONS">;
|
||||
def L : JoinedOrSeparate<["-"], "L">,
|
||||
HelpText<"Add directory to library search path">, Group<grp_libs>;
|
||||
def Z : Flag<["-"], "Z">,
|
||||
HelpText<"Do not search standard directories for libraries or frameworks">;
|
||||
def all_load : Flag<["-"], "all_load">,
|
||||
HelpText<"Forces all members of all static libraries to be loaded">,
|
||||
Group<grp_libs>;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# RUN: lld -flavor darwin -arch x86_64 -r -test_libresolution \
|
||||
# RUN: -path_exists /usr/lib \
|
||||
# RUN: -path_exists /usr/local/lib \
|
||||
# RUN: -path_exists /usr/lib/libSystem.dylib \
|
||||
# RUN: -path_exists hasFoo \
|
||||
# RUN: -path_exists hasFoo/libFoo.dylib \
|
||||
# RUN: -path_exists /hasBar \
|
||||
# RUN: -path_exists /hasBar/libBar.dylib \
|
||||
# RUN: -L hasFoo \
|
||||
# RUN: -L /hasBar \
|
||||
# RUN: -Z \
|
||||
# RUN: -lFoo -lBar \
|
||||
# RUN: 2>&1 | FileCheck %s
|
||||
|
||||
# CHECK: Library search paths:
|
||||
# CHECK: hasFoo
|
||||
# CHECK: /hasBar
|
||||
# CHECK-NOT: /usr/lib
|
||||
# CHECK-NOT: /usr/local/lib
|
||||
# CHECK: Found library hasFoo/libFoo.dylib
|
||||
# CHECK: Found library /hasBar/libBar.dylib
|
Loading…
Reference in New Issue