This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Add pre-defined macros for ROPI and RWPI
ClosedPublic

Authored by olista01 on Aug 17 2016, 7:29 AM.

Details

Summary

This adds pre-defined macros to test for code being compiled in the ROPI and RWPI position-independence modes. These macros will be defined in the next release of the ACLE.

Diff Detail

Repository
rL LLVM

Event Timeline

olista01 updated this revision to Diff 68347.Aug 17 2016, 7:29 AM
olista01 retitled this revision from to [ARM] Add pre-defined macros for ROPI, RWPI and FPIC.
olista01 updated this object.
olista01 added reviewers: rengolin, t.p.northover.
olista01 set the repository for this revision to rL LLVM.
olista01 added a subscriber: cfe-commits.
t.p.northover added inline comments.Aug 17 2016, 12:16 PM
lib/Basic/Targets.cpp
5316 ↗(On Diff #68347)

These names are pretty bad from a modern perspective (with APCS deprecated and almost entirely forgotten outside iOS). It's the kind of thing it would be good for the ACLE to cover, would they be likely to consider it?

rengolin edited edge metadata.Dec 12 2016, 1:47 AM

Was this abandoned?

I've proposed a patch to the ACLE to add these macros, but it's stalled in review. I've just given it a ping, I'll try to get an answer soon.

My patch to the ACLE has now been accepted, so it will be in the next release. This is the wording:

__ARM_ROPI is defined to 1 if the translation unit is being compiled in read-only position independent mode. In this mode, all read-only data and functions are at a link-time constant offset from the program counter.

__ARM_RWPI is defined to 1 if the translation unit is being compiled in read-write position independent mode. In this mode, all writable data is at a link-time constant offset from the static base register defined in [AAPCS].

The ROPI and RWPI position independence modes are compatible with each other, so the __ARM_ROPI and __ARM_RWPI macros may be defined at the same time.

We're not adding the FPIC macro to the ACLE, because that isn't ARM-specific.

olista01 updated this revision to Diff 91990.Mar 16 2017, 6:20 AM
olista01 retitled this revision from [ARM] Add pre-defined macros for ROPI, RWPI and FPIC to [ARM] Add pre-defined macros for ROPI and RWPI.
olista01 edited the summary of this revision. (Show Details)
rengolin accepted this revision.Feb 18 2019, 3:24 AM

Sorry for the delay, this fell out of my radar and just saw the ping now.

Given it's in ACLE and there are only mechanical (obvious) changes, LGTM.

I'm assuming those two parameters are already accepted in the LLVM back-end, right?

This revision is now accepted and ready to land.Feb 18 2019, 3:24 AM

Yes, the back-end work was all done years ago, I just also forgot about these while waiting for the ACLE to be published.

This revision was automatically updated to reflect the committed changes.