[llvm] e8c10fc - [llvm-libtool-darwin] Parse and ignore -syslibroot
Keith Smiley via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 3 09:54:16 PDT 2022
Author: Keith Smiley
Date: 2022-10-03T09:53:01-07:00
New Revision: e8c10fc1811f2cf7e9a2b4921d9a065ee6384588
URL: https://github.com/llvm/llvm-project/commit/e8c10fc1811f2cf7e9a2b4921d9a065ee6384588
DIFF: https://github.com/llvm/llvm-project/commit/e8c10fc1811f2cf7e9a2b4921d9a065ee6384588.diff
LOG: [llvm-libtool-darwin] Parse and ignore -syslibroot
cctools libtool allows you to link dynamic libraries by passing through
a number of arguments to ld64. Because of this the default arguments
libtool receives in Xcode contains arguments that only matter in that
case. This change ignores this argument, at least until we ever support
that dynamic use case, so that you can use llvm-libtool-darwin as a
drop-in replacement in Xcode for cctools libtool. There are more
arguments we could ignore for this case, but we can probably add those
as the use case comes up.
Differential Revision: https://reviews.llvm.org/D134309
Added:
llvm/test/tools/llvm-libtool-darwin/ignored-options.test
Modified:
llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-libtool-darwin/ignored-options.test b/llvm/test/tools/llvm-libtool-darwin/ignored-options.test
new file mode 100644
index 0000000000000..3b5386eb1fb52
--- /dev/null
+++ b/llvm/test/tools/llvm-libtool-darwin/ignored-options.test
@@ -0,0 +1,8 @@
+## This tests some flags are correctly parsed even when they're not handled
+
+# RUN: llvm-libtool-darwin -V -syslibroot foo | FileCheck %s
+# RUN: llvm-libtool-darwin -h | FileCheck --check-prefix=HELP %s
+
+# CHECK: Default target:
+
+# HELP-NOT: syslibroot
diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
index 08b371ecd3b57..8d4529cddf365 100644
--- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
+++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
@@ -101,6 +101,8 @@ static cl::opt<bool> WarningsAsErrors("warnings_as_errors",
cl::cat(LibtoolCategory),
cl::init(false));
+static cl::opt<std::string> IgnoredSyslibRoot("syslibroot", cl::Hidden);
+
static const std::array<std::string, 3> StandardSearchDirs{
"/lib",
"/usr/lib",
More information about the llvm-commits
mailing list