This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj]Fix error messages for bad archive members and add testing for archive handling
ClosedPublic

Authored by jhenderson on Feb 26 2019, 8:51 AM.

Details

Summary

llvm-readobj's error messages were broken for bad archive members. This patch fixes them, and also adds testing for archive and thin archive handling within llvm-readobj.

Diff Detail

Repository
rL LLVM

Event Timeline

jhenderson created this revision.Feb 26 2019, 8:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2019, 8:51 AM
This revision is now accepted and ready to land.Feb 26 2019, 6:53 PM
rupprecht accepted this revision.Feb 26 2019, 9:28 PM
rupprecht added inline comments.
test/tools/llvm-readobj/thin-archive.test
16 ↗(On Diff #188390)

Probably not in this patch, but I'd like to see the full filename verified for a thin archive in a nested dir (which I found to be full of errors when dealing with llvm-ar), e.g. something like:

$ mkdir -p %t/x/y/z
$ cd %t # So we can invoke ar/readobj with relative paths
$ cp 1.o 2.o 3.o x/y/z
$ rm -f x/%t.a
$ llvm-ar rcT x/%t.a x/y/z/*.o
$ llvm-readobj --file-headers x/%t.a | FileCheck %s

# Full filename should be printed; possibly(?) replacing / with \ on Windows
# (IIRC it's stored as / in the raw archive contents, although readobj may translate that on the fly to \)
CHECK: File: y/z/1.o
...
jhenderson marked an inline comment as done.Feb 27 2019, 2:08 AM
jhenderson added inline comments.
test/tools/llvm-readobj/thin-archive.test
16 ↗(On Diff #188390)

Sounds reasonable. I'll take a look. If it's broken, I'll probably just file a bug, unless it's an obvious one-line fix (currently I'm focusing on testing).

grimar accepted this revision.Feb 27 2019, 2:12 AM

LGTM.

This revision was automatically updated to reflect the committed changes.