[PATCH] D27449: [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:03 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/D27449

Files:
  include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
  include/llvm/MC/SectionKind.h
  include/llvm/Support/ELF.h
  lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  lib/MC/MCContext.cpp
  lib/MC/MCParser/ELFAsmParser.cpp
  lib/MC/MCSectionELF.cpp
  lib/ObjectYAML/ELFYAML.cpp
  lib/Target/ARM/ARM.td
  lib/Target/ARM/ARMAsmPrinter.cpp
  lib/Target/ARM/ARMConstantIslandPass.cpp
  lib/Target/ARM/ARMISelLowering.cpp
  lib/Target/ARM/ARMInstrFormats.td
  lib/Target/ARM/ARMInstrThumb2.td
  lib/Target/ARM/ARMMCInstLower.cpp
  lib/Target/ARM/ARMSubtarget.cpp
  lib/Target/ARM/ARMSubtarget.h
  lib/Target/ARM/ARMTargetObjectFile.cpp
  lib/Target/ARM/ARMTargetObjectFile.h
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  lib/Target/ARM/ThumbRegisterInfo.cpp
  test/CodeGen/ARM/constantfp.ll
  test/CodeGen/ARM/execute-only-big-stack-frame.ll
  test/CodeGen/ARM/execute-only-section.ll
  test/CodeGen/ARM/execute-only.ll
  test/MC/ELF/ARM/execute-only-section.s
  tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27449.80398.patch
Type: text/x-patch
Size: 29873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161206/ddd801a8/attachment.bin>


More information about the llvm-commits mailing list