1 //===------- SparcTargetObjectFile.cpp - Sparc Object Info Impl -----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "SparcTargetObjectFile.h"
11 #include "MCTargetDesc/SparcMCExpr.h"
12 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
13 #include "llvm/Support/Dwarf.h"
17 const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
18 const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
19 MachineModuleInfo *MMI, MCStreamer &Streamer) const {
21 if (Encoding & dwarf::DW_EH_PE_pcrel) {
22 MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
24 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang);
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());
34 MCContext &Ctx = getContext();
35 return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
36 MCSymbolRefExpr::Create(SSym, Ctx), Ctx);
39 return TargetLoweringObjectFileELF::getTTypeGlobalReference(
40 GV, Encoding, Mang, MMI, Streamer);