summaryrefslogtreecommitdiff
path: root/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorJason W Kim <jason.w.kim.2009@gmail.com>2011-02-04 21:41:11 +0000
committerJason W Kim <jason.w.kim.2009@gmail.com>2011-02-04 21:41:11 +0000
commit2d7a53aec2c6426eba9e5dd6462cc9e86432b410 (patch)
tree1385db05b9cae29cf96a5e89971deadefc9b6ac5 /lib/MC/ELFObjectWriter.cpp
parent685c350ae76b588e1f00c01a511fe8bd57f18394 (diff)
downloadllvm-2d7a53aec2c6426eba9e5dd6462cc9e86432b410.tar.gz
llvm-2d7a53aec2c6426eba9e5dd6462cc9e86432b410.tar.bz2
llvm-2d7a53aec2c6426eba9e5dd6462cc9e86432b410.tar.xz
Teach ARM/MC/ELF about EF_ARM_EABI_VERSION. The magic number is set to
5 to match the current doc. Added FIXME reminder Make it really configurable later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/ELFObjectWriter.cpp')
-rw-r--r--lib/MC/ELFObjectWriter.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp
index 629d746826..bd5d048f26 100644
--- a/lib/MC/ELFObjectWriter.cpp
+++ b/lib/MC/ELFObjectWriter.cpp
@@ -276,6 +276,9 @@ namespace {
virtual void WriteHeader(uint64_t SectionDataSize, unsigned NumberOfSections);
+ /// Default e_flags = 0
+ virtual void WriteEFlags() { Write32(0); }
+
virtual void WriteSymbolEntry(MCDataFragment *SymtabF, MCDataFragment *ShndxF,
uint64_t name, uint8_t info,
uint64_t value, uint64_t size,
@@ -387,11 +390,16 @@ namespace {
class ARMELFObjectWriter : public ELFObjectWriter {
public:
+ // FIXME: MCAssembler can't yet return the Subtarget,
+ enum { DefaultEABIVersion = 0x05000000U };
+
ARMELFObjectWriter(MCELFObjectTargetWriter *MOTW,
raw_ostream &_OS,
bool IsLittleEndian);
virtual ~ARMELFObjectWriter();
+
+ virtual void WriteEFlags();
protected:
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
bool IsPCRel, bool IsRelocWithSymbol,
@@ -459,8 +467,8 @@ void ELFObjectWriter::WriteHeader(uint64_t SectionDataSize,
WriteWord(SectionDataSize + (is64Bit() ? sizeof(ELF::Elf64_Ehdr) :
sizeof(ELF::Elf32_Ehdr))); // e_shoff = sec hdr table off in bytes
- // FIXME: Make this configurable.
- Write32(0); // e_flags = whatever the target wants
+ // e_flags = whatever the target wants
+ WriteEFlags();
// e_ehsize = ELF header size
Write16(is64Bit() ? sizeof(ELF::Elf64_Ehdr) : sizeof(ELF::Elf32_Ehdr));
@@ -1477,6 +1485,11 @@ ARMELFObjectWriter::ARMELFObjectWriter(MCELFObjectTargetWriter *MOTW,
ARMELFObjectWriter::~ARMELFObjectWriter()
{}
+// FIXME: get the real EABI Version from the Triple.
+void ARMELFObjectWriter::WriteEFlags() {
+ Write32(ELF::EF_ARM_EABIMASK & DefaultEABIVersion);
+}
+
unsigned ARMELFObjectWriter::GetRelocType(const MCValue &Target,
const MCFixup &Fixup,
bool IsPCRel,