[elf2] Add basic relocation support for x86-64.

This currently doesn't handle local symbols.

Differential Revision: http://reviews.llvm.org/D11612

llvm-svn: 246234
This commit is contained in:
Michael J. Spencer
2015-08-27 23:15:56 +00:00
parent 572d742927
commit 67bc8d6b3f
8 changed files with 127 additions and 14 deletions

View File

@@ -54,11 +54,20 @@ template <class ELFT> void elf2::ObjectFile<ELFT>::initializeChunks() {
}
case SHT_STRTAB:
case SHT_NULL:
case SHT_RELA:
case SHT_REL:
break;
case SHT_RELA:
case SHT_REL: {
uint32_t RelocatedSectionIndex = Sec.sh_info;
if (RelocatedSectionIndex >= Size)
error("Invalid relocated section index");
SectionChunk<ELFT> *RelocatedSection = Chunks[RelocatedSectionIndex];
if (!RelocatedSection)
error("Unsupported relocation reference");
RelocatedSection->RelocSections.push_back(&Sec);
break;
}
default:
Chunks[I] = new (Alloc) SectionChunk<ELFT>(this->getObj(), &Sec);
Chunks[I] = new (Alloc) SectionChunk<ELFT>(this, &Sec);
break;
}
++I;