From 8bf80061ba44af16b4597627ca7d6d7fc1bed64e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 11 Apr 2013 02:21:31 +0000 Subject: Fix MachO's getRelocationAdditionalInfo. It was returning the loaded address of the section containing the relocation, which really doesn't seem to be the intent of this function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179255 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/MachO.h | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'include/llvm') diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index 49800fc381..b02e1ac100 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -271,6 +271,8 @@ protected: virtual error_code getLibraryNext(DataRefImpl LibData, LibraryRef &Res) const; virtual error_code getLibraryPath(DataRefImpl LibData, StringRef &Res) const; + virtual error_code getRelocationAdditionalInfo(DataRefImpl Rel, + int64_t &Res) const; std::size_t getSectionIndex(DataRefImpl Sec) const; @@ -346,8 +348,6 @@ public: virtual error_code getRelocationAddress(DataRefImpl Rel, uint64_t &Res) const; virtual error_code getRelocationOffset(DataRefImpl Rel, uint64_t &Res) const; virtual error_code getRelocationSymbol(DataRefImpl Rel, SymbolRef &Res) const; - virtual error_code getRelocationAdditionalInfo(DataRefImpl Rel, - int64_t &Res) const; virtual error_code getRelocationType(DataRefImpl Rel, uint64_t &Res) const; virtual error_code getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl &Result) const; @@ -531,22 +531,6 @@ MachOObjectFile::getRelocationSymbol(DataRefImpl Rel, return object_error::success; } -template -error_code -MachOObjectFile::getRelocationAdditionalInfo(DataRefImpl Rel, - int64_t &Res) const { - const RelocationEntry *RE = getRelocation(Rel); - bool isExtern = (RE->Word1 >> 27) & 1; - Res = 0; - if (!isExtern) { - const uint8_t* sectAddress = base(); - const Section *Sect = getSection(Sections[Rel.d.b]); - sectAddress += Sect->Offset; - Res = reinterpret_cast(sectAddress); - } - return object_error::success; -} - template error_code MachOObjectFile::getRelocationType(DataRefImpl Rel, uint64_t &Res) const { -- cgit v1.2.3-70-g09d2