This is an archive of the discontinued LLVM Phabricator instance.

[obj2yaml] - Report a error when unable to resolve a sh_link reference properly.
ClosedPublic

Authored by grimar on Jul 24 2019, 8:32 AM.

Details

Summary

Because of a bug we did not report a error in the case
shown in the test. With this patch we do.

Diff Detail

Event Timeline

grimar created this revision.Jul 24 2019, 8:32 AM
MaskRay added inline comments.Jul 25 2019, 1:38 AM
tools/obj2yaml/elf2yaml.cpp
380

So this prepends a message to the existing toString(LinkSection.takeError()).

LGTM, but let's see what james wants to say.

MaskRay accepted this revision.Jul 25 2019, 1:38 AM
This revision is now accepted and ready to land.Jul 25 2019, 1:38 AM
grimar marked an inline comment as done.Jul 25 2019, 1:44 AM
grimar added inline comments.
tools/obj2yaml/elf2yaml.cpp
380

So this prepends a message to the existing toString(LinkSection.takeError()).

Yeah, but the initial probem was in double takeError() call. As a result no error was reported at all.

James, do you have anything to add?

James, do you have anything to add?

Sorry, it's been a busy couple of days, and I ran out of time to look at this yesterday. Code change looks fine. Just a comment about the test.

test/tools/obj2yaml/elf-shlink.yaml
2

Should we have a test case to show that it can handle the elf-shlink value otherwise, or does that already exist?

If it already exists (or for some reason don't want it), perhaps you should rename this file elf-shlink-invalid.yaml.

James, do you have anything to add?

Sorry, it's been a busy couple of days, and I ran out of time to look at this yesterday. Code change looks fine. Just a comment about the test.

No worries at all. I shouldn't have to ping you first of all, since LLVM policy suggest to do this once in a ~week.
(I just supposed you probably missed this comment for some reason, but there is definetely no need to rush in this or another patches I post).
Thanks for looking!

grimar updated this revision to Diff 211911.Jul 26 2019, 4:42 AM
grimar marked 2 inline comments as done.
  • Addressed review comments.
test/tools/obj2yaml/elf-shlink.yaml
2

Should we have a test case to show that it can handle the elf-shlink value otherwise, or does that already exist?

We have a lot of tests in tools/obj2yaml that do something like: Link: .dynsym. I.e. refer to an existent section by name.
But probably this is kind of implicit and not complete way.

So, I think you're right anf it might worth to test the behavior explicitly here. I added the tests.

grimar closed this revision.Jul 29 2019, 2:42 AM

Revision: 367203