llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Andrzej Warzyński (banach-space) <details> <summary>Changes</summary> Direct follow-up of #<!-- -->7312 - the linker on Darwin does not support `-whole-archive`, so that needs to be removed from the linker invocation. For context: * https://github.com/llvm/llvm-project/pull/7312 --- Full diff: https://github.com/llvm/llvm-project/pull/75393.diff 1 Files Affected: - (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+9-5) ``````````diff diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 51b336216c5653..4ce456d52c3e5e 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1128,20 +1128,24 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args, // --whole-archive flag to the link line. If it's not, add a proper // --whole-archive/--no-whole-archive bracket to the link line. bool WholeArchiveActive = false; - for (auto *Arg : Args.filtered(options::OPT_Wl_COMMA)) - if (Arg) + for (auto *Arg : Args.filtered(options::OPT_Wl_COMMA)) { + if (Arg) { for (StringRef ArgValue : Arg->getValues()) { if (ArgValue == "--whole-archive") WholeArchiveActive = true; if (ArgValue == "--no-whole-archive") WholeArchiveActive = false; } + } + } - if (!WholeArchiveActive) + if (!WholeArchiveActive && !TC.getTriple().isMacOSX()) { CmdArgs.push_back("--whole-archive"); - CmdArgs.push_back("-lFortran_main"); - if (!WholeArchiveActive) + CmdArgs.push_back("-lFortran_main"); CmdArgs.push_back("--no-whole-archive"); + } else { + CmdArgs.push_back("-lFortran_main"); + } // Perform regular linkage of the remaining runtime libraries. CmdArgs.push_back("-lFortranRuntime"); `````````` </details> https://github.com/llvm/llvm-project/pull/75393 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits