[PATCH] D132364: [llvm-size] Fix missing file name for darwin output format with non-Mach-O

Shivam Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 03:03:59 PDT 2022


xgupta created this revision.
xgupta added reviewers: jhenderson, MaskRay.
Herald added subscribers: StephenFan, rupprecht.
Herald added a project: All.
xgupta requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

llvm-size falls back to printing in Berkeley format, if --format=darwin is specified and a non-Mach-O object has been provided. However, it does not print the input filename when it should:

Before - 
(base) xgupta at archlinux ~/llvm/llvm-project/build (main*) $ llvm-size ~/hello.o --format=darwin

  text	   data	    bss	    dec	    hex	filename
   291	      0	      0	    291	    123	%        

After -
(base) xgupta at archlinux ~/llvm/llvm-project/build (main*) $ bin/llvm-size ~/hello.o --format=darwin

  text	   data	    bss	    dec	    hex	filename
   291	      0	      0	    291	    123	/home/xgupta/hello.o

Fix #42316


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132364

Files:
  llvm/tools/llvm-size/llvm-size.cpp


Index: llvm/tools/llvm-size/llvm-size.cpp
===================================================================
--- llvm/tools/llvm-size/llvm-size.cpp
+++ llvm/tools/llvm-size/llvm-size.cpp
@@ -508,6 +508,9 @@
     fmt << "%7" << (Radix == octal ? PRIo64 : PRIu64) << "\t"
         << "%7" PRIx64 "\t";
     outs() << format(fmt.str().c_str(), total, total);
+
+    if (!MachO && OutputFormat == darwin)
+      outs() << Obj->getFileName() << "\n";
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132364.454432.patch
Type: text/x-patch
Size: 457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220822/9f1e9fe7/attachment.bin>


More information about the llvm-commits mailing list