Make getRelocationSection MachO only.

There are 3 types of relocations on MachO
* Scattered
* Section based
* Symbol based

On ELF and COFF relocations are symbol based.

We were in the strange situation that we abstracted over two of them. This makes
section based relocations MachO only.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-06-19 17:54:28 +00:00
parent 260366437c
commit 776f86420e
7 changed files with 9 additions and 39 deletions

View File

@ -112,7 +112,6 @@ protected:
std::error_code getRelocationOffset(DataRefImpl Rel,
uint64_t &Res) const override;
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
section_iterator getRelocationSection(DataRefImpl Rel) const override;
std::error_code getRelocationType(DataRefImpl Rel,
uint64_t &Res) const override;
std::error_code
@ -584,20 +583,6 @@ ELFObjectFile<ELFT>::getRelocationSymbol(DataRefImpl Rel) const {
return symbol_iterator(SymbolRef(SymbolData, this));
}
// ELF relocations can target sections, by targetting a symbol of type
// STT_SECTION
template <class ELFT>
section_iterator
ELFObjectFile<ELFT>::getRelocationSection(DataRefImpl Rel) const {
symbol_iterator Sym = getRelocationSymbol(Rel);
if (Sym == symbol_end())
return section_end();
const Elf_Sym *ESym = getSymbol(Sym->getRawDataRefImpl());
if (ESym->getType() != ELF::STT_SECTION)
return section_end();
return getSymbolSection(ESym);
}
template <class ELFT>
std::error_code
ELFObjectFile<ELFT>::getRelocationAddress(DataRefImpl Rel,