This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Refactor getDynRel to print error location
ClosedPublic

Authored by evgeny777 on Nov 23 2016, 8:54 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

evgeny777 updated this revision to Diff 79100.Nov 23 2016, 8:54 AM
evgeny777 retitled this revision from to [ELF] Refactor getDynRel to print error location.
evgeny777 updated this object.
evgeny777 added reviewers: ruiu, rafael.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: grimar, ikudrin, llvm-commits.
ruiu added inline comments.Nov 23 2016, 9:24 AM
ELF/Relocations.cpp
719 ↗(On Diff #79100)

I think we don't put a period at end of a sentence in error messages.

722 ↗(On Diff #79100)

Add a blank line between code and comment.

ELF/Target.cpp
697–698 ↗(On Diff #79100)

Probably unintended change.

739–740 ↗(On Diff #79100)

Ditto

821–824 ↗(On Diff #79100)

Ditto

842 ↗(On Diff #79100)

Ditto (and so on)

ELF/Target.h
29–31 ↗(On Diff #79100)

The meaning of the second return value is not very clear. How about this? We can add Target::isAbsRel(uint32_t). If it returns true, we should report an error. Then I think we don't need to modify getDynRel.

evgeny777 added inline comments.Nov 24 2016, 2:05 AM
ELF/Target.h
29–31 ↗(On Diff #79100)

isAbsRel is a bit confusing (in position independent code RelExpr may be R_GOT_PC as well). How about isPICRel ?

evgeny777 updated this revision to Diff 79197.Nov 24 2016, 2:07 AM
evgeny777 removed rL LLVM as the repository for this revision.

Addressed review comments

ruiu accepted this revision.Nov 24 2016, 9:13 AM
ruiu edited edge metadata.

LGTM with these comments addressed.

ELF/Relocations.cpp
716 ↗(On Diff #79197)

We have Config->Pic, so it should be named isPicRel.

722 ↗(On Diff #79100)

ping

ELF/Target.cpp
1250 ↗(On Diff #79197)

You can just return Type because R_AARCH64_ABS32 was just a dummy value to return something in an error condition.

1980 ↗(On Diff #79197)

Remove () after return.

1985 ↗(On Diff #79197)

This is I think just a dummy value, too.

This revision is now accepted and ready to land.Nov 24 2016, 9:13 AM
This revision was automatically updated to reflect the committed changes.