1 //===------- SparcTargetObjectFile.cpp - Sparc 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 "SparcTargetObjectFile.h" 11 #include "MCTargetDesc/SparcMCExpr.h" 12 #include "llvm/CodeGen/MachineModuleInfoImpls.h" 13 #include "llvm/Support/Dwarf.h" 14 15 using namespace llvm; 16 17 const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference( 18 const GlobalValue *GV, unsigned Encoding, Mangler &Mang, 19 MachineModuleInfo *MMI, MCStreamer &Streamer) const { 20 21 if (Encoding & dwarf::DW_EH_PE_pcrel) { 22 MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>(); 23 24 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang); 25 26 // Add information about the stub reference to ELFMMI so that the stub 27 // gets emitted by the asmprinter. 28 MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym); 29 if (StubSym.getPointer() == 0) { 30 MCSymbol *Sym = getSymbol(GV, Mang); 31 StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); 32 } 33 34 MCContext &Ctx = getContext(); 35 return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32, 36 MCSymbolRefExpr::Create(SSym, Ctx), Ctx); 37 } 38 39 return TargetLoweringObjectFileELF::getTTypeGlobalReference( 40 GV, Encoding, Mang, MMI, Streamer); 41 } 42