[lld] 7c7e39d - [lld-macho] Fix map file test on 32 bit hosts
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 6 02:45:20 PST 2022
Author: David Spickett
Date: 2022-12-06T10:45:07Z
New Revision: 7c7e39db7a973767378e4371308aa507c903b179
URL: https://github.com/llvm/llvm-project/commit/7c7e39db7a973767378e4371308aa507c903b179
DIFF: https://github.com/llvm/llvm-project/commit/7c7e39db7a973767378e4371308aa507c903b179.diff
LOG: [lld-macho] Fix map file test on 32 bit hosts
The test added in https://reviews.llvm.org/D137368 has been failing
on our 32 bit arm bots:
https://lab.llvm.org/buildbot/#/builders/178/builds/3460
You get this for the strings:
<<dead>> 0x883255000000003 [ 10] literal string: Hello, it's me
Instead of the expected:
<<dead>> 0x0000000F [ 3] literal string: Hello, it's me
This is because unlike symbols whose size is a uint64_t, strings
use a StringRef whose size is size_t. size_t changes size between
32 and 64 bit platforms.
This fixes the test by using %z to print the size of the strings,
this works for 32 and 64 bit.
Added:
Modified:
lld/MachO/MapFile.cpp
Removed:
################################################################################
diff --git a/lld/MachO/MapFile.cpp b/lld/MachO/MapFile.cpp
index 5d6c87baba9f1..a136c7292c55a 100644
--- a/lld/MachO/MapFile.cpp
+++ b/lld/MachO/MapFile.cpp
@@ -197,7 +197,7 @@ void macho::writeMapFile() {
sym->getName().str().data());
}
for (CStringInfo &cstrInfo : info.deadCStrings) {
- os << format("<<dead>>\t0x%08llX\t[%3u] literal string: ",
+ os << format("<<dead>>\t0x%08zX\t[%3u] literal string: ",
cstrInfo.str.size() + 1, cstrInfo.fileIndex);
os.write_escaped(cstrInfo.str) << "\n";
}
More information about the llvm-commits
mailing list