[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
Fri Aug 26 05:29:29 PDT 2022
xgupta updated this revision to Diff 455877.
xgupta added a comment.
Address comment for printing archive statistics
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132364/new/
https://reviews.llvm.org/D132364
Files:
llvm/test/tools/llvm-size/archive.test
llvm/test/tools/llvm-size/elf-m.test
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
@@ -570,6 +570,8 @@
else if (MachO && OutputFormat == darwin)
outs() << a->getFileName() << "(" << o->getFileName() << "):\n";
printObjectSectionSizes(o);
+ if (!MachO && OutputFormat == darwin)
+ outs() << o->getFileName() << " (ex " << a->getFileName() << ")\n";
if (OutputFormat == berkeley) {
if (MachO)
outs() << a->getFileName() << "(" << o->getFileName() << ")\n";
@@ -836,6 +838,8 @@
else if (MachO && OutputFormat == darwin && MoreThanOneFile)
outs() << o->getFileName() << ":\n";
printObjectSectionSizes(o);
+ if (!MachO && OutputFormat == darwin)
+ outs() << o->getFileName() << "\n";
if (OutputFormat == berkeley) {
if (!MachO || MoreThanOneFile)
outs() << o->getFileName();
Index: llvm/test/tools/llvm-size/elf-m.test
===================================================================
--- llvm/test/tools/llvm-size/elf-m.test
+++ llvm/test/tools/llvm-size/elf-m.test
@@ -2,13 +2,11 @@
## specified and the input is not Mach-O.
# RUN: yaml2obj %s -o %t
-# RUN: llvm-size -m %t | FileCheck %s
-# RUN: llvm-size --format=darwin %t | FileCheck %s
+# RUN: llvm-size -m %t | FileCheck -DFILE=%t %s
+# RUN: llvm-size --format=darwin %t | FileCheck -DFILE=%t %s
-## FIXME: The input filename should be printed but isn't currently due to
-## https://bugs.llvm.org/show_bug.cgi?id=42971.
# CHECK: text data bss dec hex filename
-# CHECK-NEXT: 0 0 0 0 0
+# CHECK-NEXT: 0 0 0 0 0 [[FILE]]{{$}}
--- !ELF
FileHeader:
Index: llvm/test/tools/llvm-size/archive.test
===================================================================
--- llvm/test/tools/llvm-size/archive.test
+++ llvm/test/tools/llvm-size/archive.test
@@ -16,6 +16,7 @@
# RUN: llvm-size -B %t2.a | FileCheck %s -DARCHIVE=%t2.a --check-prefix=BERKELEY-1
# RUN: llvm-size -A %t2.a | FileCheck %s -DARCHIVE=%t2.a --check-prefix=SYSV-1
+# RUN: llvm-size -m %t2.a | FileCheck %s -DARCHIVE=%t2.a --check-prefix=DARWIN-1
## Case 3: Multiple members.
# RUN: rm -f %t3.a
@@ -23,6 +24,7 @@
# RUN: llvm-size -B %t3.a | FileCheck %s -DARCHIVE=%t3.a --check-prefixes=BERKELEY-1,BERKELEY-2
# RUN: llvm-size -A %t3.a | FileCheck %s -DARCHIVE=%t3.a --check-prefixes=SYSV-1,SYSV-2
+# RUN: llvm-size -m %t3.a | FileCheck %s -DARCHIVE=%t3.a --check-prefixes=DARWIN-1,DARWIN-2
## Case 4: Mixing archives and non-archives produces sensible output:
# RUN: llvm-size -B %t1 %t2.a %t2 %t3.a \
@@ -31,6 +33,9 @@
# RUN: llvm-size -A %t1 %t2.a %t2 %t3.a \
# RUN: | FileCheck %s -DARCHIVE=%t3.a -DARCHIVE2=%t2.a -DFILE1=%t1 -DFILE2=%t2 \
# RUN: --check-prefixes=SYSV-1,SYSV-2,SYSV-3
+# RUN: llvm-size -B %t1 %t2.a %t2 %t3.a \
+# RUN: | FileCheck %s -DARCHIVE=%t3.a -DARCHIVE2=%t2.a -DFILE1=%t1 -DFILE2=%t2 \
+# RUN: --check-prefixes=DARWIN-1,DARWIN-2,DARWIN-3
# BERKELEY-1: text data bss dec hex filename
# BERKELEY-3-NEXT: 1 2 4 7 7 [[FILE1]]
@@ -81,6 +86,14 @@
# SYSV-2-NEXT: Total 56
# SYSV-1-NOT:{{.}}
+# DARWIN-1: text data bss dec hex filename
+# DARWIN-3-NEXT: 1 2 4 7 7 [[FILE1]]
+# DARWIN-3-NEXT: 1 2 4 7 7 archive.test.tmp1 (ex [[ARCHIVE2]])
+# DARWIN-3-NEXT: 8 16 32 56 38 [[FILE2]]
+# DARWIN-1-NEXT: 1 2 4 7 7 archive.test.tmp1 (ex [[ARCHIVE]])
+# DARWIN-2-NEXT: 8 16 32 56 38 archive.test.tmp2 (ex [[ARCHIVE]])
+# DARWIN-1-NOT:{{.}}
+
--- !ELF
FileHeader:
Class: ELFCLASS64
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132364.455877.patch
Type: text/x-patch
Size: 3903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220826/d3370f2d/attachment.bin>
More information about the llvm-commits
mailing list