This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj/elf] - Report "bitcode files are not supported" warning for bitcode files.
ClosedPublic

Authored by grimar on Jan 28 2021, 2:58 AM.

Details

Summary

Fixes https://bugs.llvm.org/show_bug.cgi?id=43543

Currently we report "The file was not recognized as a valid object file" for BC files.
Also, we terminate dumping.

Instead we could report a better warning and try to continue dumping other files.
This is what this patch implements.

Diff Detail

Event Timeline

grimar created this revision.Jan 28 2021, 2:58 AM
grimar requested review of this revision.Jan 28 2021, 2:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2021, 2:58 AM
jhenderson added inline comments.Jan 28 2021, 5:32 AM
llvm/test/tools/llvm-readobj/basic.test
24
27

I'm guessing the problem is related to the third and fourth bytes being greater than 0x7f and therefore potentially signed?

33–34

Did you mean to repeat this check twice? Doesn't seem to be much point in that... I'm guessing you meant to do them the other way around.

llvm/tools/llvm-readobj/llvm-readobj.cpp
659

Error messages generally don't end in a full stop.

grimar marked an inline comment as done.Jan 28 2021, 5:34 AM
grimar added inline comments.
llvm/test/tools/llvm-readobj/basic.test
33–34

It is correct: the first tests the llvm-readelf, and the second calls llvm-readobj.

jhenderson added inline comments.Jan 28 2021, 5:37 AM
llvm/test/tools/llvm-readobj/basic.test
33–34

Oops, thanks!

grimar updated this revision to Diff 319849.Jan 28 2021, 6:28 AM
grimar marked 5 inline comments as done.
  • Addressed review comments.
llvm/test/tools/llvm-readobj/basic.test
27

I'm guessing the problem is related to the third and fourth bytes being greater than 0x7f and therefore potentially signed?

Hmm, looks like that!

The output of echo -e -n "\x7e\x7f\x80\x81" is 7e 7f c2 80 c2 81

jhenderson accepted this revision.Jan 28 2021, 6:35 AM

LGTM.

llvm/test/tools/llvm-readobj/basic.test
27
This revision is now accepted and ready to land.Jan 28 2021, 6:35 AM