mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
MC/ELF: Allow targets to set ABI version
Tests are in the follow up change Differential Revision: https://reviews.llvm.org/D57810 llvm-svn: 354072
This commit is contained in:
parent
3ca7deb4b1
commit
e0f976b904
@ -53,13 +53,14 @@ struct ELFRelocationEntry {
|
|||||||
|
|
||||||
class MCELFObjectTargetWriter : public MCObjectTargetWriter {
|
class MCELFObjectTargetWriter : public MCObjectTargetWriter {
|
||||||
const uint8_t OSABI;
|
const uint8_t OSABI;
|
||||||
|
const uint8_t ABIVersion;
|
||||||
const uint16_t EMachine;
|
const uint16_t EMachine;
|
||||||
const unsigned HasRelocationAddend : 1;
|
const unsigned HasRelocationAddend : 1;
|
||||||
const unsigned Is64Bit : 1;
|
const unsigned Is64Bit : 1;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_, uint16_t EMachine_,
|
MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_, uint16_t EMachine_,
|
||||||
bool HasRelocationAddend);
|
bool HasRelocationAddend_, uint8_t ABIVersion_ = 0);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~MCELFObjectTargetWriter() = default;
|
virtual ~MCELFObjectTargetWriter() = default;
|
||||||
@ -97,6 +98,7 @@ public:
|
|||||||
/// \name Accessors
|
/// \name Accessors
|
||||||
/// @{
|
/// @{
|
||||||
uint8_t getOSABI() const { return OSABI; }
|
uint8_t getOSABI() const { return OSABI; }
|
||||||
|
uint8_t getABIVersion() const { return ABIVersion; }
|
||||||
uint16_t getEMachine() const { return EMachine; }
|
uint16_t getEMachine() const { return EMachine; }
|
||||||
bool hasRelocationAddend() const { return HasRelocationAddend; }
|
bool hasRelocationAddend() const { return HasRelocationAddend; }
|
||||||
bool is64Bit() const { return Is64Bit; }
|
bool is64Bit() const { return Is64Bit; }
|
||||||
|
@ -425,7 +425,8 @@ void ELFWriter::writeHeader(const MCAssembler &Asm) {
|
|||||||
W.OS << char(ELF::EV_CURRENT); // e_ident[EI_VERSION]
|
W.OS << char(ELF::EV_CURRENT); // e_ident[EI_VERSION]
|
||||||
// e_ident[EI_OSABI]
|
// e_ident[EI_OSABI]
|
||||||
W.OS << char(OWriter.TargetObjectWriter->getOSABI());
|
W.OS << char(OWriter.TargetObjectWriter->getOSABI());
|
||||||
W.OS << char(0); // e_ident[EI_ABIVERSION]
|
// e_ident[EI_ABIVERSION]
|
||||||
|
W.OS << char(OWriter.TargetObjectWriter->getABIVersion());
|
||||||
|
|
||||||
W.OS.write_zeros(ELF::EI_NIDENT - ELF::EI_PAD);
|
W.OS.write_zeros(ELF::EI_NIDENT - ELF::EI_PAD);
|
||||||
|
|
||||||
|
@ -12,8 +12,9 @@ using namespace llvm;
|
|||||||
|
|
||||||
MCELFObjectTargetWriter::MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_,
|
MCELFObjectTargetWriter::MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_,
|
||||||
uint16_t EMachine_,
|
uint16_t EMachine_,
|
||||||
bool HasRelocationAddend_)
|
bool HasRelocationAddend_,
|
||||||
: OSABI(OSABI_), EMachine(EMachine_),
|
uint8_t ABIVersion_)
|
||||||
|
: OSABI(OSABI_), ABIVersion(ABIVersion_), EMachine(EMachine_),
|
||||||
HasRelocationAddend(HasRelocationAddend_), Is64Bit(Is64Bit_) {}
|
HasRelocationAddend(HasRelocationAddend_), Is64Bit(Is64Bit_) {}
|
||||||
|
|
||||||
bool MCELFObjectTargetWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
|
bool MCELFObjectTargetWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
|
||||||
|
Loading…
Reference in New Issue
Block a user