[lld] d4cf89a - [lld-macho] Downgrade missing fat arch to warning
Keith Smiley via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 12 16:49:24 PST 2023
Author: Keith Smiley
Date: 2023-01-12T16:49:16-08:00
New Revision: d4cf89ad5a374f9f81446f12da2386c96b80d3dc
URL: https://github.com/llvm/llvm-project/commit/d4cf89ad5a374f9f81446f12da2386c96b80d3dc
DIFF: https://github.com/llvm/llvm-project/commit/d4cf89ad5a374f9f81446f12da2386c96b80d3dc.diff
LOG: [lld-macho] Downgrade missing fat arch to warning
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
Differential Revision: https://reviews.llvm.org/D141638
Added:
Modified:
lld/MachO/InputFiles.cpp
lld/test/MachO/fat-arch.s
Removed:
################################################################################
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 5a858c0205aff..bb32ba316a46b 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -251,7 +251,7 @@ std::optional<MemoryBufferRef> macho::readFile(StringRef path) {
path.copy(bAlloc));
}
- error("unable to find matching architecture in " + path);
+ warn("unable to find matching architecture in " + path);
return std::nullopt;
}
diff --git a/lld/test/MachO/fat-arch.s b/lld/test/MachO/fat-arch.s
index 7ccf8b69dc5e7..dd6b61b4d3a2c 100644
--- a/lld/test/MachO/fat-arch.s
+++ b/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
More information about the llvm-commits
mailing list