This is an archive of the discontinued LLVM Phabricator instance.

[ELF/AArch64] Fix overflow checks for R_AARCH64_{ABS,PREL}{16,32} relocations.
ClosedPublic

Authored by ikudrin on Nov 24 2015, 8:45 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ikudrin updated this revision to Diff 41055.Nov 24 2015, 8:45 AM
ikudrin retitled this revision from to [ELF/AArch64] Fix overflow checks for R_AARCH64_{ABS,PREL}{16,32} relocations..
ikudrin updated this object.
ikudrin added reviewers: ruiu, davide, rafael.
ikudrin added a project: lld.
ikudrin added a subscriber: llvm-commits.
ruiu added inline comments.Nov 24 2015, 3:55 PM
ELF/Target.cpp
58–59 ↗(On Diff #41055)
This comment has been deleted.
58–59 ↗(On Diff #41055)

By the way, is isInt<N> correct? Isn't that isInt<N-1>?

ikudrin added inline comments.Nov 24 2015, 5:51 PM
ELF/Target.cpp
58–59 ↗(On Diff #41055)

That's why I've made "precise" tests. The old lld was not correct in those cases.

The docs say, that, for example, for R_AARCH64_ABS16 the valid range is -2^15 <= X < 2^16.
-2^15 is the minimum valid value for IsInt<16> and 2^16-1 is the maximum for IsUInt<16>.

ikudrin updated this revision to Diff 41105.Nov 24 2015, 7:06 PM
  • Rebase to the top.
  • Rename checkIsIntOrUInt -> checkIntUInt, update the body.
  • Fix tests.
ruiu accepted this revision.Nov 25 2015, 10:29 AM
ruiu edited edge metadata.

LGTM

ELF/Target.cpp
60–61 ↗(On Diff #41105)

Ah, you are right.

This revision is now accepted and ready to land.Nov 25 2015, 10:29 AM
davide accepted this revision.Nov 25 2015, 10:49 AM
davide edited edge metadata.

looks good, thanks for fixing this one.

This revision was automatically updated to reflect the committed changes.
lld/trunk/test/ELF/aarch64-prel16.s