diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h
index 1473fb9..2f6b63d 100644
--- a/include/lldb/Core/Module.h
+++ b/include/lldb/Core/Module.h
@@ -686,6 +686,7 @@ public:
     ObjectFile *
     GetMemoryObjectFile (const lldb::ProcessSP &process_sp, 
                          lldb::addr_t header_addr,
+                         size_t size_to_read,
                          Error &error);
     //------------------------------------------------------------------
     /// Get the symbol vendor interface for the current architecture.
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index 3b330dd..9e2dfc8 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -3027,7 +3027,8 @@ public:
     
     lldb::ModuleSP
     ReadModuleFromMemory (const FileSpec& file_spec, 
-                          lldb::addr_t header_addr);
+                          lldb::addr_t header_addr,
+                          size_t size_to_read = 512);
 
     //------------------------------------------------------------------
     /// Attempt to get the attributes for a region of memory in the process.
diff --git a/source/Core/Module.cpp b/source/Core/Module.cpp
index 3f3be93..87d8780 100644
--- a/source/Core/Module.cpp
+++ b/source/Core/Module.cpp
@@ -252,7 +252,7 @@ Module::~Module()
 }
 
 ObjectFile *
-Module::GetMemoryObjectFile (const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, Error &error)
+Module::GetMemoryObjectFile (const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, size_t size_to_read, Error &error)
 {
     if (m_objfile_sp)
     {
@@ -264,13 +264,13 @@ Module::GetMemoryObjectFile (const lldb::ProcessSP &process_sp, lldb::addr_t hea
         if (process_sp)
         {
             m_did_load_objfile = true;
-            std::unique_ptr<DataBufferHeap> data_ap (new DataBufferHeap (512, 0));
+            std::unique_ptr<DataBufferHeap> data_ap (new DataBufferHeap (size_to_read, 0));
             Error readmem_error;
             const size_t bytes_read = process_sp->ReadMemory (header_addr, 
                                                               data_ap->GetBytes(), 
                                                               data_ap->GetByteSize(), 
                                                               readmem_error);
-            if (bytes_read == 512)
+            if (bytes_read == size_to_read)
             {
                 DataBufferSP data_sp(data_ap.release());
                 m_objfile_sp = ObjectFile::FindPlugin(shared_from_this(), process_sp, header_addr, data_sp);
diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 4284558..d90fc97 100644
--- a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // C Includes
+#include "jit_debug_interface.h"
 // C++ Includes
 // Other libraries and framework includes
 #include "lldb/Core/PluginManager.h"
@@ -15,6 +16,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
@@ -96,6 +98,7 @@ DynamicLoaderPOSIXDYLD::DynamicLoaderPOSIXDYLD(Process *process)
       m_entry_point(LLDB_INVALID_ADDRESS),
       m_auxv(),
       m_dyld_bid(LLDB_INVALID_BREAK_ID)
+      m_jit_objects()
 {
 }
 
@@ -146,6 +149,7 @@ DynamicLoaderPOSIXDYLD::DidLaunch()
         module_list.Append(executable);
         UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset);
         ProbeEntry();
+        ProbeJITInterface();
         m_process->GetTarget().ModulesDidLoad(module_list);
     }
 }
@@ -269,6 +273,42 @@ DynamicLoaderPOSIXDYLD::ProbeEntry()
     entry_break->SetBreakpointKind("shared-library-event");
 }
 
+void
+DynamicLoaderPOSIXDYLD::ProbeJITInterface()
+{
+    Breakpoint *jit_break;
+    addr_t jit_addr = LLDB_INVALID_ADDRESS;
+
+    const ConstString sym_name(lldb::jit_debug_register_code);
+    SymbolContextList target_symbols;
+    Target &target = m_process->GetTarget();
+    const ModuleList &images = target.GetImages();
+
+    if (!images.FindSymbolsWithNameAndType(sym_name, eSymbolTypeCode, target_symbols))
+        return;
+
+    SymbolContext sym_ctx;
+    target_symbols.GetContextAtIndex(0, sym_ctx);
+
+    const Address *jit_func_addr = &sym_ctx.symbol->GetAddress();
+
+    if (!jit_func_addr || !jit_func_addr->IsValid())
+        return;
+
+    jit_addr = jit_func_addr->GetCallableLoadAddress(&target);
+
+    if (jit_addr == LLDB_INVALID_ADDRESS)
+        return;
+
+    jit_break = target.CreateBreakpoint(jit_addr, true).get();
+
+    if (!jit_break)
+        return;
+
+    jit_break->SetCallback(JITDebugBreakpointHit, this, true);
+}
+
+
 // The runtime linker has run and initialized the rendezvous structure once the
 // process has hit its entry point.  When we hit the corresponding breakpoint we
 // interrogate the rendezvous structure to get the load addresses of all
@@ -289,6 +329,110 @@ DynamicLoaderPOSIXDYLD::EntryBreakpointHit(void *baton,
     return false; // Continue running.
 }
 
+bool
+DynamicLoaderPOSIXDYLD::JITDebugBreakpointHit(void *baton,
+                                              StoppointCallbackContext *context,
+                                              user_id_t break_id,
+                                              user_id_t break_loc_id)
+{
+    DynamicLoaderPOSIXDYLD* dyld_instance = static_cast<DynamicLoaderPOSIXDYLD*>(baton);;
+    Process *process = dyld_instance->m_process;
+
+    SymbolContextList target_symbols;
+    Target &target = process->GetTarget();
+    ModuleList &images = target.GetImages();
+
+    const ConstString sym_name(lldb::jit_debug_descriptor);
+    if (!images.FindSymbolsWithNameAndType(sym_name, eSymbolTypeData, target_symbols))
+        return false;
+
+    SymbolContext sym_ctx;
+    target_symbols.GetContextAtIndex(0, sym_ctx);
+
+    const Address *jit_descriptor_addr = &sym_ctx.symbol->GetAddress();
+
+    if (!jit_descriptor_addr || !jit_descriptor_addr->IsValid())
+        return false;
+
+    const addr_t jit_addr = jit_descriptor_addr->GetLoadAddress(&target);
+
+    if (jit_addr == LLDB_INVALID_ADDRESS)
+        return false;
+
+    lldb::jit_descriptor jit_desc;
+    const size_t jit_desc_size = sizeof(jit_desc);
+    Error error;
+    size_t bytes_read = process->DoReadMemory(jit_addr, &jit_desc, jit_desc_size, error);
+    if (bytes_read != jit_desc_size || !error.Success())
+        return false;
+
+    lldb::jit_code_entry jit_entry;
+    const addr_t &jit_relevant_entry = (addr_t)jit_desc.relevant_entry;
+
+    const size_t jit_entry_size = sizeof(jit_entry);
+    bytes_read = process->DoReadMemory(jit_relevant_entry, &jit_entry, jit_entry_size, error);
+    if (bytes_read != jit_entry_size || !error.Success())
+        return false;
+
+    const lldb::jit_actions_t &jit_action = (jit_actions_t)jit_desc.action_flag;
+    const addr_t &symbolfile_addr = (addr_t)jit_entry.symfile_addr;
+    const size_t &symbolfile_size = (size_t)jit_entry.symfile_size;
+    JITObjectMap &jit_objects = dyld_instance->m_jit_objects;
+    ModuleSP module_sp;
+
+    if (jit_action == lldb::JIT_REGISTER_FN)
+    {
+        module_sp = process->ReadModuleFromMemory(FileSpec("in_memory_object", false), symbolfile_addr, symbolfile_size);
+        if (module_sp)
+        {
+            bool changed;
+            jit_objects.insert(ModulePair(symbolfile_addr, module_sp));
+            module_sp->SetLoadAddress(target, 0, changed);
+            images.AppendIfNeeded(module_sp);
+            ModuleList modules;
+            modules.Append(module_sp);
+            target.ModulesDidLoad(modules);
+        }
+    }
+    else if (jit_action == lldb::JIT_UNREGISTER_FN)
+    {
+        JITObjectMap::iterator it = jit_objects.find(symbolfile_addr);
+        if (it != jit_objects.end())
+        {
+            module_sp = it->second;
+            ObjectFile *image_object_file = module_sp->GetObjectFile();
+            if (image_object_file)
+            {
+                const SectionList *section_list = image_object_file->GetSectionList ();
+                if (section_list)
+                {
+                    const uint32_t num_sections = section_list->GetSize();
+                    for (uint32_t i = 0; i<num_sections; ++i)
+                    {
+                        SectionSP section_sp(section_list->GetSectionAtIndex(i));
+                        if (section_sp)
+                        {
+                            target.GetSectionLoadList().SetSectionUnloaded (section_sp);
+                        }
+                    }
+                }
+            }
+            images.Remove(module_sp);
+            jit_objects.erase(it);
+        }
+    }
+    else if (jit_action == lldb::JIT_NOACTION)
+    {
+        // Nothing to do
+    }
+    else
+    {
+        assert(false && "Unknown jit action");
+    }
+
+    return false; // Continue Running.
+}
+
 void
 DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint()
 {
diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
index 7997b34..3af3b3c 100644
--- a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
+++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
@@ -101,6 +101,10 @@ protected:
     /// Loaded module list. (link map for each module)
     std::map<lldb::ModuleWP, lldb::addr_t, std::owner_less<lldb::ModuleWP>> m_loaded_modules;
 
+    typedef std::map<lldb::addr_t, const lldb::ModuleSP> JITObjectMap;
+    // A collection of in-memory jitted object addresses and their corresponding modules
+    JITObjectMap m_jit_objects;
+
     /// Enables a breakpoint on a function called by the runtime
     /// linker each time a module is loaded or unloaded.
     void
@@ -147,6 +151,12 @@ protected:
     void
     ProbeEntry();
 
+    /// Resolves the jit debug register code function for the current inferior process
+    /// and sets a breakpoint if available.
+    void
+    ProbeJITInterface();
+
+
     /// Callback routine invoked when we hit the breakpoint on process entry.
     ///
     /// This routine is responsible for resolving the load addresses of all
@@ -158,6 +168,17 @@ protected:
                        lldb::user_id_t break_id, 
                        lldb::user_id_t break_loc_id);
 
+    /// Callback routine invoked when we hit the breakpoint associated with an
+    /// emitted JIT object
+    ///
+    /// This routine is responsible for reading the object file from the inferior
+    /// and adding/removing it in the target.
+    static bool
+    JITDebugBreakpointHit(void *baton,
+                          lldb_private::StoppointCallbackContext *context,
+                          lldb::user_id_t break_id,
+                          lldb::user_id_t break_loc_id);
+
     /// Helper for the entry breakpoint callback.  Resolves the load addresses
     /// of all dependent modules.
     void
diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 163e713..de68d1e 100644
--- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -70,6 +70,18 @@ public:
     static unsigned
     RelocSymbol64(const ELFRelocation &rel);
 
+    static unsigned
+    RelocOffset32(const ELFRelocation &rel);
+
+    static unsigned
+    RelocOffset64(const ELFRelocation &rel);
+
+    static unsigned
+    RelocAddend32(const ELFRelocation &rel);
+
+    static unsigned
+    RelocAddend64(const ELFRelocation &rel);
+
 private:
     typedef llvm::PointerUnion<ELFRel*, ELFRela*> RelocUnion;
 
@@ -78,9 +90,9 @@ private:
 
 ELFRelocation::ELFRelocation(unsigned type)
 { 
-    if (type == DT_REL)
+    if (type == DT_REL || type == SHT_REL)
         reloc = new ELFRel();
-    else if (type == DT_RELA)
+    else if (type == DT_RELA || type == SHT_RELA)
         reloc = new ELFRela();
     else {
         assert(false && "unexpected relocation type");
@@ -141,6 +153,42 @@ ELFRelocation::RelocSymbol64(const ELFRelocation &rel)
         return ELFRela::RelocSymbol64(*rel.reloc.get<ELFRela*>());
 }
 
+unsigned
+ELFRelocation::RelocOffset32(const ELFRelocation &rel)
+{
+    if (rel.reloc.is<ELFRel*>())
+        return rel.reloc.get<ELFRel*>()->r_offset;
+    else
+        return rel.reloc.get<ELFRela*>()->r_offset;
+}
+
+unsigned
+ELFRelocation::RelocOffset64(const ELFRelocation &rel)
+{
+    if (rel.reloc.is<ELFRel*>())
+        return rel.reloc.get<ELFRel*>()->r_offset;
+    else
+        return rel.reloc.get<ELFRela*>()->r_offset;
+}
+
+unsigned
+ELFRelocation::RelocAddend32(const ELFRelocation &rel)
+{
+    if (rel.reloc.is<ELFRel*>())
+        return 0;
+    else
+        return rel.reloc.get<ELFRela*>()->r_addend;
+}
+
+unsigned
+ELFRelocation::RelocAddend64(const ELFRelocation &rel)
+{
+    if (rel.reloc.is<ELFRel*>())
+        return 0;
+    else
+        return rel.reloc.get<ELFRela*>()->r_addend;
+}
+
 } // end anonymous namespace
 
 //------------------------------------------------------------------
@@ -221,6 +269,22 @@ ObjectFileELF::CreateMemoryInstance (const lldb::ModuleSP &module_sp,
                                      const lldb::ProcessSP &process_sp, 
                                      lldb::addr_t header_addr)
 {
+    if (data_sp && data_sp->GetByteSize() > (llvm::ELF::EI_NIDENT))
+    {
+        const uint8_t *magic = data_sp->GetBytes();
+        if (ELFHeader::MagicBytesMatch(magic))
+        {
+            unsigned address_size = ELFHeader::AddressSizeInBytes(magic);
+            if (address_size == 4 || address_size == 8)
+            {
+                std::auto_ptr<ObjectFileELF> objfile_ap(new ObjectFileELF(module_sp, data_sp, process_sp, header_addr));
+                ArchSpec spec;
+                if (objfile_ap->GetArchitecture(spec) &&
+                    objfile_ap->SetModulesArchitecture(spec))
+                    return objfile_ap.release();
+            }
+        }
+    }
     return NULL;
 }
 
@@ -413,6 +477,20 @@ ObjectFileELF::ObjectFileELF (const lldb::ModuleSP &module_sp,
     m_gnu_debuglink_file.clear();
 }
 
+ObjectFileELF::ObjectFileELF (const lldb::ModuleSP &module_sp,
+                              DataBufferSP& data_sp,
+                              const lldb::ProcessSP &process_sp,
+                              addr_t header_addr) :
+    ObjectFile(module_sp, process_sp, header_addr, data_sp),
+    m_header(),
+    m_program_headers(),
+    m_section_headers(),
+    m_filespec_ap(),
+    m_shstr_data()
+{
+    ::memset(&m_header, 0, sizeof(m_header));
+}
+
 ObjectFileELF::~ObjectFileELF()
 {
 }
@@ -1053,8 +1131,8 @@ ObjectFileELF::ParseSymbols (Symtab *symtab,
         const char *symbol_name = strtab_data.PeekCStr(symbol.st_name);
 
         // No need to add symbols that have no names
-        if (symbol_name == NULL || symbol_name[0] == '\0')
-            continue;
+        //if (symbol_name == NULL || symbol_name[0] == '\0')
+        //    continue;
 
         //symbol.Dump (&strm, i, &strtab_data, section_list);
 
@@ -1163,7 +1241,7 @@ ObjectFileELF::ParseSymbols (Symtab *symtab,
         }
 
         uint64_t symbol_value = symbol.st_value;
-        if (symbol_section_sp)
+        if (symbol_section_sp && type != ObjectFile::Type::eTypeObjectFile)
             symbol_value -= symbol_section_sp->GetFileAddress();
         bool is_global = symbol.getBinding() == STB_GLOBAL;
         uint32_t flags = symbol.st_other << 8 | symbol.st_info;
@@ -1228,8 +1306,14 @@ ObjectFileELF::ParseSymbolTable(Symtab *symbol_table, user_id_t start_id, lldb_p
             size_t num_symbols = symtab_data.GetByteSize() / symtab_hdr->sh_entsize;
 
             num_symbols = ParseSymbols(symbol_table, start_id, 
+<<<<<<< HEAD
                                        section_list, num_symbols,
                                        symtab_data, strtab_data);
+=======
+                                       section_list, symtab_hdr,
+                                       symtab_data, strtab_data,
+                                       CalculateType());
+>>>>>>> 67af9a2... Add support for reading the entire ELF object file and implement relocations.
         }
     }
 
