This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Add support for SHF_ARM_PURECODE.
AbandonedPublic

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

Details

Summary

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.
ELF/OutputSections.cpp
46

Please format using clang-format-diff.

test/ELF/aarch64-execute-only.s
10

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.

22–36

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.

ELF/OutputSections.cpp
47

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