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

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
721

Add a blank line between code and comment.

723

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

ELF/Target.cpp
697–698

Probably unintended change.

738–739

Ditto

820–821

Ditto

838

Ditto (and so on)

ELF/Target.h
30–31

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
30–31

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

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

721

ping

ELF/Target.cpp
1250

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

1980

Remove () after return.

1985

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.