[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.
This commit is contained in:
David Spickett
2022-12-06 10:30:38 +00:00
parent 2f778e60c9
commit 7c7e39db7a

View File

@@ -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";
}