[PATCH] D112879: [MachO] Use error instead of fatal for missing -arch
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 31 16:32:01 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG264d3b6d4e08: [MachO] Use error instead of fatal for missing -arch (authored by smeenai).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112879/new/
https://reviews.llvm.org/D112879
Files:
lld/MachO/Driver.cpp
lld/test/MachO/color-diagnostics.test
lld/test/MachO/driver.test
lld/test/MachO/search-paths-darwin.test
Index: lld/test/MachO/search-paths-darwin.test
===================================================================
--- lld/test/MachO/search-paths-darwin.test
+++ lld/test/MachO/search-paths-darwin.test
@@ -3,7 +3,7 @@
RUN: mkdir -p %t1 %t2
-RUN: not ld64.lld -arch x86_64 -v -L%t1 -F%t2 2>&1 | FileCheck -DLDIR=%t1 -DFDIR=%t2 %s
+RUN: not ld64.lld -arch x86_64 -platform_version macos 10.5 11.0 -v -L%t1 -F%t2 2>&1 | FileCheck -DLDIR=%t1 -DFDIR=%t2 %s
CHECK: Library search paths:
CHECK-NEXT: [[LDIR]]
CHECK-NEXT: /usr/lib
@@ -12,7 +12,7 @@
CHECK-NEXT: /Library/Frameworks
CHECK-NEXT: /System/Library/Frameworks
-RUN: not ld64.lld -arch x86_64 -v -L%t1 -F%t2 -Z 2>&1 | FileCheck -DLDIR=%t1 -DFDIR=%t2 --check-prefix=CHECK_Z %s
+RUN: not ld64.lld -arch x86_64 -platform_version macos 10.5 11.0 -v -L%t1 -F%t2 -Z 2>&1 | FileCheck -DLDIR=%t1 -DFDIR=%t2 --check-prefix=CHECK_Z %s
CHECK_Z: Library search paths:
CHECK_Z-NEXT: [[LDIR]]
CHECK_Z-NEXT: Framework search paths:
Index: lld/test/MachO/driver.test
===================================================================
--- lld/test/MachO/driver.test
+++ lld/test/MachO/driver.test
@@ -3,5 +3,4 @@
# RUN: not %lld ---help 2>&1 | FileCheck -check-prefix=SPELLHELP %s
SPELLHELP: error: unknown argument '---help', did you mean '--help'
-# FIXME: This should say "no input files" instead
-SPELLHELP: error: undefined symbol: _main
+# FIXME: We should also output a "no input files" error
Index: lld/test/MachO/color-diagnostics.test
===================================================================
--- lld/test/MachO/color-diagnostics.test
+++ lld/test/MachO/color-diagnostics.test
@@ -1,12 +1,11 @@
# Windows command prompt doesn't support ANSI escape sequences.
# REQUIRES: shell
-# RUN: not %lld -xyz --color-diagnostics /nosuchfile 2>&1 \
+# RUN: not %lld --color-diagnostics /nosuchfile 2>&1 \
# RUN: | FileCheck -check-prefix=COLOR %s
-# RUN: not %lld -xyz --color-diagnostics=always /nosuchfile 2>&1 \
+# RUN: not %lld --color-diagnostics=always /nosuchfile 2>&1 \
# RUN: | FileCheck -check-prefix=COLOR %s
-# COLOR: {{lld: .\[0;31merror: .\[0munknown argument '-xyz'}}
# COLOR: {{lld: .\[0;31merror: .\[0mcannot open /nosuchfile}}
# RUN: not %lld --color-diagnostics=foobar 2>&1 | FileCheck -check-prefix=ERR %s
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -659,10 +659,12 @@
// Has the side-effect of setting Config::target.
static TargetInfo *createTargetInfo(InputArgList &args) {
StringRef archName = args.getLastArgValue(OPT_arch);
- if (archName.empty())
- fatal("must specify -arch");
- PlatformKind platform = parsePlatformVersion(args);
+ if (archName.empty()) {
+ error("must specify -arch");
+ return nullptr;
+ }
+ PlatformKind platform = parsePlatformVersion(args);
config->platformInfo.target =
MachO::Target(getArchitectureFromName(archName), platform);
@@ -680,7 +682,8 @@
case CPU_TYPE_ARM:
return createARMTargetInfo(cpuSubtype);
default:
- fatal("missing or unsupported -arch " + archName);
+ error("missing or unsupported -arch " + archName);
+ return nullptr;
}
}
@@ -1118,6 +1121,8 @@
target = createTargetInfo(args);
depTracker =
make<DependencyTracker>(args.getLastArgValue(OPT_dependency_info));
+ if (errorCount())
+ return false;
config->osoPrefix = args.getLastArgValue(OPT_oso_prefix);
if (!config->osoPrefix.empty()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112879.383694.patch
Type: text/x-patch
Size: 3541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211031/c1730415/attachment.bin>
More information about the llvm-commits
mailing list