mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-27 09:17:11 +00:00
Add ELF ObjectWriter and Streamer support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111172 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -44,9 +44,9 @@ class MCSectionELF : public MCSection {
|
|||||||
private:
|
private:
|
||||||
friend class MCContext;
|
friend class MCContext;
|
||||||
MCSectionELF(StringRef Section, unsigned type, unsigned flags,
|
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),
|
: MCSection(SV_ELF, K), SectionName(Section), Type(type), Flags(flags),
|
||||||
IsExplicit(isExplicit) {}
|
IsExplicit(isExplicit), EntrySize(entrySize) {}
|
||||||
~MCSectionELF();
|
~MCSectionELF();
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -174,6 +174,7 @@ public:
|
|||||||
StringRef getSectionName() const { return SectionName; }
|
StringRef getSectionName() const { return SectionName; }
|
||||||
unsigned getType() const { return Type; }
|
unsigned getType() const { return Type; }
|
||||||
unsigned getFlags() const { return Flags; }
|
unsigned getFlags() const { return Flags; }
|
||||||
|
unsigned getEntrySize() const { return EntrySize; }
|
||||||
|
|
||||||
void PrintSwitchToSection(const MCAsmInfo &MAI,
|
void PrintSwitchToSection(const MCAsmInfo &MAI,
|
||||||
raw_ostream &OS) const;
|
raw_ostream &OS) const;
|
||||||
|
|||||||
@@ -359,6 +359,12 @@ namespace llvm {
|
|||||||
MCCodeEmitter &CE, raw_ostream &OS,
|
MCCodeEmitter &CE, raw_ostream &OS,
|
||||||
bool RelaxAll = false);
|
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
|
/// createLoggingStreamer - Create a machine code streamer which just logs the
|
||||||
/// API calls and then dispatches to another streamer.
|
/// API calls and then dispatches to another streamer.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -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.
|
// Symbol bindings.
|
||||||
enum {
|
enum {
|
||||||
STB_LOCAL = 0, // Local symbol, not visible outside obj file containing def
|
STB_LOCAL = 0, // Local symbol, not visible outside obj file containing def
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
add_llvm_library(LLVMMC
|
add_llvm_library(LLVMMC
|
||||||
|
ELFObjectWriter.cpp
|
||||||
MCAsmInfo.cpp
|
MCAsmInfo.cpp
|
||||||
MCAsmInfoCOFF.cpp
|
MCAsmInfoCOFF.cpp
|
||||||
MCAsmInfoDarwin.cpp
|
MCAsmInfoDarwin.cpp
|
||||||
@@ -7,6 +8,7 @@ add_llvm_library(LLVMMC
|
|||||||
MCCodeEmitter.cpp
|
MCCodeEmitter.cpp
|
||||||
MCContext.cpp
|
MCContext.cpp
|
||||||
MCDisassembler.cpp
|
MCDisassembler.cpp
|
||||||
|
MCELFStreamer.cpp
|
||||||
MCExpr.cpp
|
MCExpr.cpp
|
||||||
MCInst.cpp
|
MCInst.cpp
|
||||||
MCInstPrinter.cpp
|
MCInstPrinter.cpp
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ getMachOSection(StringRef Segment, StringRef Section,
|
|||||||
|
|
||||||
const MCSection *MCContext::
|
const MCSection *MCContext::
|
||||||
getELFSection(StringRef Section, unsigned Type, unsigned Flags,
|
getELFSection(StringRef Section, unsigned Type, unsigned Flags,
|
||||||
SectionKind Kind, bool IsExplicit) {
|
SectionKind Kind, bool IsExplicit, unsigned EntrySize) {
|
||||||
if (ELFUniquingMap == 0)
|
if (ELFUniquingMap == 0)
|
||||||
ELFUniquingMap = new ELFUniqueMapTy();
|
ELFUniquingMap = new ELFUniqueMapTy();
|
||||||
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap;
|
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap;
|
||||||
@@ -158,7 +158,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
|
|||||||
if (Entry.getValue()) return Entry.getValue();
|
if (Entry.getValue()) return Entry.getValue();
|
||||||
|
|
||||||
MCSectionELF *Result = new (*this) MCSectionELF(Entry.getKey(), Type, Flags,
|
MCSectionELF *Result = new (*this) MCSectionELF(Entry.getKey(), Type, Flags,
|
||||||
Kind, IsExplicit);
|
Kind, IsExplicit, EntrySize);
|
||||||
Entry.setValue(Result);
|
Entry.setValue(Result);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user