/src/llvm-project/llvm/lib/Target/Sparc/SparcTargetObjectFile.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===------- SparcTargetObjectFile.cpp - Sparc Object Info Impl -----------===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | |
9 | | #include "SparcTargetObjectFile.h" |
10 | | #include "MCTargetDesc/SparcMCExpr.h" |
11 | | #include "llvm/BinaryFormat/Dwarf.h" |
12 | | #include "llvm/CodeGen/MachineModuleInfoImpls.h" |
13 | | #include "llvm/CodeGen/TargetLowering.h" |
14 | | #include "llvm/Target/TargetMachine.h" |
15 | | |
16 | | using namespace llvm; |
17 | | |
18 | | void SparcELFTargetObjectFile::Initialize(MCContext &Ctx, |
19 | 0 | const TargetMachine &TM) { |
20 | 0 | TargetLoweringObjectFileELF::Initialize(Ctx, TM); |
21 | 0 | } |
22 | | |
23 | | const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference( |
24 | | const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, |
25 | 0 | MachineModuleInfo *MMI, MCStreamer &Streamer) const { |
26 | |
|
27 | 0 | if (Encoding & dwarf::DW_EH_PE_pcrel) { |
28 | 0 | MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>(); |
29 | |
|
30 | 0 | MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", TM); |
31 | | |
32 | | // Add information about the stub reference to ELFMMI so that the stub |
33 | | // gets emitted by the asmprinter. |
34 | 0 | MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym); |
35 | 0 | if (!StubSym.getPointer()) { |
36 | 0 | MCSymbol *Sym = TM.getSymbol(GV); |
37 | 0 | StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); |
38 | 0 | } |
39 | |
|
40 | 0 | MCContext &Ctx = getContext(); |
41 | 0 | return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32, |
42 | 0 | MCSymbolRefExpr::create(SSym, Ctx), Ctx); |
43 | 0 | } |
44 | | |
45 | 0 | return TargetLoweringObjectFileELF::getTTypeGlobalReference(GV, Encoding, TM, |
46 | 0 | MMI, Streamer); |
47 | 0 | } |