@@ -1461,6 +1545,136 @@ ObjectFileELF::ParseTrampolineSymbols(Symtab *symbol_table,
                                 strtab_data);
 }
 
+unsigned
+ObjectFileELF::RelocateSection(Symtab* symtab, const ELFHeader *hdr, const ELFSectionHeader *rel_hdr,
+                const ELFSectionHeader *symtab_hdr, const ELFSectionHeader *debug_hdr,
+                DataExtractor &rel_data, DataExtractor &symtab_data,
+                DataExtractor &debug_data, Section* rel_section)
+{
+    ELFRelocation rel(rel_hdr->sh_type);
+    lldb::addr_t offset = 0;
+    const unsigned num_relocations = rel_hdr->sh_size / rel_hdr->sh_entsize;
+    typedef unsigned (*reloc_info_fn)(const ELFRelocation &rel);
+    reloc_info_fn reloc_type;
+    reloc_info_fn reloc_symbol;
+
+    if (hdr->Is32Bit())
+    {
+        reloc_type = ELFRelocation::RelocType32;
+        reloc_symbol = ELFRelocation::RelocSymbol32;
+    }
+    else
+    {
+        reloc_type = ELFRelocation::RelocType64;
+        reloc_symbol = ELFRelocation::RelocSymbol64;
+    }
+
+    for (unsigned i = 0; i < num_relocations; ++i)
+    {
+        if (rel.Parse(rel_data, &offset) == false)
+            break;
+
+        Symbol* symbol = NULL;
+
+        if (hdr->Is32Bit())
+        {
+            switch (reloc_type(rel)) {
+            case R_386_32:
+            case R_386_PC32:
+            default:
+                assert(false && "unexpected relocation type");
+            }
+        } else {
+            switch (reloc_type(rel)) {
+            case R_X86_64_64:
+            {
+                symbol = symtab->FindSymbolByID(reloc_symbol(rel));
+                if (symbol)
+                {
+                    addr_t value = symbol->GetAddress().GetFileAddress();
+                    DataBufferSP& data_buffer_sp = debug_data.GetSharedDataBuffer();
+                    uint64_t* dst = reinterpret_cast<uint64_t*>(data_buffer_sp->GetBytes() + rel_section->GetFileOffset() + ELFRelocation::RelocOffset64(rel));
+                    *dst = value + ELFRelocation::RelocAddend64(rel);
+                }
+                break;
+            }
+            case R_X86_64_32:
+            case R_X86_64_32S:
+            {
+                symbol = symtab->FindSymbolByID(reloc_symbol(rel));
+                if (symbol)
+                {
+                    addr_t value = symbol->GetAddress().GetFileAddress();
+                    value += ELFRelocation::RelocAddend32(rel);
+                    assert((reloc_type(rel) == R_X86_64_32 && (value <= UINT32_MAX)) ||
+                           (reloc_type(rel) == R_X86_64_32S &&
+                            ((int64_t)value <= INT32_MAX && (int64_t)value >= INT32_MIN)));
+                    uint32_t truncated_addr = (value & 0xFFFFFFFF);
+                    DataBufferSP& data_buffer_sp = debug_data.GetSharedDataBuffer();
+                    uint32_t* dst = reinterpret_cast<uint32_t*>(data_buffer_sp->GetBytes() + rel_section->GetFileOffset() + ELFRelocation::RelocOffset32(rel));
+                    *dst = truncated_addr;
+                }
+                break;
+            }
+            case R_X86_64_PC32:
+            default:
+                assert(false && "unexpected relocation type");
+            }
+        }
+    }
+
+    return 0;
+}
+
+unsigned
+ObjectFileELF::RelocateDebugSections(const ELFSectionHeader *rel_hdr, user_id_t rel_id)
+{
+    assert(rel_hdr->sh_type == SHT_RELA || rel_hdr->sh_type == SHT_REL);
+
+    // Parse in the section list if needed.
+    SectionList *section_list = GetSectionList();
+    if (!section_list)
+        return 0;
+
+    // Section ID's are ones based.
+    user_id_t symtab_id = rel_hdr->sh_link + 1;
+    user_id_t debug_id = rel_hdr->sh_info + 1;
+
+    const ELFSectionHeader *symtab_hdr = GetSectionHeaderByIndex(symtab_id);
+    if (!symtab_hdr)
+        return 0;
+
+    const ELFSectionHeader *debug_hdr = GetSectionHeaderByIndex(debug_id);
+    if (!debug_hdr)
+        return 0;
+
+    Section *rel = section_list->FindSectionByID(rel_id).get();
+    if (!rel)
+        return 0;
+
+    Section *symtab = section_list->FindSectionByID(symtab_id).get();
+    if (!symtab)
+        return 0;
+
+    Section *debug = section_list->FindSectionByID(debug_id).get();
+    if (!debug)
+        return 0;
+
+    DataExtractor rel_data;
+    DataExtractor symtab_data;
+    DataExtractor debug_data;
+
+    if (ReadSectionData(rel, rel_data) &&
+        ReadSectionData(symtab, symtab_data) &&
+        ReadSectionData(debug, debug_data))
+    {
+        RelocateSection(m_symtab_ap.get(), &m_header, rel_hdr, symtab_hdr, debug_hdr,
+                        rel_data, symtab_data, debug_data, debug);
+    }
+
+    return 0;
+}
+
 Symtab *
 ObjectFileELF::GetSymtab()
 {
@@ -1523,8 +1737,37 @@ ObjectFileELF::GetSymtab()
             }
         }
     }
