This is an archive of the discontinued LLVM Phabricator instance.

Add Position Independent Pages (PIP) relocation model
Needs ReviewPublic

Authored by rinon on Sep 7 2017, 12:21 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

The PIP relocation model allows the dynamic loader to load a specially marked
PIP code segments at random addresses, independent of other segments. Code in a
PIP segment must refer to addresses outside of its own segment by indirection
through a Page Offset Table (POT). The address of the POT must be loaded into a
platform-specific register before branching to a PIP segment. For non-PIP
segments, the PIP relocation model is identical to the PIC_ model.

This patch set (D37580, D37581, D37582, D37583, D37584, D37585, D37586, D37587) is a first draft of the pagerando implementation described in http://lists.llvm.org/pipermail/llvm-dev/2017-June/113794.html.

Event Timeline

rinon created this revision.Sep 7 2017, 12:21 PM

This patch set (D37580, D37581, D37582, D37583, D37584, D37585, D37586, D37587) is a first draft of the pagerando implementation described in http://lists.llvm.org/pipermail/llvm-dev/2017-June/113794.html.

I'm not entirely sure that a new relocation model is the best way to approach this. Pagerando address references are similar to a couple of other ARM-specific reloc models (i.e. ROPI) and are definitely not PC-relative PIC, so I decided to start by specifying it as a new reloc model. However, pagerando modules are a mix of PIC and PIP models depending on the function, so a new reloc model may be too broad. Alternatives are just marking the function and teaching the backend how to lower references for functions marked for pagerando. Feedback on whether to use the new reloc model or a different approach would be appreciated.

I've got a few comments on some of the later patches, as this is the first in the series I just thought I'd mention that, as far as I know, adding llvm-commits as a subscriber after the initial creation is not sufficient for the mailing list to get any updates. I think the usual advice is to abandon the existing reviews and start new ones with llvm-commits subscribed. I'd also suggest adding a link to your llvm-dev post http://lists.llvm.org/pipermail/llvm-dev/2017-June/113794.html to at least one of the reviews as it isn't possible to understand without it. Some of the descriptions of later reviews are quite terse, especially for the backend changes that could do with some more description on why you've made the changes that you would like to make.

I've no specific comments on this patch.

Thanks for taking a look at this!

It looks like everything but the first revision got sent to llvm-commits (http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171030/498777.html). Since I've rebased all the patches, the diffs have also been sent to the list. If this is insufficient I'm happy to abandon and reopen revisions; I just don't want to make the conversations harder to follow on phabricator since there are already comments.

Good pooint, I'll link to the RFC to the summary, since the first comment I wrote on each patch will get hidden after a long discussion:

This patch set (D37580, D37581, D37582, D37583, D37584, D37585, D37586, D37587) is a first draft of the pagerando implementation described in http://lists.llvm.org/pipermail/llvm-dev/2017-June/113794.html.

rinon edited the summary of this revision. (Show Details)Oct 31 2017, 11:41 AM