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 "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" 21using namespace llvm; 22using namespace dwarf; 23 24//===----------------------------------------------------------------------===// 25// ELF Target 26//===----------------------------------------------------------------------===// 27 28void ARMElfTargetObjectFile::Initialize(MCContext &Ctx, 29 const TargetMachine &TM) { 30 bool isAAPCS_ABI = TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI(); 31 TargetLoweringObjectFileELF::Initialize(Ctx, TM); 32 InitializeELF(isAAPCS_ABI); 33 34 if (isAAPCS_ABI) { 35 LSDASection = nullptr; 36 } 37 38 AttributesSection = 39 getContext().getELFSection(".ARM.attributes", 40 ELF::SHT_ARM_ATTRIBUTES, 41 0, 42 SectionKind::getMetadata()); 43} 44 45const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference( 46 const GlobalValue *GV, unsigned Encoding, Mangler &Mang, 47 const TargetMachine &TM, MachineModuleInfo *MMI, 48 MCStreamer &Streamer) const { 49 if (TM.getMCAsmInfo()->getExceptionHandlingType() != ExceptionHandling::ARM) 50 return TargetLoweringObjectFileELF::getTTypeGlobalReference( 51 GV, Encoding, Mang, TM, MMI, Streamer); 52 53 assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only"); 54 55 return MCSymbolRefExpr::Create(TM.getSymbol(GV, Mang), 56 MCSymbolRefExpr::VK_ARM_TARGET2, getContext()); 57} 58 59const MCExpr *ARMElfTargetObjectFile:: 60getDebugThreadLocalSymbol(const MCSymbol *Sym) const { 61 return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_ARM_TLSLDO, 62 getContext()); 63} 64