Home | History | Annotate | Download | only in ARM
      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 "ARMTargetMachine.h"
     12 #include "llvm/ADT/StringExtras.h"
     13 #include "llvm/IR/Mangler.h"
     14 #include "llvm/MC/MCAsmInfo.h"
     15 #include "llvm/MC/MCContext.h"
     16 #include "llvm/MC/MCExpr.h"
     17 #include "llvm/MC/MCSectionELF.h"
     18 #include "llvm/Support/Dwarf.h"
     19 #include "llvm/Support/ELF.h"
     20 #include "llvm/Target/TargetLowering.h"
     21 using namespace llvm;
     22 using namespace dwarf;
     23 
     24 //===----------------------------------------------------------------------===//
     25 //                               ELF Target
     26 //===----------------------------------------------------------------------===//
     27 
     28 void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
     29                                         const TargetMachine &TM) {
     30   bool isAAPCS_ABI = static_cast<const ARMTargetMachine &>(TM).TargetABI ==
     31                      ARMTargetMachine::ARMABI::ARM_ABI_AAPCS;
     32   TargetLoweringObjectFileELF::Initialize(Ctx, TM);
     33   InitializeELF(isAAPCS_ABI);
     34 
     35   if (isAAPCS_ABI) {
     36     LSDASection = nullptr;
     37   }
     38 
     39   AttributesSection =
     40       getContext().getELFSection(".ARM.attributes", ELF::SHT_ARM_ATTRIBUTES, 0);
     41 }
     42 
     43 const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
     44     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
     45     const TargetMachine &TM, MachineModuleInfo *MMI,
     46     MCStreamer &Streamer) const {
     47   if (TM.getMCAsmInfo()->getExceptionHandlingType() != ExceptionHandling::ARM)
     48     return TargetLoweringObjectFileELF::getTTypeGlobalReference(
     49         GV, Encoding, Mang, TM, MMI, Streamer);
     50 
     51   assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
     52 
     53   return MCSymbolRefExpr::create(TM.getSymbol(GV, Mang),
     54                                  MCSymbolRefExpr::VK_ARM_TARGET2, getContext());
     55 }
     56 
     57 const MCExpr *ARMElfTargetObjectFile::
     58 getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
     59   return MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_ARM_TLSLDO,
     60                                  getContext());
     61 }
     62