Page MenuHomePhabricator

[LLD][ARM] Support for R_ARM_TARGET2 relocation

Authored by peter.smith on Oct 17 2016, 9:51 AM.



The R_ARM_TARGET2 relocation is used in ARM exception tables to encode a data dependency that will only be dereferenced by code in the run-time support library. In a similar way to R_ARM_TARGET1 the handling of the relocation is target specific, it maps to one of R_ARM_ABS32, R_ARM_REL32 or R_ARM_GOT_PREL. The choice depends on the run-time library. R_ARM_GOT_PREL is used for linux and BSD, R_ARM_ABS32 and R_ARM_REL32 are used for bare-metal.

I've implemented R_ARM_TARGET2 in lld using the same command line option as GNU ld

The default is R_ARM_GOT_PREL as this is the default in Gold and the linux targeting BFD linkers.

Diff Detail


Event Timeline

peter.smith retitled this revision from to [LLD][ARM] Support for R_ARM_TARGET2 relocation.
peter.smith updated this object.
peter.smith added reviewers: ruiu, rafael.
peter.smith added a subscriber: llvm-commits.
ruiu added inline comments.Oct 17 2016, 10:24 AM
359 ↗(On Diff #74863)

You are not using ReportError, so you may want to remove it.

ruiu added inline comments.Oct 17 2016, 10:36 AM
1531–1532 ↗(On Diff #74863)


Thanks for the comments (so far).

It is definitely the right thing to do to remove the ReportError so I've made it return the default if nothing arg is given. I've fixed the formatting as well, apologies about not catching that myself.

ruiu accepted this revision.Oct 17 2016, 10:47 AM
ruiu edited edge metadata.

LGTM with these changes.

349 ↗(On Diff #74869)

auto* -> auto *

1566 ↗(On Diff #74869)

So the function seems to be used only once, so I'd inline it here and remove getTarget2Expr.

This revision is now accepted and ready to land.Oct 17 2016, 10:47 AM
This revision was automatically updated to reflect the committed changes.

Thank you for the review. I've made the suggested changes and committed under 284404