[llvm-commits] [llvm] r111172 - in /llvm/trunk: include/llvm/MC/MCSectionELF.h include/llvm/MC/MCStreamer.h include/llvm/Support/ELF.h lib/MC/CMakeLists.txt lib/MC/MCContext.cpp
Matt Fleming
matt at console-pimps.org
Mon Aug 16 11:35:43 PDT 2010
Author: mfleming
Date: Mon Aug 16 13:35:43 2010
New Revision: 111172
URL: http://llvm.org/viewvc/llvm-project?rev=111172&view=rev
Log:
Add ELF ObjectWriter and Streamer support.
Modified:
llvm/trunk/include/llvm/MC/MCSectionELF.h
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/include/llvm/Support/ELF.h
llvm/trunk/lib/MC/CMakeLists.txt
llvm/trunk/lib/MC/MCContext.cpp
Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=111172&r1=111171&r2=111172&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionELF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionELF.h Mon Aug 16 13:35:43 2010
@@ -44,9 +44,9 @@
private:
friend class MCContext;
MCSectionELF(StringRef Section, unsigned type, unsigned flags,
- SectionKind K, bool isExplicit)
+ SectionKind K, bool isExplicit, unsigned entrySize)
: MCSection(SV_ELF, K), SectionName(Section), Type(type), Flags(flags),
- IsExplicit(isExplicit) {}
+ IsExplicit(isExplicit), EntrySize(entrySize) {}
~MCSectionELF();
public:
@@ -174,6 +174,7 @@
StringRef getSectionName() const { return SectionName; }
unsigned getType() const { return Type; }
unsigned getFlags() const { return Flags; }
+ unsigned getEntrySize() const { return EntrySize; }
void PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const;
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=111172&r1=111171&r2=111172&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Aug 16 13:35:43 2010
@@ -359,6 +359,12 @@
MCCodeEmitter &CE, raw_ostream &OS,
bool RelaxAll = false);
+ /// createELFStreamer - Create a machine code streamer which will generate
+ /// ELF format object files.
+ MCStreamer *createELFStreamer(MCContext &Ctx, TargetAsmBackend &TAB,
+ raw_ostream &OS, MCCodeEmitter *CE,
+ bool RelaxAll = false);
+
/// createLoggingStreamer - Create a machine code streamer which just logs the
/// API calls and then dispatches to another streamer.
///
Modified: llvm/trunk/include/llvm/Support/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ELF.h?rev=111172&r1=111171&r2=111172&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ELF.h (original)
+++ llvm/trunk/include/llvm/Support/ELF.h Mon Aug 16 13:35:43 2010
@@ -330,6 +330,12 @@
}
};
+// The size (in bytes) of symbol table entries.
+enum {
+ SYMENTRY_SIZE32 = 16, // 32-bit symbol entry size
+ SYMENTRY_SIZE64 = 24 // 64-bit symbol entry size.
+};
+
// Symbol bindings.
enum {
STB_LOCAL = 0, // Local symbol, not visible outside obj file containing def
Modified: llvm/trunk/lib/MC/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/CMakeLists.txt?rev=111172&r1=111171&r2=111172&view=diff
==============================================================================
--- llvm/trunk/lib/MC/CMakeLists.txt (original)
+++ llvm/trunk/lib/MC/CMakeLists.txt Mon Aug 16 13:35:43 2010
@@ -1,4 +1,5 @@
add_llvm_library(LLVMMC
+ ELFObjectWriter.cpp
MCAsmInfo.cpp
MCAsmInfoCOFF.cpp
MCAsmInfoDarwin.cpp
@@ -7,6 +8,7 @@
MCCodeEmitter.cpp
MCContext.cpp
MCDisassembler.cpp
+ MCELFStreamer.cpp
MCExpr.cpp
MCInst.cpp
MCInstPrinter.cpp
Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=111172&r1=111171&r2=111172&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Mon Aug 16 13:35:43 2010
@@ -148,7 +148,7 @@
const MCSection *MCContext::
getELFSection(StringRef Section, unsigned Type, unsigned Flags,
- SectionKind Kind, bool IsExplicit) {
+ SectionKind Kind, bool IsExplicit, unsigned EntrySize) {
if (ELFUniquingMap == 0)
ELFUniquingMap = new ELFUniqueMapTy();
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap;
@@ -158,7 +158,7 @@
if (Entry.getValue()) return Entry.getValue();
MCSectionELF *Result = new (*this) MCSectionELF(Entry.getKey(), Type, Flags,
- Kind, IsExplicit);
+ Kind, IsExplicit, EntrySize);
Entry.setValue(Result);
return Result;
}
More information about the llvm-commits
mailing list