aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-08-22 01:48:34 +0000
committerFangrui Song <maskray@google.com>2019-08-22 01:48:34 +0000
commit246750c2a91951fc4b77ebe43d568f47843e6399 (patch)
tree6f7b6233086711c7234d45ac41405910912cc5f7 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent22dc44ff896a34a94c7ed6d3bf7b577b98e34fbd (diff)
downloadllvm-246750c2a91951fc4b77ebe43d568f47843e6399.zip
llvm-246750c2a91951fc4b77ebe43d568f47843e6399.tar.gz
llvm-246750c2a91951fc4b77ebe43d568f47843e6399.tar.bz2
[COFF] Fix section name for constants larger than 64 bits on Windows
APIntToHexString returns wrong value ("0000000000000000ffffffffffffffff") for integer larger than 64 bits, and thus TargetLoweringObjectFileCOFF::getSectionForConstant returns same section name for all numbers larger than 64 bits. This patch tries to fix it. Differential Revision: https://reviews.llvm.org/D66458 Patch by Senran Zhang llvm-svn: 369610
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 7abc86d..ae32360 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1597,7 +1597,8 @@ const MCExpr *TargetLoweringObjectFileCOFF::lowerRelativeReference(
static std::string APIntToHexString(const APInt &AI) {
unsigned Width = (AI.getBitWidth() / 8) * 2;
- std::string HexString = utohexstr(AI.getLimitedValue(), /*LowerCase=*/true);
+ std::string HexString = AI.toString(16, /*Signed=*/false);
+ transform(HexString.begin(), HexString.end(), HexString.begin(), tolower);
unsigned Size = HexString.size();
assert(Width >= Size && "hex string is too large!");
HexString.insert(HexString.begin(), Width - Size, '0');