[llvm] r354072 - MC/ELF: Allow targets to set ABI version
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 14 14:42:09 PST 2019
Author: kzhuravl
Date: Thu Feb 14 14:42:09 2019
New Revision: 354072
URL: http://llvm.org/viewvc/llvm-project?rev=354072&view=rev
Log:
MC/ELF: Allow targets to set ABI version
Tests are in the follow up change
Differential Revision: https://reviews.llvm.org/D57810
Modified:
llvm/trunk/include/llvm/MC/MCELFObjectWriter.h
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/lib/MC/MCELFObjectTargetWriter.cpp
Modified: llvm/trunk/include/llvm/MC/MCELFObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCELFObjectWriter.h?rev=354072&r1=354071&r2=354072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCELFObjectWriter.h (original)
+++ llvm/trunk/include/llvm/MC/MCELFObjectWriter.h Thu Feb 14 14:42:09 2019
@@ -53,13 +53,14 @@ struct ELFRelocationEntry {
class MCELFObjectTargetWriter : public MCObjectTargetWriter {
const uint8_t OSABI;
+ const uint8_t ABIVersion;
const uint16_t EMachine;
const unsigned HasRelocationAddend : 1;
const unsigned Is64Bit : 1;
protected:
MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_, uint16_t EMachine_,
- bool HasRelocationAddend);
+ bool HasRelocationAddend_, uint8_t ABIVersion_ = 0);
public:
virtual ~MCELFObjectTargetWriter() = default;
@@ -97,6 +98,7 @@ public:
/// \name Accessors
/// @{
uint8_t getOSABI() const { return OSABI; }
+ uint8_t getABIVersion() const { return ABIVersion; }
uint16_t getEMachine() const { return EMachine; }
bool hasRelocationAddend() const { return HasRelocationAddend; }
bool is64Bit() const { return Is64Bit; }
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=354072&r1=354071&r2=354072&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Thu Feb 14 14:42:09 2019
@@ -425,7 +425,8 @@ void ELFWriter::writeHeader(const MCAsse
W.OS << char(ELF::EV_CURRENT); // e_ident[EI_VERSION]
// e_ident[EI_OSABI]
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);
Modified: llvm/trunk/lib/MC/MCELFObjectTargetWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFObjectTargetWriter.cpp?rev=354072&r1=354071&r2=354072&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCELFObjectTargetWriter.cpp (original)
+++ llvm/trunk/lib/MC/MCELFObjectTargetWriter.cpp Thu Feb 14 14:42:09 2019
@@ -12,8 +12,9 @@ using namespace llvm;
MCELFObjectTargetWriter::MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_,
uint16_t EMachine_,
- bool HasRelocationAddend_)
- : OSABI(OSABI_), EMachine(EMachine_),
+ bool HasRelocationAddend_,
+ uint8_t ABIVersion_)
+ : OSABI(OSABI_), ABIVersion(ABIVersion_), EMachine(EMachine_),
HasRelocationAddend(HasRelocationAddend_), Is64Bit(Is64Bit_) {}
bool MCELFObjectTargetWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
More information about the llvm-commits
mailing list