From 2058e9dff09d2ba750602429717aa16d22e24719 Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Tue, 9 Feb 2016 18:33:15 +0000 Subject: [PATCH] Fix a formatting problems with llvm-size and the -m option. It was using format() with a string for 64-bit types but was passed a 32-bit type in places when printing values for 32-bit Mach-O files. rdar://24542509 llvm-svn: 260243 --- llvm/test/tools/llvm-size/Inputs/darwin-m.o | Bin 0 -> 228 bytes llvm/test/tools/llvm-size/darwin-m.test | 7 +++++++ llvm/tools/llvm-size/llvm-size.cpp | 10 ++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 llvm/test/tools/llvm-size/Inputs/darwin-m.o create mode 100644 llvm/test/tools/llvm-size/darwin-m.test diff --git a/llvm/test/tools/llvm-size/Inputs/darwin-m.o b/llvm/test/tools/llvm-size/Inputs/darwin-m.o new file mode 100644 index 0000000000000000000000000000000000000000..9672df524c7c3d885c3307cf24f3587fa1655850 GIT binary patch literal 228 zcmX^2>+L@t1_lOBAZCQ(13(%CK>PzB1{S~p6uSe&AetSDnSeA1#K)JUR+K>45Ppbj vLgetSegmentLoadCommand(Load); + uint64_t Seg_vmsize = Seg.vmsize; outs() << "Segment " << Seg.segname << ": " - << format(fmt.str().c_str(), Seg.vmsize); + << format(fmt.str().c_str(), Seg_vmsize); if (DarwinLongFormat) - outs() << " (vmaddr 0x" << format("%" PRIx64, Seg.vmaddr) << " fileoff " + outs() << " (vmaddr 0x" << format("%" PRIx32, Seg.vmaddr) << " fileoff " << Seg.fileoff << ")"; outs() << "\n"; total += Seg.vmsize; @@ -186,9 +187,10 @@ static void PrintDarwinSectionSizes(MachOObjectFile *MachO) { << format("%.16s", &Sec.sectname) << "): "; else outs() << "\tSection " << format("%.16s", &Sec.sectname) << ": "; - outs() << format(fmt.str().c_str(), Sec.size); + uint64_t Sec_size = Sec.size; + outs() << format(fmt.str().c_str(), Sec_size); if (DarwinLongFormat) - outs() << " (addr 0x" << format("%" PRIx64, Sec.addr) << " offset " + outs() << " (addr 0x" << format("%" PRIx32, Sec.addr) << " offset " << Sec.offset << ")"; outs() << "\n"; sec_total += Sec.size; -- 2.7.4