[PATCH] D142248: [lld-macho] Do not warn on missing /usr/local/lib library search path

Vincent Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 12:31:25 PST 2023


thevinster created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
thevinster edited the summary of this revision.
Herald added a subscriber: kristof.beyls.
thevinster edited the summary of this revision.
thevinster published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

...unless -Z is passed. Enabling `-fatal_warnings` turns these into errors
even though they are harmless. This mirrors ld64's behavior as shown here: 
https://github.com/apple-oss-distributions/ld64/blob/main/src/ld/Options.cpp#L4361-L4363

This broke one of our internal builds when trying to enable `-fatal_warnings` and 
switching ld64 to LLD.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142248

Files:
  lld/MachO/Driver.cpp


Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ 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);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142248.490942.patch
Type: text/x-patch
Size: 981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230120/e07b3be6/attachment.bin>


More information about the llvm-commits mailing list