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.
|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?
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.
These macros have been in the published ACLE for a while now: https://developer.arm.com/products/software-development-tools/compilers/arm-compiler-5/docs/101028/latest/5-feature-test-macros#position-independent-code
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?