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

Prakhar Bahuguna via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 02:59:47 PST 2016


prakhar created this revision.
prakhar added reviewers: t.p.northover, rengolin.
prakhar added a subscriber: llvm-commits.
Herald added a subscriber: aemerson.

This implements execute-only support for ARM code generation, which
prevents the compiler from generating data accesses to code sections.
The following changes are involved:

- Add the SubtargetFeature "execute-only" to the ARM code generator.
- Add the clang flag "-mexecute-only" as well as the GCC-compatible alias "-mpure-code" to enable this feature.
- When enabled, literal pools are replaced with MOVW/MOVT instructions, with VMOV used in addition for floating-point literals. Hence, execute-only support is only available for targets that support MOVW/MOVT (ARMv7 and above).
- Jump tables are placed in data sections when in execute-only mode.
- The execute-only text section is assigned section ID 0, and is marked as unreadable with the SHF_ARM_PURECODE flag with symbol 'y'. This also overrides selection of ELF sections for globals.


https://reviews.llvm.org/D27450

Files:
  include/clang/Basic/DiagnosticCommonKinds.td
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  test/Driver/arm-execute-only.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27450.80399.patch
Type: text/x-patch
Size: 5822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161206/2545bd80/attachment.bin>


More information about the llvm-commits mailing list