LLVM
20.0.0git
lib
Target
Mips
MCTargetDesc
MipsWinCOFFObjectWriter.cpp
Go to the documentation of this file.
1
//===- MipsWinCOFFObjectWriter.cpp------------------------------*- C++ -*-===//
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 "
MCTargetDesc/MipsFixupKinds.h
"
10
#include "
MCTargetDesc/MipsMCTargetDesc.h
"
11
#include "
llvm/BinaryFormat/COFF.h
"
12
#include "
llvm/MC/MCContext.h
"
13
#include "
llvm/MC/MCWinCOFFObjectWriter.h
"
14
15
using namespace
llvm
;
16
17
namespace
{
18
19
class
MipsWinCOFFObjectWriter :
public
MCWinCOFFObjectTargetWriter
{
20
public
:
21
MipsWinCOFFObjectWriter();
22
23
unsigned
getRelocType
(
MCContext
&Ctx,
const
MCValue
&
Target
,
24
const
MCFixup
&
Fixup
,
bool
IsCrossSection,
25
const
MCAsmBackend
&MAB)
const override
;
26
};
27
28
}
// end anonymous namespace
29
30
MipsWinCOFFObjectWriter::MipsWinCOFFObjectWriter()
31
:
MCWinCOFFObjectTargetWriter
(
COFF
::
IMAGE_FILE_MACHINE_R4000
) {}
32
33
unsigned
MipsWinCOFFObjectWriter::getRelocType(
MCContext
&Ctx,
34
const
MCValue
&
Target
,
35
const
MCFixup
&
Fixup
,
36
bool
IsCrossSection,
37
const
MCAsmBackend
&MAB)
const
{
38
unsigned
FixupKind
=
Fixup
.getKind();
39
40
switch
(FixupKind) {
41
case
FK_Data_4
:
42
return
COFF::IMAGE_REL_MIPS_REFWORD
;
43
case
Mips::fixup_Mips_26
:
44
return
COFF::IMAGE_REL_MIPS_JMPADDR
;
45
case
Mips::fixup_Mips_HI16
:
46
return
COFF::IMAGE_REL_MIPS_REFHI
;
47
case
Mips::fixup_Mips_LO16
:
48
return
COFF::IMAGE_REL_MIPS_REFLO
;
49
default
:
50
Ctx.
reportError
(
Fixup
.getLoc(),
"unsupported relocation type"
);
51
return
COFF::IMAGE_REL_MIPS_REFWORD
;
52
}
53
}
54
55
std::unique_ptr<MCObjectTargetWriter>
llvm::createMipsWinCOFFObjectWriter
() {
56
return
std::make_unique<MipsWinCOFFObjectWriter>();
57
}
COFF.h
MCContext.h
MCWinCOFFObjectWriter.h
MipsFixupKinds.h
MipsMCTargetDesc.h
Fixup
PowerPC TLS Dynamic Call Fixup
Definition:
PPCTLSDynamicCall.cpp:339
llvm::MCAsmBackend
Generic interface to target specific assembler backends.
Definition:
MCAsmBackend.h:42
llvm::MCContext
Context object for machine code objects.
Definition:
MCContext.h:83
llvm::MCContext::reportError
void reportError(SMLoc L, const Twine &Msg)
Definition:
MCContext.cpp:1072
llvm::MCFixup
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition:
MCFixup.h:71
llvm::MCValue
This represents an "assembler immediate".
Definition:
MCValue.h:36
llvm::MCWinCOFFObjectTargetWriter
Definition:
MCWinCOFFObjectWriter.h:23
llvm::MCWinCOFFObjectTargetWriter::getRelocType
virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsCrossSection, const MCAsmBackend &MAB) const =0
llvm::Target
Target - Wrapper for Target specific information.
Definition:
TargetRegistry.h:144
llvm::BPF::FixupKind
FixupKind
Definition:
BPFMCFixups.h:16
llvm::COFF::IMAGE_REL_MIPS_JMPADDR
@ IMAGE_REL_MIPS_JMPADDR
Definition:
COFF.h:424
llvm::COFF::IMAGE_REL_MIPS_REFHI
@ IMAGE_REL_MIPS_REFHI
Definition:
COFF.h:425
llvm::COFF::IMAGE_REL_MIPS_REFLO
@ IMAGE_REL_MIPS_REFLO
Definition:
COFF.h:426
llvm::COFF::IMAGE_REL_MIPS_REFWORD
@ IMAGE_REL_MIPS_REFWORD
Definition:
COFF.h:423
llvm::COFF::IMAGE_FILE_MACHINE_R4000
@ IMAGE_FILE_MACHINE_R4000
Definition:
COFF.h:112
llvm::Mips::fixup_Mips_LO16
@ fixup_Mips_LO16
Definition:
MipsFixupKinds.h:41
llvm::Mips::fixup_Mips_26
@ fixup_Mips_26
Definition:
MipsFixupKinds.h:35
llvm::Mips::fixup_Mips_HI16
@ fixup_Mips_HI16
Definition:
MipsFixupKinds.h:38
llvm::logicalview::LVBinaryType::COFF
@ COFF
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::createMipsWinCOFFObjectWriter
std::unique_ptr< MCObjectTargetWriter > createMipsWinCOFFObjectWriter()
Construct a Mips Win COFF object writer.
Definition:
MipsWinCOFFObjectWriter.cpp:55
llvm::FK_Data_4
@ FK_Data_4
A four-byte fixup.
Definition:
MCFixup.h:25
Generated on Fri Jan 17 2025 06:40:02 for LLVM by
1.9.6