This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf] Print "File: lib.a(file.o)" info when dumping archive files.
ClosedPublic

Authored by ychen on Jul 8 2019, 12:38 PM.

Event Timeline

ychen created this revision.Jul 8 2019, 12:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2019, 12:38 PM
MaskRay added inline comments.Jul 8 2019, 6:39 PM
llvm/test/tools/llvm-readobj/macho-universal-x86_64.i386.test
151

There was one empty line between } and File: , now there are two, due to the Writer.startLine() << "\n"; change.

llvm/tools/llvm-readobj/llvm-readobj.cpp
604

This will give us a trailing empty line. I think in a few other places, we do:

if (not first)
  print a new line

This pattern will not have a trailing empty line.

I think these probably don't matter but it'd be great if we can be consistent in the future..

ychen updated this revision to Diff 208572.Jul 8 2019, 7:13 PM
ychen marked an inline comment as done.
  • update
ychen marked 2 inline comments as done.Jul 8 2019, 7:16 PM

Thank you for capturing that. The added new line in the previous revision is for GNU output. I should have done what LLVM output did: add a prefixing new line.

MaskRay added inline comments.Jul 8 2019, 9:06 PM
llvm/test/tools/llvm-readobj/macho-universal-x86_64.i386.test
167

Add a MULTIHEADER-ARCHIVE-EMPTY: and change this line to:
MULTIHEADER-ARCHIVE-NEXT: File: [[ARFILE]](foo.o)
to capture the newline issue.

ychen updated this revision to Diff 208589.Jul 8 2019, 9:19 PM
  • update
ychen marked an inline comment as done.Jul 8 2019, 9:19 PM
MaskRay accepted this revision.Jul 8 2019, 9:52 PM
MaskRay added inline comments.
llvm/test/tools/llvm-readobj/macho-universal-x86_64.i386.test
167

For consistency other File: should receive the same treatment..

This revision is now accepted and ready to land.Jul 8 2019, 9:52 PM
grimar accepted this revision.Jul 9 2019, 12:25 AM

LGTM

Looks good aside from a couple of minor points.

llvm/test/tools/llvm-readobj/archive.test
5–8

Nit: I don't think it matters too much, but -D is a single-letter option, so would normally only have one dash before it.

8

I think in this test particularly, you should check that there are the right number of new lines before and after "File: ..." using appropriate CHECK-NEXT/EMPTY markers.

llvm/test/tools/llvm-readobj/thin-archive-paths.test
11–12

nit --DARFILE -> -DARFILE

ychen updated this revision to Diff 208821.Jul 9 2019, 2:49 PM
ychen marked 4 inline comments as done.
  • update
This revision was automatically updated to reflect the committed changes.