[PATCH] D113534: [lld-macho] Do not warn on install_name for bundles

Vincent Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 9 18:22:21 PST 2021


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

Dylibs could be embedded in app bundles which would miss modifying 
its install_name if header identifies it's a bundle. Additionally, ld64 doesn't 
warn when building bundles, so it makes sense for LLD to follow the 
same pattern.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113534

Files:
  lld/MachO/Driver.cpp
  lld/test/MachO/install-name.s


Index: lld/test/MachO/install-name.s
===================================================================
--- lld/test/MachO/install-name.s
+++ lld/test/MachO/install-name.s
@@ -7,8 +7,7 @@
 # RUN: llvm-objdump --macho --all-headers %t.exec \
 # RUN:     | FileCheck --check-prefix=NO-ID %s
 
-# RUN: %no_fatal_warnings_lld -bundle -o %t.bundle %t.o -install_name foo 2>&1 \
-# RUN:     | FileCheck --check-prefix=WARN %s
+# RUN: %lld -bundle -o %t.bundle %t.o -install_name foo 2>&1
 # RUN: llvm-objdump --macho --all-headers %t.bundle \
 # RUN:     | FileCheck --check-prefix=NO-ID %s
 
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -1274,8 +1274,8 @@
 #endif
 
   if (const Arg *arg = args.getLastArg(OPT_install_name)) {
-    if (config->outputType != MH_DYLIB)
-      warn(arg->getAsString(args) + ": ignored, only has effect with -dylib");
+    if (config->outputType != MH_DYLIB && config->outputType != MH_BUNDLE)
+      warn(arg->getAsString(args) + ": ignored, only has effect with -dylib and -bundle");
     else
       config->installName = arg->getValue();
   } else if (config->outputType == MH_DYLIB) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113534.386027.patch
Type: text/x-patch
Size: 1220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211110/e7dee26e/attachment.bin>


More information about the llvm-commits mailing list