mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Implement getRelocationAddress for MachO and ET_REL elf files.
With that, fix the symbolizer to work with any ELF file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205588 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -555,10 +555,17 @@ ELFObjectFile<ELFT>::getRelocationSymbol(DataRefImpl Rel) const {
|
||||
template <class ELFT>
|
||||
error_code ELFObjectFile<ELFT>::getRelocationAddress(DataRefImpl Rel,
|
||||
uint64_t &Result) const {
|
||||
assert((EF.getHeader()->e_type == ELF::ET_EXEC ||
|
||||
EF.getHeader()->e_type == ELF::ET_DYN) &&
|
||||
"Only executable and shared objects files have relocation addresses");
|
||||
Result = getROffset(Rel);
|
||||
uint64_t ROffset = getROffset(Rel);
|
||||
const Elf_Ehdr *Header = EF.getHeader();
|
||||
|
||||
if (Header->e_type == ELF::ET_REL) {
|
||||
const Elf_Shdr *RelocationSec = getRelSection(Rel);
|
||||
const Elf_Shdr *RelocatedSec = EF.getSection(RelocationSec->sh_info);
|
||||
Result = ROffset + RelocatedSec->sh_addr;
|
||||
} else {
|
||||
Result = ROffset;
|
||||
}
|
||||
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user