+
+    for (SectionHeaderCollIter I = m_section_headers.begin();
+         I != m_section_headers.end(); ++I)
+    {
+        if (I->sh_type == SHT_RELA || I->sh_type == SHT_REL)
+        {
+            if (CalculateType() == eTypeObjectFile)
+            {
+                const char *sectionName = m_shstr_data.PeekCStr(I->sh_name);
+                if (strstr(sectionName, ".rela.debug") || strstr(sectionName, ".rel.debug"))
+                {
+                    const ELFSectionHeader &reloc_header = *I;
+                    user_id_t reloc_id = SectionIndex(I);
+                    RelocateDebugSections(&reloc_header, reloc_id);
+                }
+            }
+        }
+    }
+<<<<<<< HEAD
     return m_symtab_ap.get();
 }
+=======
+
+    // Synthesize trampoline symbols to help navigate the PLT.
+    Section *reloc_section = PLTSection();
+    if (reloc_section) 
+    {
+        user_id_t reloc_id = reloc_section->GetID();
+        const ELFSectionHeader *reloc_header = GetSectionHeaderByIndex(reloc_id);
+        assert(reloc_header);
+>>>>>>> 67af9a2... Add support for reading the entire ELF object file and implement relocations.
 
 Symbol *
 ObjectFileELF::ResolveSymbolForAddress(const Address& so_addr, bool verify_unique)
diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index ede886f..96b112f 100644
--- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -158,6 +158,11 @@ private:
                   lldb::offset_t offset,
                   lldb::offset_t length);
 
