[PATCH] D140225: [lld-macho] Provide an option to ignore framework-not-found errors coming from LC_LINKER_OPTIONS.

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 21:35:38 PST 2022


oontvoo updated this revision to Diff 484460.
oontvoo added a comment.

Updated diff to implement option #2, whic is to make missing frameworks/libraries warnings instead of errors.

Thanks, all, for the inputs!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140225/new/

https://reviews.llvm.org/D140225

Files:
  lld/MachO/Driver.cpp
  lld/test/MachO/lc-linker-option.ll


Index: lld/test/MachO/lc-linker-option.ll
===================================================================
--- lld/test/MachO/lc-linker-option.ll
+++ lld/test/MachO/lc-linker-option.ll
@@ -134,6 +134,17 @@
 ; RUN: %lld %t/main -F %t -framework Foo -framework Foo -o /dev/null
 ; RUN: %lld -F %t -framework Foo -framework Foo %t/main -o /dev/null
 
+;; Checks that "framework not found" from LC_LINKER_OPTIONS are reported
+;; as warnings and not errors.
+; RUN: %no-fatal-warnings-lld  -ObjC %t/load-framework-foo.o %t/main.o -o %t/main-no-foo.out  2>&1 | FileCheck %s --check-prefix=WARN
+; RUN: llvm-objdump --macho --syms %t/main-no-foo.out | FileCheck %s --check-prefix=SYMS_NO_FOO
+
+; WARN: warn: framework not found for -framework foo, from LC_LINKER_OPTION
+;; Verify that nothing from the framework is included.
+; SYMS_NO_FOO:       SYMBOL TABLE:
+; SYMS_NO_FOO-NEXT:  g     F __TEXT,__text _main
+; SYMS_NO_FOO-NOT:   g     O __DATA,__objc_data _OBJC_CLASS_$_TestClass
+
 ;--- framework.ll
 target triple = "x86_64-apple-macosx10.15.0"
 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -456,7 +456,11 @@
     }
     return;
   }
-  error("framework not found for -framework " + name);
+  if (loadType == LoadType::LCLinkerOption)
+    warn("framework not found for -framework " + name +
+         ", from LC_LINKER_OPTION");
+  else
+    error("framework not found for -framework " + name);
 }
 
 // Parses LC_LINKER_OPTION contents, which can add additional command line


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140225.484460.patch
Type: text/x-patch
Size: 1679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221221/a7f417c1/attachment.bin>


More information about the llvm-commits mailing list