Adds support for the execute-only section flag SHF_ARM_PURECODE on AArch64 targets.
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;