+    ObjectFileELF (const lldb::ModuleSP &module_sp,
+                   lldb::DataBufferSP& data_sp,
+                   const lldb::ProcessSP &process_sp,
+                   lldb::addr_t header_addr);
+
     typedef std::vector<elf::ELFProgramHeader>  ProgramHeaderColl;
     typedef ProgramHeaderColl::iterator         ProgramHeaderCollIter;
     typedef ProgramHeaderColl::const_iterator   ProgramHeaderCollConstIter;
@@ -270,6 +275,32 @@ private:
                            const ELFSectionHeaderInfo *rela_hdr,
                            lldb::user_id_t section_id);
 
+    /// Relocates debug sections
+    unsigned
+    RelocateDebugSections(const elf::ELFSectionHeader *rel_hdr, lldb::user_id_t rel_id);
+
+    unsigned
+    RelocateSection(lldb_private::Symtab* symtab, const elf::ELFHeader *hdr, const elf::ELFSectionHeader *rel_hdr,
+                    const elf::ELFSectionHeader *symtab_hdr, const elf::ELFSectionHeader *debug_hdr,
+                    lldb_private::DataExtractor &rel_data, lldb_private::DataExtractor &symtab_data,
+                    lldb_private::DataExtractor &debug_data, lldb_private::Section* rel_section);
+
+    /// Loads the section name string table into m_shstr_data.  Returns the
+    /// number of bytes constituting the table.
+    size_t
+    GetSectionHeaderStringTable();
+
+    /// Utility method for looking up a section given its name.  Returns the
+    /// index of the corresponding section or zero if no section with the given
+    /// name can be found (note that section indices are always 1 based, and so
+    /// section index 0 is never valid).
+    lldb::user_id_t
+    GetSectionIndexByName(const char *name);
+
+    // Returns the ID of the first section that has the given type.
+    lldb::user_id_t
+    GetSectionIndexByType(unsigned type);
+
     /// Returns the section header with the given id or NULL.
     const ELFSectionHeaderInfo *
     GetSectionHeaderByIndex(lldb::user_id_t id);
diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp
index ec69c9d..6f11e9c 100644
--- a/source/Symbol/ObjectFile.cpp
+++ b/source/Symbol/ObjectFile.cpp
@@ -298,8 +298,8 @@ ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp,
     m_data (),
     m_unwind_table (*this),
     m_process_wp (process_sp),
-    m_memory_addr (header_addr),
-    m_sections_ap(),
+    m_memory_addr (LLDB_INVALID_ADDRESS),
+    m_sections_ap (),
     m_symtab_ap ()
 {
     if (header_data_sp)
diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp
index 1fe9ae9..9ae628c 100644
--- a/source/Target/Process.cpp
+++ b/source/Target/Process.cpp
@@ -2823,13 +2823,17 @@ Process::DeallocateMemory (addr_t ptr)
 
 ModuleSP
 Process::ReadModuleFromMemory (const FileSpec& file_spec, 
-                               lldb::addr_t header_addr)
+                               lldb::addr_t header_addr,
+                               size_t size_to_read)
 {
     ModuleSP module_sp (new Module (file_spec, ArchSpec()));
     if (module_sp)
     {
         Error error;
-        ObjectFile *objfile = module_sp->GetMemoryObjectFile (shared_from_this(), header_addr, error);
+        ObjectFile *objfile = module_sp->GetMemoryObjectFile (shared_from_this(),
+                                                              header_addr,
+                                                              size_to_read,
+                                                              error);
         if (objfile)
             return module_sp;
     }
