This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Ignore R_*_NONE relocs when relocating non-alloc sections
ClosedPublic

Authored by phosek on Feb 22 2017, 3:00 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Feb 22 2017, 3:00 PM
ruiu added inline comments.Feb 22 2017, 3:04 PM
ELF/InputSection.cpp
471 ↗(On Diff #89431)

nit: no else after continue/return/break/etc.

ELF/Relocations.cpp
323 ↗(On Diff #89431)

Is this needed? If a relocation is R_NONE, the control shouldn't reach here in the first place, I think.

phosek updated this revision to Diff 89442.Feb 22 2017, 4:28 PM
phosek marked an inline comment as done.
ruiu added inline comments.Feb 22 2017, 4:36 PM
ELF/Relocations.cpp
323 ↗(On Diff #89431)

How about this?

phosek added inline comments.Feb 22 2017, 4:39 PM
ELF/Relocations.cpp
323 ↗(On Diff #89431)

I tried that but it's being invoked from adjustExpr in scanRelocs before we ignore the R_NONE reloc (the change below). I could move that check before the adjustExpr call if you prefer?

ruiu added inline comments.Feb 22 2017, 4:42 PM
ELF/Relocations.cpp
323 ↗(On Diff #89431)

How about do continue after RelExpr Expr = Target->getRelExpr(Type, Body); in scanRelocs?

phosek updated this revision to Diff 89443.Feb 22 2017, 4:55 PM
phosek marked 4 inline comments as done.
ruiu added inline comments.Feb 22 2017, 4:59 PM
ELF/Relocations.cpp
323 ↗(On Diff #89431)

So now you can revert the change to this function?

phosek updated this revision to Diff 89446.Feb 22 2017, 5:03 PM
phosek marked an inline comment as done.
ruiu accepted this revision.Feb 22 2017, 5:05 PM

LGTM

This revision is now accepted and ready to land.Feb 22 2017, 5:05 PM
This revision was automatically updated to reflect the committed changes.