This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Do not call fatal() in Target.cpp, call error() instead.
ClosedPublic

Authored by grimar on Dec 20 2016, 1:51 AM.

Details

Summary

That is useful from many sides I think.
We probably would want to avoid fatal() if we can in context of librarification,
but for me reason of that patch is to help D27900 go.

D27900 changes errors reporting to something like
error: text1
note: text2
note: text3

where hint used to provide additional information about location. In that case
I can't just call fatal() because user will not see notes after that what adds additional complication to handle.
What is good that Target.cpp looks the only such place and this patch changes it.

Also it adds testcase with broken relocation. Previously we did not have any,
It checks that error() instead of fatal() works fine.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 82069.Dec 20 2016, 1:51 AM
grimar retitled this revision from to [ELF] - Do not call fatal() in Target.cpp, call error() instead..
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, evgeny777.
davide added a subscriber: davide.Dec 20 2016, 6:26 AM

Instead of checking in a binary, I'll see if you can craft a broken object using yaml2obj.
I'm not a huge fan of the tool itself, but I find this a very legitimate usecase for it (creating broken binaries).

Instead of checking in a binary, I'll see if you can craft a broken object using yaml2obj.
I'm not a huge fan of the tool itself, but I find this a very legitimate usecase for it (creating broken binaries).

No it looks not possible. It showed me a error when I tried to create a relocation using numeric value and not a pre-defined enum. So I believe it is a unreasonable limitaion of yaml2obj now.

I mean I tried to create broken relocation, I do not know if just numeric alias works, but huge value like I use in this patch - 0x99 - definetely does not.

Instead of checking in a binary, I'll see if you can craft a broken object using yaml2obj.
I'm not a huge fan of the tool itself, but I find this a very legitimate usecase for it (creating broken binaries).

No it looks not possible. It showed me a error when I tried to create a relocation using numeric value and not a pre-defined enum. So I believe it is a unreasonable limitaion of yaml2obj now.

Can you please take a look at how hard is to fix yaml2obj for this testcase? I think we should avoid checking in a binary unless really necessary, as it makes reconstructing the testcase harder in the future.

Instead of checking in a binary, I'll see if you can craft a broken object using yaml2obj.
I'm not a huge fan of the tool itself, but I find this a very legitimate usecase for it (creating broken binaries).

No it looks not possible. It showed me a error when I tried to create a relocation using numeric value and not a pre-defined enum. So I believe it is a unreasonable limitaion of yaml2obj now.

Can you please take a look at how hard is to fix yaml2obj for this testcase? I think we should avoid checking in a binary unless really necessary, as it makes reconstructing the testcase harder in the future.

Sure. I'll take a look on that tomorrow than. I hope that should not affect on that patch though. But that would be a good change I think anyways. I assume yaml2obj is best using when need to create something unusual, so I would expect to have as less limitations as possible here.

Instead of checking in a binary, I'll see if you can craft a broken object using yaml2obj.
I'm not a huge fan of the tool itself, but I find this a very legitimate usecase for it (creating broken binaries).

No it looks not possible. It showed me a error when I tried to create a relocation using numeric value and not a pre-defined enum. So I believe it is a unreasonable limitaion of yaml2obj now.

Can you please take a look at how hard is to fix yaml2obj for this testcase? I think we should avoid checking in a binary unless really necessary, as it makes reconstructing the testcase harder in the future.

Instead of checking in a binary, I'll see if you can craft a broken object using yaml2obj.
I'm not a huge fan of the tool itself, but I find this a very legitimate usecase for it (creating broken binaries).

No it looks not possible. It showed me a error when I tried to create a relocation using numeric value and not a pre-defined enum. So I believe it is a unreasonable limitaion of yaml2obj now.

Can you please take a look at how hard is to fix yaml2obj for this testcase? I think we should avoid checking in a binary unless really necessary, as it makes reconstructing the testcase harder in the future.

Sure. I'll take a look on that tomorrow than. I hope that should not affect on that patch though. But that would be a good change I think anyways. I assume yaml2obj is best using when need to create something unusual, so I would expect to have as less limitations as possible here.

*sigh* It sounds fixing this might be non-trivial as the YAML parser expects an enumerated scalar (which probably will get from ELF.h or something). So, I'd leave this as is but please add specific instructions on how to reproduce (source test file, commands, and tools version, so that it's not a pain to recreate this in the future).

And also we faced with some limitations when did a fuzzing of lld. Probably it is reasonable to tweak yaml2obj and try to get rid of pre-compiled objects if possible. That looks to be usefull.

Instead of checking in a binary, I'll see if you can craft a broken object using yaml2obj.
I'm not a huge fan of the tool itself, but I find this a very legitimate usecase for it (creating broken binaries).

No it looks not possible. It showed me a error when I tried to create a relocation using numeric value and not a pre-defined enum. So I believe it is a unreasonable limitaion of yaml2obj now.

Can you please take a look at how hard is to fix yaml2obj for this testcase? I think we should avoid checking in a binary unless really necessary, as it makes reconstructing the testcase harder in the future.

Instead of checking in a binary, I'll see if you can craft a broken object using yaml2obj.
I'm not a huge fan of the tool itself, but I find this a very legitimate usecase for it (creating broken binaries).

No it looks not possible. It showed me a error when I tried to create a relocation using numeric value and not a pre-defined enum. So I believe it is a unreasonable limitaion of yaml2obj now.

Can you please take a look at how hard is to fix yaml2obj for this testcase? I think we should avoid checking in a binary unless really necessary, as it makes reconstructing the testcase harder in the future.

Sure. I'll take a look on that tomorrow than. I hope that should not affect on that patch though. But that would be a good change I think anyways. I assume yaml2obj is best using when need to create something unusual, so I would expect to have as less limitations as possible here.

*sigh* It sounds fixing this might be non-trivial as the YAML parser expects an enumerated scalar (which probably will get from ELF.h or something). So, I'd leave this as is but please add specific instructions on how to reproduce (source test file, commands, and tools version, so that it's not a pain to recreate this in the future).

Hmm, ok, I'll do.

grimar updated this revision to Diff 82112.Dec 20 2016, 8:20 AM
  • Addressed review comments.
This revision was automatically updated to reflect the committed changes.