[PATCH] D113082: [lld-macho] Implement -arch_errors_fatal

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 07:52:25 PDT 2021


int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

Thanks!



================
Comment at: lld/MachO/InputFiles.cpp:797
+
     return;
   }
----------------
keith wrote:
> I'm not sure if the unconditional return here is the right behavior, or if in the warning case something else should be done here. I think this is right though
yeah we do the same thing for `checkCompatibility` below so the early return of an incompletely initialized `InputFile` should be fine


================
Comment at: lld/MachO/InputFiles.cpp:793
+    if (config->errorForArchMismatch)
+      error(toString(this) + " has architecture " + getArchitectureName(arch) +
+            " which is incompatible with target architecture " +
----------------
could we factor out the arguments somehow? E.g. something like `auto f = config->errorForArchMismatch ? error : warning`? (not sure if that compiles though)


================
Comment at: lld/test/MachO/invalid/incompatible-arch.s:7
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/native.o
+# RUN: not %lld -arch x86_64 -lSystem %t/test.o -o /dev/null -arch_errors_fatal 2>&1 | FileCheck %s -DFILE=%t/test.o --check-prefix=CHECK-ERROR
+# RUN: %no_fatal_warnings_lld -arch x86_64 -lSystem %t/test.o %t/native.o -o /dev/null 2>&1 | FileCheck %s -DFILE=%t/test.o --check-prefix=CHECK-WARNING
----------------
this should be `no_fatal_warnings_lld` too, otherwise we'll get an error regardless of whether `-arch_errors_fatal` is passed


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113082/new/

https://reviews.llvm.org/D113082



More information about the llvm-commits mailing list