diff options
author | Prakhar Bahuguna <prakhar.bahuguna@arm.com> | 2016-12-15 07:59:08 +0000 |
---|---|---|
committer | Prakhar Bahuguna <prakhar.bahuguna@arm.com> | 2016-12-15 07:59:08 +0000 |
commit | 52a7dd7d7825b269ae569db0e2bcb193c7698666 (patch) | |
tree | 7957bd2c8f0c07fbbcfdc331ca848a051dab6613 /llvm/lib/Target/ARM/ARMTargetObjectFile.h | |
parent | 342beeb91eb03ce92e598d593325c8475673768e (diff) | |
download | bcm5719-llvm-52a7dd7d7825b269ae569db0e2bcb193c7698666.tar.gz bcm5719-llvm-52a7dd7d7825b269ae569db0e2bcb193c7698666.zip |
[ARM] Implement execute-only support in CodeGen
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 CodeGen option "-arm-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 option.
* When enabled, literal pools are replaced with MOVW/MOVT instructions,
with VMOV used in addition for floating-point literals. As the MOVT
instruction is required, execute-only support is only available in
Thumb mode for targets supporting ARMv8-M baseline or Thumb2.
* 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.
llvm-svn: 289784
Diffstat (limited to 'llvm/lib/Target/ARM/ARMTargetObjectFile.h')
-rw-r--r-- | llvm/lib/Target/ARM/ARMTargetObjectFile.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMTargetObjectFile.h b/llvm/lib/Target/ARM/ARMTargetObjectFile.h index 7a1f3e39b1d..24e755ddac2 100644 --- a/llvm/lib/Target/ARM/ARMTargetObjectFile.h +++ b/llvm/lib/Target/ARM/ARMTargetObjectFile.h @@ -18,6 +18,7 @@ class MCContext; class TargetMachine; class ARMElfTargetObjectFile : public TargetLoweringObjectFileELF { + mutable bool genExecuteOnly = false; protected: const MCSection *AttributesSection; public: @@ -36,6 +37,12 @@ public: /// \brief Describe a TLS variable address within debug info. const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override; + + MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, + const TargetMachine &TM) const override; + + MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, + const TargetMachine &TM) const override; }; } // end namespace llvm |