This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj][obj2yaml] - Teach yaml2obj/obj2yaml tools about STB_GNU_UNIQUE symbols.
ClosedPublic

Authored by grimar on Mar 27 2019, 6:11 AM.

Details

Summary

yaml2obj/obj2yaml does not support the symbols with STB_GNU_UNIQUE yet.
Currently, obj2yaml fails with llvm_unreachable when met such a symbol.

I faced it when investigated the https://bugs.llvm.org/show_bug.cgi?id=41196.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Mar 27 2019, 6:11 AM
grimar edited the summary of this revision. (Show Details)Mar 27 2019, 7:09 AM
jhenderson accepted this revision.Mar 28 2019, 2:59 AM

LGTM.

The way symbols are handled in yaml2obj looks like it's desperately in need of an overhaul. It looks very fragile and easy to miss one thing when modifying it like you did here. That's a separate issue though.

tools/obj2yaml/elf2yaml.cpp
268 ↗(On Diff #192430)

Sounds to me like llvm_unreachable here is wrong, because it is reachable by any value not recognised. It should just be a normal error saying what the unknown binding value is. That can be a separate patch though if you want.

This revision is now accepted and ready to land.Mar 28 2019, 2:59 AM
grimar marked an inline comment as done.Mar 28 2019, 3:20 AM

LGTM.

The way symbols are handled in yaml2obj looks like it's desperately in need of an overhaul. It looks very fragile and easy to miss one thing when modifying it like you did here. That's a separate issue though.

I also feel I do not like the way how yaml2obj describes/handles symbols now. At least currently for each binding, we might need to extend the syntax and it does not seem to me as a reasonable/nice approach in general.
I think we should change/improve something here, let me take a look closer, I'll try to suggest something here after the additional investigation.

tools/obj2yaml/elf2yaml.cpp
268 ↗(On Diff #192430)

Yeah, I noticed that but was not sure because I would not expect to see any another kind of bindings here (I just never heard about other ones I think). But now, after your comment, I think you're right, that perhaps better be an error just in case. I'll prepare a patch.

jhenderson added inline comments.Mar 28 2019, 3:27 AM
tools/obj2yaml/elf2yaml.cpp
268 ↗(On Diff #192430)

Thanks. Even if there are no other legitimate bindings, a bad tool could write an invalid value.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2019, 3:52 AM