diff options
| author | Matt Fleming <matt@console-pimps.org> | 2010-08-16 18:35:43 +0000 |
|---|---|---|
| committer | Matt Fleming <matt@console-pimps.org> | 2010-08-16 18:35:43 +0000 |
| commit | d83b9278970ef9b102c5eb5ad6289084cef93943 (patch) | |
| tree | 98bf126fa66e841240ca4aea1c4f0268c1babdf6 | |
| parent | 9cecd63b07930e4402aaec1eef807ed33fd29dba (diff) | |
| download | bcm5719-llvm-d83b9278970ef9b102c5eb5ad6289084cef93943.tar.gz bcm5719-llvm-d83b9278970ef9b102c5eb5ad6289084cef93943.zip | |
Add ELF ObjectWriter and Streamer support.
llvm-svn: 111172
| -rw-r--r-- | llvm/include/llvm/MC/MCSectionELF.h | 5 | ||||
| -rw-r--r-- | llvm/include/llvm/MC/MCStreamer.h | 6 | ||||
| -rw-r--r-- | llvm/include/llvm/Support/ELF.h | 6 | ||||
| -rw-r--r-- | llvm/lib/MC/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | llvm/lib/MC/MCContext.cpp | 4 |
5 files changed, 19 insertions, 4 deletions
diff --git a/llvm/include/llvm/MC/MCSectionELF.h b/llvm/include/llvm/MC/MCSectionELF.h index a90aa38156a..5de0bf58fe0 100644 --- a/llvm/include/llvm/MC/MCSectionELF.h +++ b/llvm/include/llvm/MC/MCSectionELF.h @@ -44,9 +44,9 @@ class MCSectionELF : public MCSection { 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 @@ public: 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; diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h index 5767a94a6bc..e152c39e19d 100644 --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -359,6 +359,12 @@ namespace llvm { 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. /// diff --git a/llvm/include/llvm/Support/ELF.h b/llvm/include/llvm/Support/ELF.h index a4223cf6ca3..f33aeb4188a 100644 --- a/llvm/include/llvm/Support/ELF.h +++ b/llvm/include/llvm/Support/ELF.h @@ -330,6 +330,12 @@ struct Elf64_Sym { } }; +// 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 diff --git a/llvm/lib/MC/CMakeLists.txt b/llvm/lib/MC/CMakeLists.txt index 7b9b355339a..60a3a3e3e31 100644 --- a/llvm/lib/MC/CMakeLists.txt +++ b/llvm/lib/MC/CMakeLists.txt @@ -1,4 +1,5 @@ add_llvm_library(LLVMMC + ELFObjectWriter.cpp MCAsmInfo.cpp MCAsmInfoCOFF.cpp MCAsmInfoDarwin.cpp @@ -7,6 +8,7 @@ add_llvm_library(LLVMMC MCCodeEmitter.cpp MCContext.cpp MCDisassembler.cpp + MCELFStreamer.cpp MCExpr.cpp MCInst.cpp MCInstPrinter.cpp diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index 3996334d9bc..adf476cf3f4 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -148,7 +148,7 @@ getMachOSection(StringRef Segment, StringRef Section, 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 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags, 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; } |

