[PATCH] D113071: [lld-macho] Ignore -arch_errors_fatal since it's enabled by default

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 17:07:02 PDT 2021


keith created this revision.
Herald added a subscriber: dang.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
Herald added a reviewer: lld-macho.
keith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This ld64 flag is enabled by default via this logic

https://github.com/llvm/llvm-project/blob/1a605f395ff079ced140f04ee743dbfc7fc46ec9/lld/MachO/InputFiles.cpp#L791-L797

ld64 does not have a way to disable this either. Given this we can
safely ignore this flag instead of warning about it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113071

Files:
  lld/MachO/Driver.cpp
  lld/MachO/Options.td
  lld/test/MachO/invalid/incompatible-arch.s


Index: lld/test/MachO/invalid/incompatible-arch.s
===================================================================
--- lld/test/MachO/invalid/incompatible-arch.s
+++ lld/test/MachO/invalid/incompatible-arch.s
@@ -3,7 +3,9 @@
 # RUN: rm -rf %t && mkdir -p %t
 
 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t/test.o
+# RUN: %lld -arch arm64 -lSystem %t/test.o -o /dev/null -arch_errors_fatal
 # RUN: not %lld -arch x86_64 -lSystem %t/test.o -o /dev/null 2>&1 | FileCheck %s -DFILE=%t/test.o
+# RUN: not %lld -arch x86_64 -arch_errors_fatal -lSystem %t/test.o -o /dev/null 2>&1 | FileCheck %s -DFILE=%t/test.o
 # CHECK: error: {{.*}}[[FILE]] has architecture arm64 which is incompatible with target architecture x86_64
 
 # RUN: %lld -dylib -arch arm64 -platform_version macOS 10.14 10.15 -o %t/out.dylib %t/test.o
Index: lld/MachO/Options.td
===================================================================
--- lld/MachO/Options.td
+++ lld/MachO/Options.td
@@ -865,10 +865,6 @@
     HelpText<"Suppresses warnings about inputs whose architecture does not match the -arch option">,
     Flags<[HelpHidden]>,
     Group<grp_rare>;
-def arch_errors_fatal : Flag<["-"], "arch_errors_fatal">,
-    HelpText<"Escalate to errors any warnings about inputs whose architecture does not match the -arch option">,
-    Flags<[HelpHidden]>,
-    Group<grp_rare>;
 def e : Separate<["-"], "e">,
     MetaVarName<"<symbol>">,
     HelpText<"Make <symbol> the entry point of an executable (default is \"start\" from crt1.o)">,
@@ -1331,3 +1327,10 @@
     HelpText<"This option is ignored in ld64">,
     Flags<[HelpHidden]>,
     Group<grp_ignored>;
+
+def grp_ignored_silently : OptionGroup<"ignored_silently">, HelpText<"IGNORED SILENTLY">;
+
+def arch_errors_fatal : Flag<["-"], "arch_errors_fatal">,
+    HelpText<"Escalate to errors any warnings about inputs whose architecture does not match the -arch option, enabled by default">,
+    Flags<[HelpHidden]>,
+    Group<grp_ignored_silently>;
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -766,6 +766,8 @@
   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...");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113071.384281.patch
Type: text/x-patch
Size: 2431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211103/c2aaed07/attachment.bin>


More information about the llvm-commits mailing list