diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp --- a/lld/MachO/Driver.cpp +++ b/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 diff --git a/lld/test/MachO/lc-linker-option.ll b/lld/test/MachO/lc-linker-option.ll --- a/lld/test/MachO/lc-linker-option.ll +++ b/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: ld64.lld: warning: 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"