LLVM API Documentation

ARMTargetObjectFile.cpp
Go to the documentation of this file.
00001 //===-- llvm/Target/ARMTargetObjectFile.cpp - ARM Object Info Impl --------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "ARMTargetObjectFile.h"
00011 #include "ARMSubtarget.h"
00012 #include "llvm/ADT/StringExtras.h"
00013 #include "llvm/IR/Mangler.h"
00014 #include "llvm/MC/MCAsmInfo.h"
00015 #include "llvm/MC/MCContext.h"
00016 #include "llvm/MC/MCExpr.h"
00017 #include "llvm/MC/MCSectionELF.h"
00018 #include "llvm/Support/Dwarf.h"
00019 #include "llvm/Support/ELF.h"
00020 #include "llvm/Target/TargetLowering.h"
00021 using namespace llvm;
00022 using namespace dwarf;
00023 
00024 //===----------------------------------------------------------------------===//
00025 //                               ELF Target
00026 //===----------------------------------------------------------------------===//
00027 
00028 void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
00029                                         const TargetMachine &TM) {
00030   bool isAAPCS_ABI = TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI();
00031   TargetLoweringObjectFileELF::Initialize(Ctx, TM);
00032   InitializeELF(isAAPCS_ABI);
00033 
00034   if (isAAPCS_ABI) {
00035     LSDASection = nullptr;
00036   }
00037 
00038   AttributesSection =
00039     getContext().getELFSection(".ARM.attributes",
00040                                ELF::SHT_ARM_ATTRIBUTES,
00041                                0,
00042                                SectionKind::getMetadata());
00043 }
00044 
00045 const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
00046     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
00047     const TargetMachine &TM, MachineModuleInfo *MMI,
00048     MCStreamer &Streamer) const {
00049   if (TM.getMCAsmInfo()->getExceptionHandlingType() != ExceptionHandling::ARM)
00050     return TargetLoweringObjectFileELF::getTTypeGlobalReference(
00051         GV, Encoding, Mang, TM, MMI, Streamer);
00052 
00053   assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
00054 
00055   return MCSymbolRefExpr::Create(TM.getSymbol(GV, Mang),
00056                                  MCSymbolRefExpr::VK_ARM_TARGET2, getContext());
00057 }
00058 
00059 const MCExpr *ARMElfTargetObjectFile::
00060 getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
00061   return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_ARM_TLSLDO,
00062                                  getContext());
00063 }