This is an archive of the discontinued LLVM Phabricator instance.

llvm-readobj: Add support for reading relocations in the Android packed format.
ClosedPublic

Authored by pcc on Oct 24 2017, 6:20 PM.

Details

Summary

This is in preparation for testing lld's upcoming relocation packing
feature (D39152). I have verified that this implementation correctly
unpacks the relocations from a Chromium DSO built with gold and the
Android relocation packer for ARM32 and ARM64.

Depends on D39271

Diff Detail

Repository
rL LLVM

Event Timeline

pcc created this revision.Oct 24 2017, 6:20 PM
ruiu added inline comments.Oct 24 2017, 6:50 PM
llvm/lib/Object/ELF.cpp
478 ↗(On Diff #120169)

It is probably worth to mention briefly as a function comment that this function reads relocations represented as ULEB128 values, which is a compact relocation format invented for Android.

492 ↗(On Diff #120169)

nit: I believe you can omit ()

527 ↗(On Diff #120169)

Can this RHS expression return a negative value? If not, Addend is a monotonically increasing, which is odd.

550 ↗(On Diff #120169)

I'd add a check to make sure that NumRelocs is not negative.

pcc updated this revision to Diff 120180.Oct 24 2017, 7:55 PM
pcc marked 2 inline comments as done.
  • Address review comments
llvm/lib/Object/ELF.cpp
492 ↗(On Diff #120169)

Looks like the parens are required if the lambda has a trailing return type.

527 ↗(On Diff #120169)

Yes it can, same applies to Offset. That reminds me that I should add tests for negative addends and offsets, which I've now done.

ruiu accepted this revision.Oct 24 2017, 8:07 PM

LGTM

This revision is now accepted and ready to land.Oct 24 2017, 8:07 PM
This revision was automatically updated to reflect the committed changes.