2014-01-29 12:51:35 +08:00
|
|
|
//===------- SparcTargetObjectFile.cpp - Sparc Object Info Impl -----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "SparcTargetObjectFile.h"
|
|
|
|
#include "MCTargetDesc/SparcMCExpr.h"
|
|
|
|
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
|
|
|
|
#include "llvm/Support/Dwarf.h"
|
2014-02-20 01:23:20 +08:00
|
|
|
#include "llvm/Target/TargetLowering.h"
|
2014-01-29 12:51:35 +08:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2014-02-09 22:50:44 +08:00
|
|
|
const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
|
|
|
|
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
2014-02-20 01:23:20 +08:00
|
|
|
const TargetMachine &TM, MachineModuleInfo *MMI,
|
|
|
|
MCStreamer &Streamer) const {
|
2014-01-29 12:51:35 +08:00
|
|
|
|
|
|
|
if (Encoding & dwarf::DW_EH_PE_pcrel) {
|
|
|
|
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
|
|
|
|
2014-02-20 01:23:20 +08:00
|
|
|
MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang, TM);
|
2014-01-29 12:51:35 +08:00
|
|
|
|
|
|
|
// Add information about the stub reference to ELFMMI so that the stub
|
|
|
|
// gets emitted by the asmprinter.
|
|
|
|
MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
|
2014-04-25 13:30:21 +08:00
|
|
|
if (!StubSym.getPointer()) {
|
2014-02-20 04:30:41 +08:00
|
|
|
MCSymbol *Sym = TM.getSymbol(GV, Mang);
|
2014-01-29 12:51:35 +08:00
|
|
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
|
|
|
}
|
|
|
|
|
|
|
|
MCContext &Ctx = getContext();
|
2015-05-30 09:25:56 +08:00
|
|
|
return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,
|
|
|
|
MCSymbolRefExpr::create(SSym, Ctx), Ctx);
|
2014-01-29 12:51:35 +08:00
|
|
|
}
|
|
|
|
|
2014-02-09 22:50:44 +08:00
|
|
|
return TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
2014-02-20 01:23:20 +08:00
|
|
|
GV, Encoding, Mang, TM, MMI, Streamer);
|
2014-01-29 12:51:35 +08:00
|
|
|
}
|