Index: lib/Driver/DarwinLdDriver.cpp =================================================================== --- lib/Driver/DarwinLdDriver.cpp +++ lib/Driver/DarwinLdDriver.cpp @@ -738,6 +738,12 @@ return false; } + // Handle not-yet-supported LTO options + if (parsedArgs.getLastArg(OPT_lto_library)) { + diagnostics << "warning: -lto_library being ignored. LTO is not yet " + "supported for Mach-O targets\n"; + } + // Handle -pie or -no_pie if (llvm::opt::Arg *pie = parsedArgs.getLastArg(OPT_pie, OPT_no_pie)) { switch (ctx.outputMachOType()) { Index: lib/Driver/DarwinLdOptions.td =================================================================== --- lib/Driver/DarwinLdOptions.td +++ lib/Driver/DarwinLdOptions.td @@ -94,6 +94,9 @@ HelpText<"Disables the optimisation which merges Objective-C categories " "on a class in to the class itself.">, Group; +def lto_library : Separate<["-"], "lto_library">, + MetaVarName<"">, + HelpText<"Not yet supported option for LTO">, Group; // main executable options def grp_main : OptionGroup<"opts">, HelpText<"MAIN EXECUTABLE OPTIONS">; Index: test/darwin/cmdline-lto_library.objtxt =================================================================== --- /dev/null +++ test/darwin/cmdline-lto_library.objtxt @@ -0,0 +1,11 @@ +# RUN: ld64.lld -arch x86_64 -lto_library %t -print-atoms -r %s 2>&1 | FileCheck %s +# +# Test that the -lto_library option results in a warning, not an error. +# + +# CHECK: warning: -lto_library being ignored + +--- !native +defined-atoms: + - name: _foo +...