2014-01-29 05:51:35 +01:00
|
|
|
//===------- SparcTargetObjectFile.cpp - Sparc Object Info Impl -----------===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-01-29 05:51:35 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "SparcTargetObjectFile.h"
|
|
|
|
#include "MCTargetDesc/SparcMCExpr.h"
|
2017-06-07 05:48:56 +02:00
|
|
|
#include "llvm/BinaryFormat/Dwarf.h"
|
2014-01-29 05:51:35 +01:00
|
|
|
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
|
2017-11-17 02:07:10 +01:00
|
|
|
#include "llvm/CodeGen/TargetLowering.h"
|
2020-05-23 20:49:38 +02:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2014-01-29 05:51:35 +01:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2017-06-21 22:36:32 +02:00
|
|
|
void SparcELFTargetObjectFile::Initialize(MCContext &Ctx,
|
|
|
|
const TargetMachine &TM) {
|
|
|
|
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
|
|
|
|
}
|
|
|
|
|
2014-02-09 15:50:44 +01:00
|
|
|
const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
|
2016-09-16 09:33:15 +02:00
|
|
|
const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
|
|
|
|
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
2014-01-29 05:51:35 +01:00
|
|
|
|
|
|
|
if (Encoding & dwarf::DW_EH_PE_pcrel) {
|
|
|
|
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
|
|
|
|
2016-09-16 09:33:15 +02:00
|
|
|
MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", TM);
|
2014-01-29 05:51:35 +01: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 07:30:21 +02:00
|
|
|
if (!StubSym.getPointer()) {
|
2016-11-22 17:17:20 +01:00
|
|
|
MCSymbol *Sym = TM.getSymbol(GV);
|
2014-01-29 05:51:35 +01:00
|
|
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
|
|
|
}
|
|
|
|
|
|
|
|
MCContext &Ctx = getContext();
|
2015-05-30 03:25:56 +02:00
|
|
|
return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,
|
|
|
|
MCSymbolRefExpr::create(SSym, Ctx), Ctx);
|
2014-01-29 05:51:35 +01:00
|
|
|
}
|
|
|
|
|
2016-09-16 09:33:15 +02:00
|
|
|
return TargetLoweringObjectFileELF::getTTypeGlobalReference(GV, Encoding, TM,
|
|
|
|
MMI, Streamer);
|
2014-01-29 05:51:35 +01:00
|
|
|
}
|