This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Do not fail on R_*_NONE relocations when parsing the debug info.
ClosedPublic

Authored by grimar on Sep 24 2018, 2:54 AM.

Details

Summary

This is https://bugs.llvm.org//show_bug.cgi?id=38919.

Currently, LLD may report "unsupported relocation target while parsing debug info"
when parsing the debug information.

At the same time in the bug sample, it does that for zeroed R_X86_64_NONE relocation:

000000009cca  015e00000001 R_X86_64_64       0000000000000000  + 0
000000009cfa  000000000000 R_X86_64_NONE                        0
000000009d69  015f00000001 R_X86_64_64       0000000000000000  + 0

Which obviously has "invalid" target (not defined symbol) because it is zeroed out.
I believe the nature of R_*_NONE relocation assumes them should be ignored and
that is why they were invented. So this patch teaches LLD to stop reporting
debug information parsing errors for them.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

grimar created this revision.Sep 24 2018, 2:54 AM
ruiu added inline comments.Sep 25 2018, 7:10 AM
ELF/DWARF.cpp
80

Looks like calling getRelExpr is overkill as you don't really need a symbol and a relocation target location. You probably should define a more lightweight predicate or just Target->NoneRelType.

grimar added inline comments.Sep 25 2018, 7:12 AM
ELF/DWARF.cpp
80

I was not sure that introducing Target->NoneRelType is acceptable. But that is what I would really prefer here. I'll do that change.

grimar updated this revision to Diff 166926.Sep 25 2018, 8:44 AM
grimar removed a reviewer: espindola.
  • Addressed review comment.
ruiu accepted this revision.Sep 25 2018, 8:56 AM

LGTM

ELF/DWARF.cpp
77–81

I don't think you need a comment, as a none relocation is a no-op in any context.

This revision is now accepted and ready to land.Sep 25 2018, 8:56 AM
This revision was automatically updated to reflect the committed changes.