[PATCH] D53278: [LLD][ELF] - Check options before processing the -v/-version options.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 15 07:23:53 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344514: [LLD][ELF] - Check options before processing the -v/-version options. (authored by grimar, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D53278?vs=169670&id=169701#toc
Repository:
rL LLVM
https://reviews.llvm.org/D53278
Files:
lld/trunk/ELF/Driver.cpp
lld/trunk/test/ELF/driver.test
Index: lld/trunk/test/ELF/driver.test
===================================================================
--- lld/trunk/test/ELF/driver.test
+++ lld/trunk/test/ELF/driver.test
@@ -62,6 +62,9 @@
# RUN: not ld.lld %t -z foo 2>&1 | FileCheck -check-prefix=ERR10 %s
# ERR10: unknown -z value: foo
+## Check we report "unknown -z value" error even with -v.
+# RUN: not ld.lld %t -z foo -v 2>&1 | FileCheck -check-prefix=ERR10 %s
+
# RUN: not ld.lld %t -z max-page-size 2>&1 | FileCheck -check-prefix=ERR11 %s
# ERR11: unknown -z value: max-page-size
Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/ELF/Driver.cpp
@@ -396,13 +396,6 @@
if (Args.hasArg(OPT_v) || Args.hasArg(OPT_version))
message(getLLDVersion() + " (compatible with GNU linkers)");
- // The behavior of -v or --version is a bit strange, but this is
- // needed for compatibility with GNU linkers.
- if (Args.hasArg(OPT_v) && !Args.hasArg(OPT_INPUT))
- return;
- if (Args.hasArg(OPT_version))
- return;
-
if (const char *Path = getReproduceOption(Args)) {
// Note that --reproduce is a debug option so you can ignore it
// if you are trying to understand the whole picture of the code.
@@ -421,6 +414,14 @@
readConfigs(Args);
checkZOptions(Args);
+
+ // The behavior of -v or --version is a bit strange, but this is
+ // needed for compatibility with GNU linkers.
+ if (Args.hasArg(OPT_v) && !Args.hasArg(OPT_INPUT))
+ return;
+ if (Args.hasArg(OPT_version))
+ return;
+
initLLVM();
createFiles(Args);
if (errorCount())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53278.169701.patch
Type: text/x-patch
Size: 1642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181015/852546bc/attachment.bin>
More information about the llvm-commits
mailing list