LLVM
20.0.0git
lib
Target
Xtensa
MCTargetDesc
XtensaELFObjectWriter.cpp
Go to the documentation of this file.
1
//===-- XtensaMCObjectWriter.cpp - Xtensa ELF writer ----------------------===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6
// See https://llvm.org/LICENSE.txt for license information.
7
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
//
9
//===----------------------------------------------------------------------===//
10
11
#include "
MCTargetDesc/XtensaMCTargetDesc.h
"
12
#include "
llvm/ADT/STLExtras.h
"
13
#include "
llvm/BinaryFormat/ELF.h
"
14
#include "
llvm/MC/MCELFObjectWriter.h
"
15
#include "
llvm/MC/MCExpr.h
"
16
#include "
llvm/MC/MCFixup.h
"
17
#include "
llvm/MC/MCObjectWriter.h
"
18
#include "
llvm/MC/MCValue.h
"
19
#include "
llvm/Support/ErrorHandling.h
"
20
#include <cassert>
21
#include <cstdint>
22
23
using namespace
llvm
;
24
25
namespace
{
26
class
XtensaObjectWriter :
public
MCELFObjectTargetWriter
{
27
public
:
28
XtensaObjectWriter(
uint8_t
OSABI);
29
30
virtual
~XtensaObjectWriter();
31
32
protected
:
33
unsigned
getRelocType
(
MCContext
&Ctx,
const
MCValue
&
Target
,
34
const
MCFixup
&
Fixup
,
bool
IsPCRel)
const override
;
35
bool
needsRelocateWithSymbol
(
const
MCValue
&Val,
const
MCSymbol
&
Sym
,
36
unsigned
Type
)
const override
;
37
};
38
}
// namespace
39
40
XtensaObjectWriter::XtensaObjectWriter(
uint8_t
OSABI)
41
:
MCELFObjectTargetWriter
(
false
, OSABI,
ELF
::
EM_XTENSA
,
42
/*HasRelocationAddend=*/
true
) {}
43
44
XtensaObjectWriter::~XtensaObjectWriter() {}
45
46
unsigned
XtensaObjectWriter::getRelocType(
MCContext
&Ctx,
const
MCValue
&
Target
,
47
const
MCFixup
&
Fixup
,
48
bool
IsPCRel)
const
{
49
50
switch
((
unsigned
)
Fixup
.getKind()) {
51
case
FK_Data_4
:
52
return
ELF::R_XTENSA_32;
53
default
:
54
return
ELF::R_XTENSA_SLOT0_OP;
55
}
56
}
57
58
std::unique_ptr<MCObjectTargetWriter>
59
llvm::createXtensaObjectWriter
(
uint8_t
OSABI,
bool
IsLittleEndian) {
60
return
std::make_unique<XtensaObjectWriter>(OSABI);
61
}
62
63
bool
XtensaObjectWriter::needsRelocateWithSymbol(
const
MCValue
&,
64
const
MCSymbol
&,
65
unsigned
Type
)
const
{
66
return
false
;
67
}
true
basic Basic Alias true
Definition:
BasicAliasAnalysis.cpp:1981
ELF.h
Sym
Symbol * Sym
Definition:
ELF_riscv.cpp:479
MCELFObjectWriter.h
MCExpr.h
MCFixup.h
MCObjectWriter.h
MCValue.h
Fixup
PowerPC TLS Dynamic Call Fixup
Definition:
PPCTLSDynamicCall.cpp:339
STLExtras.h
This file contains some templates that are useful if you are working with the STL at all.
XtensaMCTargetDesc.h
llvm::MCContext
Context object for machine code objects.
Definition:
MCContext.h:83
llvm::MCELFObjectTargetWriter
Definition:
MCELFObjectWriter.h:53
llvm::MCELFObjectTargetWriter::needsRelocateWithSymbol
virtual bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym, unsigned Type) const
Definition:
MCELFObjectTargetWriter.cpp:20
llvm::MCELFObjectTargetWriter::getRelocType
virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const =0
llvm::MCFixup
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition:
MCFixup.h:71
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition:
MCSymbol.h:41
llvm::MCValue
This represents an "assembler immediate".
Definition:
MCValue.h:36
llvm::Target
Target - Wrapper for Target specific information.
Definition:
TargetRegistry.h:144
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:
Type.h:45
uint8_t
ErrorHandling.h
false
Definition:
StackSlotColoring.cpp:193
llvm::ELF::EM_XTENSA
@ EM_XTENSA
Definition:
ELF.h:212
llvm::logicalview::LVBinaryType::ELF
@ ELF
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::FK_Data_4
@ FK_Data_4
A four-byte fixup.
Definition:
MCFixup.h:25
llvm::createXtensaObjectWriter
std::unique_ptr< MCObjectTargetWriter > createXtensaObjectWriter(uint8_t OSABI, bool IsLittleEndian)
Definition:
XtensaELFObjectWriter.cpp:59
Generated on Sat Dec 21 2024 05:07:37 for LLVM by
1.9.6