[PATCH] D57810: MC/ELF: Allow targets to set ABI version
Konstantin Zhuravlyov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 6 01:19:52 PST 2019
kzhuravl created this revision.
kzhuravl added reviewers: pcc, t-tye.
Herald added a subscriber: wdng.
https://reviews.llvm.org/D57810
Files:
include/llvm/MC/MCELFObjectWriter.h
lib/MC/ELFObjectWriter.cpp
lib/MC/MCELFObjectTargetWriter.cpp
Index: lib/MC/MCELFObjectTargetWriter.cpp
===================================================================
--- lib/MC/MCELFObjectTargetWriter.cpp
+++ lib/MC/MCELFObjectTargetWriter.cpp
@@ -12,8 +12,9 @@
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,
Index: lib/MC/ELFObjectWriter.cpp
===================================================================
--- lib/MC/ELFObjectWriter.cpp
+++ lib/MC/ELFObjectWriter.cpp
@@ -425,7 +425,8 @@
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);
Index: include/llvm/MC/MCELFObjectWriter.h
===================================================================
--- include/llvm/MC/MCELFObjectWriter.h
+++ include/llvm/MC/MCELFObjectWriter.h
@@ -53,13 +53,14 @@
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 @@
/// \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; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57810.185507.patch
Type: text/x-patch
Size: 2417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190206/2569372c/attachment.bin>
More information about the llvm-commits
mailing list