[PATCH] D141638: [lld-macho] Downgrade missing fat arch to warning

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 14:45:00 PST 2023


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

This mirrors ld64's behavior. In many cases this likely still leads to a
link failure but if you didn't actually use anything from the library
it can be ignored. If you care about these invalid cases -fatal_warnings
still upgrades it back to an error.

Example: https://github.com/keith/ld64.lld/issues/3


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141638

Files:
  lld/MachO/InputFiles.cpp
  lld/test/MachO/fat-arch.s


Index: lld/test/MachO/fat-arch.s
===================================================================
--- lld/test/MachO/fat-arch.s
+++ lld/test/MachO/fat-arch.s
@@ -9,9 +9,9 @@
 # RUN: llvm-lipo %t.i386.o %t.x86_64.o -create -o %t.fat.o
 # RUN: %lld -o /dev/null %t.fat.o
 # RUN: llvm-lipo %t.i386.o -create -o %t.noarch.o
-# RUN: not %lld -o /dev/null %t.noarch.o 2>&1 | \
+# RUN: not %no-fatal-warnings-lld -o /dev/null %t.noarch.o 2>&1 | \
 # RUN:    FileCheck %s -DFILE=%t.noarch.o
-# CHECK: error: unable to find matching architecture in [[FILE]]
+# CHECK: warning: unable to find matching architecture in [[FILE]]
 
 ## Validates that we read the cpu-subtype correctly from a fat exec.
 # RUN: %lld -o %t.x86_64.out %t.x86_64.o
@@ -25,7 +25,7 @@
 
 # CPU-SUB:            magic     cputype      cpusubtype   caps      filetype   ncmds sizeofcmds      flags
 # CPU-SUB-NEXT:  0xfeedfacf     16777223              3  0x{{.+}}    {{.+}}  {{.+}}    {{.+}}      {{.+}}
-	
+
 # CPU-SUB: Fat headers
 # CPU-SUB: nfat_arch 2
 # CPU-SUB: architecture 0
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -251,7 +251,7 @@
                                               path.copy(bAlloc));
   }
 
-  error("unable to find matching architecture in " + path);
+  warn("unable to find matching architecture in " + path);
   return std::nullopt;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141638.488782.patch
Type: text/x-patch
Size: 1451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230112/ad6f1afd/attachment.bin>


More information about the llvm-commits mailing list