[llvm] r179255 - Fix MachO's getRelocationAdditionalInfo.
Rafael Espindola
rafael.espindola at gmail.com
Wed Apr 10 19:21:31 PDT 2013
Author: rafael
Date: Wed Apr 10 21:21:31 2013
New Revision: 179255
URL: http://llvm.org/viewvc/llvm-project?rev=179255&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Object/MachO.h
llvm/trunk/lib/Object/MachOObjectFile.cpp
Modified: llvm/trunk/include/llvm/Object/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=179255&r1=179254&r2=179255&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachO.h (original)
+++ llvm/trunk/include/llvm/Object/MachO.h Wed Apr 10 21:21:31 2013
@@ -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<char> &Result) const;
@@ -531,22 +531,6 @@ MachOObjectFile<MachOT>::getRelocationSy
return object_error::success;
}
-template<class MachOT>
-error_code
-MachOObjectFile<MachOT>::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<uintptr_t>(sectAddress);
- }
- return object_error::success;
-}
-
template<class MachOT>
error_code MachOObjectFile<MachOT>::getRelocationType(DataRefImpl Rel,
uint64_t &Res) const {
Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=179255&r1=179254&r2=179255&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Wed Apr 10 21:21:31 2013
@@ -512,6 +512,12 @@ error_code MachOObjectFileBase::getLibra
report_fatal_error("Needed libraries unimplemented in MachOObjectFileBase");
}
+error_code MachOObjectFileBase::getRelocationAdditionalInfo(DataRefImpl Rel,
+ int64_t &Res) const {
+ Res = 0;
+ return object_error::success;
+}
+
/*===-- Miscellaneous -----------------------------------------------------===*/
More information about the llvm-commits
mailing list