LLVM  6.0.0svn
ARMTargetObjectFile.cpp
Go to the documentation of this file.
1 //===-- llvm/Target/ARMTargetObjectFile.cpp - ARM Object Info Impl --------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "ARMTargetObjectFile.h"
11 #include "ARMSubtarget.h"
12 #include "ARMTargetMachine.h"
14 #include "llvm/BinaryFormat/ELF.h"
15 #include "llvm/MC/MCAsmInfo.h"
16 #include "llvm/MC/MCContext.h"
17 #include "llvm/MC/MCExpr.h"
18 #include "llvm/MC/MCSectionELF.h"
20 #include "llvm/MC/SectionKind.h"
22 #include <cassert>
23 
24 using namespace llvm;
25 using namespace dwarf;
26 
27 //===----------------------------------------------------------------------===//
28 // ELF Target
29 //===----------------------------------------------------------------------===//
30 
32  const TargetMachine &TM) {
33  const ARMBaseTargetMachine &ARM_TM = static_cast<const ARMBaseTargetMachine &>(TM);
34  bool isAAPCS_ABI = ARM_TM.TargetABI == ARMBaseTargetMachine::ARMABI::ARM_ABI_AAPCS;
35  // genExecuteOnly = ARM_TM.getSubtargetImpl()->genExecuteOnly();
36 
38  InitializeELF(isAAPCS_ABI);
39 
40  if (isAAPCS_ABI) {
41  LSDASection = nullptr;
42  }
43 
44  AttributesSection =
45  getContext().getELFSection(".ARM.attributes", ELF::SHT_ARM_ATTRIBUTES, 0);
46 }
47 
49  const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
50  MachineModuleInfo *MMI, MCStreamer &Streamer) const {
53  GV, Encoding, TM, MMI, Streamer);
54 
55  assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
56 
57  return MCSymbolRefExpr::create(TM.getSymbol(GV),
58  MCSymbolRefExpr::VK_ARM_TARGET2, getContext());
59 }
60 
64  getContext());
65 }
66 
68  const TargetMachine &TM) {
69  if (const Function *F = dyn_cast<Function>(GO))
70  if (TM.getSubtarget<ARMSubtarget>(*F).genExecuteOnly() && SK.isText())
71  return true;
72  return false;
73 }
74 
76  const GlobalObject *GO, SectionKind SK, const TargetMachine &TM) const {
77  // Set execute-only access for the explicit section
78  if (isExecuteOnlyFunction(GO, SK, TM))
80 
82 }
83 
85  const GlobalObject *GO, SectionKind SK, const TargetMachine &TM) const {
86  // Place the global in the execute-only text section
87  if (isExecuteOnlyFunction(GO, SK, TM))
89 
91 }
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
MCSection * getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Targets should implement this method to assign a section to globals with an explicit section specfied...
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:305
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
F(f)
setjmp/longjmp based exceptions
enum llvm::ARMBaseTargetMachine::ARMABI TargetABI
bool genExecuteOnly() const
Definition: ARMSubtarget.h:589
virtual void Initialize(MCContext &ctx, const TargetMachine &TM)
This method must be called before any actual lowering is done.
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:36
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Context object for machine code objects.
Definition: MCContext.h:59
bool isText() const
Definition: SectionKind.h:119
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
MCSection * getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Targets should implement this method to assign a section to globals with an explicit section specfied...
Streaming machine code generation interface.
Definition: MCStreamer.h:169
const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
Return an MCExpr to use for a reference to the specified type info global variable from exception han...
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
MCSymbol * getSymbol(const GlobalValue *GV) const
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:23
const MCExpr * getDebugThreadLocalSymbol(const MCSymbol *Sym) const override
Describe a TLS variable address within debug info.
This file contains constants used for implementing Dwarf debug support.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
static bool isExecuteOnlyFunction(const GlobalObject *GO, SectionKind SK, const TargetMachine &TM)
const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
Return an MCExpr to use for a reference to the specified type info global variable from exception han...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ExceptionHandling getExceptionHandlingType() const
Definition: MCAsmInfo.h:554
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:57
const STC & getSubtarget(const Function &F) const
This method returns a pointer to the specified type of TargetSubtargetInfo.
This class contains meta information specific to a module.
static SectionKind getExecuteOnly()
Definition: SectionKind.h:181