SparcTargetObjectFile.cpp revision 263763
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#include "llvm/Target/Mangler.h" 15 16using namespace llvm; 17 18 19const MCExpr *SparcELFTargetObjectFile:: 20getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, 21 MachineModuleInfo *MMI, unsigned Encoding, 22 MCStreamer &Streamer) const { 23 24 if (Encoding & dwarf::DW_EH_PE_pcrel) { 25 MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>(); 26 27 //MCSymbol *SSym = getSymbolWithGlobalValueBase(*Mang, GV, ".DW.stub"); 28 SmallString<60> NameStr; 29 Mang->getNameWithPrefix(NameStr, GV, true); 30 NameStr.append(".DW.stub"); 31 MCSymbol *SSym = getContext().GetOrCreateSymbol(NameStr.str()); 32 33 // Add information about the stub reference to ELFMMI so that the stub 34 // gets emitted by the asmprinter. 35 MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym); 36 if (StubSym.getPointer() == 0) { 37 MCSymbol *Sym = getSymbol(*Mang, GV); 38 StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); 39 } 40 41 MCContext &Ctx = getContext(); 42 return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32, 43 MCSymbolRefExpr::Create(SSym, Ctx), Ctx); 44 } 45 46 return TargetLoweringObjectFileELF:: 47 getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer); 48} 49