diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -141,10 +141,13 @@ return {}; } -static bool warnIfNotDirectory(StringRef option, StringRef path) { +static bool warnIfNotDirectory(StringRef option, StringRef path, + InputArgList &args) { if (!fs::exists(path)) { - warn("directory not found for option -" + option + path); - return false; + if (args.hasArg(OPT_Z) || path != "/usr/local/lib") { + warn("directory not found for option -" + option + path); + return false; + } } else if (!fs::is_directory(path)) { warn("option -" + option + path + " references a non-directory path"); return false; @@ -172,7 +175,7 @@ } } } - if (!found && warnIfNotDirectory(optionLetter, path)) + if (!found && warnIfNotDirectory(optionLetter, path, args)) paths.push_back(path); }