[lld] e7fdff4 - [lld-macho] Silently ignore the -objc_abi_version
Keith Smiley via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 3 22:28:01 PDT 2021
Author: Keith Smiley
Date: 2021-11-03T22:16:09-07:00
New Revision: e7fdff403e849b18d93cd4a5cb760cba66a92c0b
URL: https://github.com/llvm/llvm-project/commit/e7fdff403e849b18d93cd4a5cb760cba66a92c0b
DIFF: https://github.com/llvm/llvm-project/commit/e7fdff403e849b18d93cd4a5cb760cba66a92c0b.diff
LOG: [lld-macho] Silently ignore the -objc_abi_version
This undocumented ld64 flag, based on the most recent ld64 source dump
from Xcode 12, only applies to i386. It seems like on all newer
architectures this behavior is the default.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/D113070
Added:
lld/test/MachO/silent-ignore.s
Modified:
lld/MachO/Driver.cpp
lld/MachO/Options.td
Removed:
lld/test/MachO/silent-ignore.test
################################################################################
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index d811ba28197a2..255f0f2520da5 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -780,6 +780,8 @@ static void warnIfUnimplementedOption(const Option &opt) {
case OPT_grp_ignored:
warn("Option `" + opt.getPrefixedName() + "' is ignored.");
break;
+ case OPT_grp_ignored_silently:
+ break;
default:
warn("Option `" + opt.getPrefixedName() +
"' is not yet implemented. Stay tuned...");
diff --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 8067a69f0dfda..f4eb302a95b77 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -1277,10 +1277,6 @@ def no_new_main : Flag<["-"], "no_new_main">,
HelpText<"This option is undocumented in ld64">,
Flags<[HelpHidden]>,
Group<grp_undocumented>;
-def objc_abi_version : Separate<["-"], "objc_abi_version">,
- HelpText<"This option is undocumented in ld64">,
- Flags<[HelpHidden]>,
- Group<grp_undocumented>;
def pause : Flag<["-"], "pause">,
HelpText<"This option is undocumented in ld64">,
Flags<[HelpHidden]>,
@@ -1324,3 +1320,10 @@ def new_linker : Flag<["-"], "new_linker">,
HelpText<"This option is ignored in ld64">,
Flags<[HelpHidden]>,
Group<grp_ignored>;
+
+def grp_ignored_silently : OptionGroup<"ignored_silently">, HelpText<"IGNORED SILENTLY">;
+
+def objc_abi_version : Separate<["-"], "objc_abi_version">,
+ HelpText<"This option only applies to i386 in ld64">,
+ Flags<[HelpHidden]>,
+ Group<grp_ignored_silently>;
diff --git a/lld/test/MachO/silent-ignore.s b/lld/test/MachO/silent-ignore.s
new file mode 100644
index 0000000000000..5700a77c9313e
--- /dev/null
+++ b/lld/test/MachO/silent-ignore.s
@@ -0,0 +1,28 @@
+# REQUIRES: x86
+
+## Check that we correctly parse these flags, even though they are
+## unimplemented. ## We may still emit warnings or errors for some of the
+## unimplemented ones (but those ## errors are squelched because of the
+## `--version` flag.)
+# RUN: %lld --version \
+# RUN: -dynamic \
+# RUN: -no_deduplicate \
+# RUN: -lto_library /lib/foo \
+# RUN: -macosx_version_min 0 \
+# RUN: -no_dtrace_dof \
+# RUN: -dependency_info /path/to/dependency_info.dat \
+# RUN: -lto_library ../lib/libLTO.dylib \
+# RUN: -mllvm -time-passes \
+# RUN: -objc_abi_version 2 \
+# RUN: -ios_simulator_version_min 9.0.0 \
+# RUN: -sdk_version 13.2
+# RUN: not %lld -v --not-an-ignored-argument 2>&1 | FileCheck %s
+# CHECK: error: unknown argument '--not-an-ignored-argument'
+
+## Check that we don't emit any warnings nor errors for these unimplemented flags.
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
+# RUN: %lld %t.o -o /dev/null -objc_abi_version 2
+
+.globl _main
+_main:
+ ret
diff --git a/lld/test/MachO/silent-ignore.test b/lld/test/MachO/silent-ignore.test
deleted file mode 100644
index 2cabd79d73ce5..0000000000000
--- a/lld/test/MachO/silent-ignore.test
+++ /dev/null
@@ -1,14 +0,0 @@
-RUN: %lld --version \
-RUN: -dynamic \
-RUN: -no_deduplicate \
-RUN: -lto_library /lib/foo \
-RUN: -macosx_version_min 0 \
-RUN: -no_dtrace_dof \
-RUN: -dependency_info /path/to/dependency_info.dat \
-RUN: -lto_library ../lib/libLTO.dylib \
-RUN: -mllvm -time-passes \
-RUN: -objc_abi_version 2 \
-RUN: -ios_simulator_version_min 9.0.0 \
-RUN: -sdk_version 13.2
-RUN: not %lld -v --not-an-ignored-argument 2>&1 | FileCheck %s
-CHECK: error: unknown argument '--not-an-ignored-argument'
More information about the llvm-commits
mailing list