aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/MC/MCAssembler.h21
-rw-r--r--include/llvm/MC/MCSection.h3
-rw-r--r--include/llvm/Support/CommandLine.h6
-rw-r--r--include/llvm/Support/ELF.h7
-rw-r--r--lib/MC/MCAssembler.cpp10
5 files changed, 38 insertions, 9 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index 2566241..2df94e7 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -21,6 +21,10 @@
#include "llvm/Support/DataTypes.h"
#include <vector> // FIXME: Shouldn't be needed.
+namespace mcld {
+class Layout;
+}
+
namespace llvm {
class raw_ostream;
class MCAsmLayout;
@@ -40,6 +44,7 @@ class MCAsmBackend;
class MCFragment : public ilist_node<MCFragment> {
friend class MCAsmLayout;
+ friend class mcld::Layout;
MCFragment(const MCFragment&); // DO NOT IMPLEMENT
void operator=(const MCFragment&); // DO NOT IMPLEMENT
@@ -53,10 +58,13 @@ public:
FT_Org,
FT_Dwarf,
FT_DwarfFrame,
- FT_LEB
+ FT_LEB,
+ FT_Region,
+ FT_Reloc,
+ FT_Target
};
-private:
+protected:
FragmentType Kind;
/// Parent - The data for the section this fragment is in.
@@ -453,7 +461,7 @@ public:
typedef FragmentListType::const_reverse_iterator const_reverse_iterator;
typedef FragmentListType::reverse_iterator reverse_iterator;
-private:
+protected:
FragmentListType Fragments;
const MCSection *Section;
@@ -481,6 +489,7 @@ public:
// Only for use as sentinel.
MCSectionData();
MCSectionData(const MCSection &Section, MCAssembler *A = 0);
+ virtual ~MCSectionData() {}
const MCSection &getSection() const { return *Section; }
@@ -679,7 +688,7 @@ private:
MCCodeEmitter &Emitter;
- MCObjectWriter &Writer;
+ MCObjectWriter *m_pWriter;
raw_ostream &OS;
@@ -807,7 +816,9 @@ public:
MCCodeEmitter &getEmitter() const { return Emitter; }
- MCObjectWriter &getWriter() const { return Writer; }
+ MCObjectWriter &getWriter() const { return *m_pWriter; }
+
+ void setWriter(MCObjectWriter &pObjectWriter);
/// Finish - Do final processing and write the object to the output stream.
/// \arg Writer is used for custom object writer (as the MCJIT does),
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h
index 5700817..e366522 100644
--- a/include/llvm/MC/MCSection.h
+++ b/include/llvm/MC/MCSection.h
@@ -31,7 +31,8 @@ namespace llvm {
enum SectionVariant {
SV_COFF = 0,
SV_ELF,
- SV_MachO
+ SV_MachO,
+ SV_LDContext
};
private:
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h
index c212d2d..04ed592 100644
--- a/include/llvm/Support/CommandLine.h
+++ b/include/llvm/Support/CommandLine.h
@@ -337,7 +337,11 @@ struct OptionValueBase : public GenericOptionValue {
bool hasValue() const { return false; }
- const DataType &getValue() const { llvm_unreachable("no default value"); }
+ const DataType &getValue() const {
+ assert(false && "no default value");
+ DataType *p = 0;
+ return *p;
+ }
// Some options may take their value from a different data type.
template<class DT>
diff --git a/include/llvm/Support/ELF.h b/include/llvm/Support/ELF.h
index 6dd76ea..7ee363b 100644
--- a/include/llvm/Support/ELF.h
+++ b/include/llvm/Support/ELF.h
@@ -736,6 +736,13 @@ enum {
SHT_LOOS = 0x60000000, // Lowest operating system-specific type.
SHT_HIOS = 0x6fffffff, // Highest operating system-specific type.
SHT_LOPROC = 0x70000000, // Lowest processor architecture-specific type.
+
+ SHT_GNU_ATTRIBUTES = 0x6ffffff5, // Object attributes.
+ SHT_GNU_HASH = 0x6ffffff6, // GNU style dynamic hash table.
+ SHT_GNU_verdef = 0x6ffffffd, // Versions defined by file.
+ SHT_GNU_verneed = 0x6ffffffe, // Versions needed by file.
+ SHT_GNU_versym = 0x6fffffff, // Symbol versions.
+
// Fixme: All this is duplicated in MCSectionELF. Why??
// Exception Index table
SHT_ARM_EXIDX = 0x70000001U,
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index a2aaf4e..b62e8f5 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -157,7 +157,8 @@ MCFragment::~MCFragment() {
}
MCFragment::MCFragment(FragmentType _Kind, MCSectionData *_Parent)
- : Kind(_Kind), Parent(_Parent), Atom(0), Offset(~UINT64_C(0))
+ : Kind(_Kind), Parent(_Parent), Atom(0), Offset(~UINT64_C(0)),
+ LayoutOrder(~(0U))
{
if (Parent)
Parent->getFragmentList().push_back(this);
@@ -197,7 +198,7 @@ MCSymbolData::MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment,
MCAssembler::MCAssembler(MCContext &Context_, MCAsmBackend &Backend_,
MCCodeEmitter &Emitter_, MCObjectWriter &Writer_,
raw_ostream &OS_)
- : Context(Context_), Backend(Backend_), Emitter(Emitter_), Writer(Writer_),
+ : Context(Context_), Backend(Backend_), Emitter(Emitter_), m_pWriter(&Writer_),
OS(OS_), RelaxAll(false), NoExecStack(false), SubsectionsViaSymbols(false)
{
}
@@ -205,6 +206,11 @@ MCAssembler::MCAssembler(MCContext &Context_, MCAsmBackend &Backend_,
MCAssembler::~MCAssembler() {
}
+void MCAssembler::setWriter(MCObjectWriter &pObjectWriter) {
+ delete m_pWriter;
+ m_pWriter = &pObjectWriter;
+}
+
bool MCAssembler::isSymbolLinkerVisible(const MCSymbol &Symbol) const {
// Non-temporary labels should always be visible to the linker.
if (!Symbol.isTemporary())