diff options
author | Adrian McCarthy <amccarth@google.com> | 2016-09-29 20:28:25 +0000 |
---|---|---|
committer | Adrian McCarthy <amccarth@google.com> | 2016-09-29 20:28:25 +0000 |
commit | d1185fc081ead71a8bf239ff1814f5ff73084c15 (patch) | |
tree | 389d6e401e26b12888214c10f1dbfbbae2c54c7c /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | f084edf40efdf12df707a41a61c9059d777a167e (diff) | |
download | bcm5719-llvm-d1185fc081ead71a8bf239ff1814f5ff73084c15.tar.gz bcm5719-llvm-d1185fc081ead71a8bf239ff1814f5ff73084c15.zip |
Clamp version number in S_COMPILE3 to avoid overflowing 16-bit field.
llvm-svn: 282761
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 821b3b917e9..5d1f08bf30b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -614,11 +614,12 @@ void CodeViewDebug::emitCompilerInformation() { // Some Microsoft tools, like Binscope, expect a backend version number of at // least 8.something, so we'll coerce the LLVM version into a form that // guarantees it'll be big enough without really lying about the version. - Version BackVer = {{ - 1000 * LLVM_VERSION_MAJOR + - 10 * LLVM_VERSION_MINOR + - LLVM_VERSION_PATCH, - 0, 0, 0 }}; + int Major = 1000 * LLVM_VERSION_MAJOR + + 10 * LLVM_VERSION_MINOR + + LLVM_VERSION_PATCH; + // Clamp it for builds that use unusually large version numbers. + Major = std::min<int>(Major, std::numeric_limits<uint16_t>::max()); + Version BackVer = {{ Major, 0, 0, 0 }}; OS.AddComment("Backend version"); for (int N = 0; N < 4; ++N) OS.EmitIntValue(BackVer.Part[N], 2); |