Page MenuHomePhabricator

[AArch64] Add support for SHF_ARM_PURECODE.

Authored by ivanlozano on Jun 29 2018, 3:11 PM.



Adds support for the execute-only section flag SHF_ARM_PURECODE on AArch64 targets.

Diff Detail

Event Timeline

ivanlozano created this revision.Jun 29 2018, 3:11 PM
ruiu added a subscriber: ruiu.Jul 2 2018, 1:22 AM
ruiu added inline comments.

Please format using clang-format-diff.


Do you actually need a newline character after ;? If not, please remove \ and the following newline character.

If you have to include a newline character, please do:

echo foo > %t.s
echo next line >> %t.s

because this is less error-prone.


I don't think you need to verify these conditions.

I've left a comment about the ABI problems with using SHF_ARM_PURECODE. I've raised an issue to support execute only on AArch64 with the ABI team at Arm.


As mentioned in D48791 SHF_ARM_PURECODE is defined in the SHF_MASKPROC space and is currently defined for ARM Processor so we shouldn't be using that flag when the machine isn't EM_ARM. I think it is highly likely that a SHF_AARCH64_PURECODE flag gets defined. When that arises this code might be best extracted into a function such as isExecuteOnly(Flags) so that this becomes:

if (!isExecuteOnly(Flags))
  Ret |= PF_R;
grimar added a subscriber: grimar.Jul 3 2018, 12:31 AM
ivanlozano abandoned this revision.Jul 30 2018, 10:18 AM

Alternative solution committed: rL338271