https://github.com/khyperia created https://github.com/llvm/llvm-project/pull/121231
This is my first LLVM PR! Please feel free to provide feedback/etc. - I am especially unsure about the `Options.td` change - I just kind of guessed here. Partially fixes https://github.com/llvm/llvm-project/issues/59552 - opting for `-fuse-lipo=llvm-lipo` rather than `-fuse-llvm-darwin-tools` since it solves my use case, and I figure that if `-fuse-llvm-darwin-tools` is eventually added, it'll still be nice to have the fine-grained control with `-fuse-lipo`. --- My use case is that I'm cross compiling from Windows to Mac (creating an arm/x86 dylib), so I don't have the native `lipo`. Additionally, the binaries included in the release file `LLVM-19.1.0-Windows-X64.tar.xz` only includes `llvm-lipo.exe`, no `lipo.exe` alias/link, so clang fails to find `lipo` when making a universal dylib. The release file `LLVM-19.1.6-win64.exe` does not include `llvm-lipo.exe` at all. I'm going to look into including that next. >From 51401ec4a8af7d926ba3c9faa818ecb9c68c0db7 Mon Sep 17 00:00:00 2001 From: khyperia <953151+khype...@users.noreply.github.com> Date: Fri, 27 Dec 2024 22:12:52 +0100 Subject: [PATCH] Add -fuse-lipo option --- clang/include/clang/Driver/Options.td | 1 + clang/lib/Driver/ToolChains/Darwin.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index d922709db17786..6cd23de87bacde 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -6654,6 +6654,7 @@ def fbinutils_version_EQ : Joined<["-"], "fbinutils-version=">, def fuse_ld_EQ : Joined<["-"], "fuse-ld=">, Group<f_Group>, Flags<[LinkOption]>, Visibility<[ClangOption, FlangOption, CLOption]>; def ld_path_EQ : Joined<["--"], "ld-path=">, Group<Link_Group>; +def fuse_lipo_EQ : Joined<["-"], "fuse-lipo=">, Group<f_clang_Group>, Flags<[LinkOption]>; defm align_labels : BooleanFFlag<"align-labels">, Group<clang_ignored_gcc_optimization_f_Group>; def falign_labels_EQ : Joined<["-"], "falign-labels=">, Group<clang_ignored_gcc_optimization_f_Group>; diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index 4105d38d15d7d8..c23f6830b8c764 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -910,7 +910,8 @@ void darwin::Lipo::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back(II.getFilename()); } - const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("lipo")); + std::string LipoName = std::string(Args.getLastArgValue(options::OPT_fuse_lipo_EQ, "lipo")); + const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath(LipoName.c_str())); C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(), Exec, CmdArgs, Inputs, Output)); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits