[PATCH] D27449: [ARM] Implement execute-only support in CodeGen

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 05:42:23 PST 2016


peter.smith added a comment.

I've not looked over the details of the code. I can add some comments on compatibility and to a certain extent naming.

The ARM Compiler 6 documentation for execute-only http://infocenter.arm.com/help/topic/com.arm.doc.dui0774g/vvi1452508645836.html says `Link Time Optimization does not honor the armclang -mexecute-only option. If you use the armclang -flto or -Omax options, then the compiler cannot generate execute-only code.` Does this still apply, and if it does what should the action be, error message, user beware?

Personally I think it would be better to use the GCC pure-code naming conventions for the test cases and comments. The execute-only name has been favoured by the commercial compilers such as ARM Compiler 5 and ARM Compiler 6. However I think that the majority of the people looking through the code base will be familiar with the GCC pure-code name. Standardising on pure-code would make it easier to equate the support in GCC and llvm and enhance expectations of compatibility. I think that this only means changing comments to refer to pure-code rather than execute-only and changing the file names of the tests to use pure-code rather than execute-only. Or perhaps a comment that equates execute-only with pure-code. I think it is valuable to have both -mexecute-only and -mpure-code as a migration path for both commercial and GCC users.

I've not good a hugely strong opinion about this, I think execute-only is a far better name but I think familiarity with GCC might help more.

To support purecode a toolchain needs linker support. In effect if a section has the SHF_ARM_PURECODE flag it is making the claim that the contents of the section must not be read at run-time. If a program segment contains only SHF_ARM_PURECODE sections then the linker removes the PF_R flag from the ELF file. For compatibility it doesn't matter if the sections come from llvm or gcc, as long as they set the flag they will be treated the same by a linker. There is support in the Version 5-2016-q3-update of the GNU ARM Embedded Toolchain

References:

[X] http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf search for 4.3.3 Section Attribute Flags, you'll find the information SHF_ARM_PURECODE there. Unfortunately in the latest public version the attribute is called SHF_ARM_NOREAD instead of SHF_ARM_PURECODE, this will be changed to SHF_ARM_PURECODE in the next release of the document.

There is a small whitepaper https://community.arm.com/docs/DOC-11666 on Pure Code in GCC


https://reviews.llvm.org/D27449





More information about the llvm-commits mailing list