[PATCH] D88801: [LLD] [COFF] Fix parsing version numbers with leading zeros
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 5 13:08:49 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG19e86336efa7: [LLD] [COFF] Fix parsing version numbers with leading zeros (authored by mstorsjo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88801/new/
https://reviews.llvm.org/D88801
Files:
lld/COFF/DriverUtils.cpp
lld/test/COFF/subsystem.test
lld/test/COFF/version.test
Index: lld/test/COFF/version.test
===================================================================
--- lld/test/COFF/version.test
+++ lld/test/COFF/version.test
@@ -17,3 +17,9 @@
CHECK2: MajorImageVersion: 11
CHECK2: MinorImageVersion: 22
+
+# RUN: lld-link /out:%t.exe /entry:main %t.obj /version:8.09
+# RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=CHECK3 %s
+
+CHECK3: MajorImageVersion: 8
+CHECK3: MinorImageVersion: 9
Index: lld/test/COFF/subsystem.test
===================================================================
--- lld/test/COFF/subsystem.test
+++ lld/test/COFF/subsystem.test
@@ -12,6 +12,10 @@
# RUN: %p/Inputs/ret42.obj
# RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=CHECK2 %s
+# RUN: lld-link /entry:main /out:%t.exe /subsystem:windows,8.09 \
+# RUN: %p/Inputs/ret42.obj
+# RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=CHECK2 %s
+
CHECK2: MajorOperatingSystemVersion: 8
CHECK2: MinorOperatingSystemVersion: 9
CHECK2: MajorSubsystemVersion: 8
Index: lld/COFF/DriverUtils.cpp
===================================================================
--- lld/COFF/DriverUtils.cpp
+++ lld/COFF/DriverUtils.cpp
@@ -88,10 +88,10 @@
void parseVersion(StringRef arg, uint32_t *major, uint32_t *minor) {
StringRef s1, s2;
std::tie(s1, s2) = arg.split('.');
- if (s1.getAsInteger(0, *major))
+ if (s1.getAsInteger(10, *major))
fatal("invalid number: " + s1);
*minor = 0;
- if (!s2.empty() && s2.getAsInteger(0, *minor))
+ if (!s2.empty() && s2.getAsInteger(10, *minor))
fatal("invalid number: " + s2);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88801.296274.patch
Type: text/x-patch
Size: 1616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201005/d3e6242a/attachment.bin>
More information about the llvm-commits
mailing list