diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-04-04 00:31:12 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-04-04 00:31:12 +0000 |
commit | 7247546ba3b17565ff59f76d31b69ac948459e32 (patch) | |
tree | cfec4c2ed000b640ff4e25655bbc499054f412ab /llvm/lib/Object | |
parent | 98a126621874024c4283cf92b5ae1c5eb2e7b8e0 (diff) | |
download | bcm5719-llvm-7247546ba3b17565ff59f76d31b69ac948459e32.tar.gz bcm5719-llvm-7247546ba3b17565ff59f76d31b69ac948459e32.zip |
Add an assert that this is only used with .o files.
I am not sure how to get a relocation in a .dylib, but this function would
return the wrong value if passed one.
llvm-svn: 205592
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 7ce62eb2a44..ce4b3d5d0c1 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -784,8 +784,8 @@ void MachOObjectFile::moveRelocationNext(DataRefImpl &Rel) const { error_code MachOObjectFile::getRelocationAddress(DataRefImpl Rel, uint64_t &Res) const { - MachO::any_relocation_info RE = getRelocation(Rel); - uint64_t Offset = getAnyRelocationAddress(RE); + uint64_t Offset; + getRelocationOffset(Rel, Offset); DataRefImpl Sec; Sec.d.a = Rel.d.a; @@ -797,6 +797,8 @@ MachOObjectFile::getRelocationAddress(DataRefImpl Rel, uint64_t &Res) const { error_code MachOObjectFile::getRelocationOffset(DataRefImpl Rel, uint64_t &Res) const { + assert(getHeader().filetype == MachO::MH_OBJECT && + "Only implemented for MH_OBJECT"); MachO::any_relocation_info RE = getRelocation(Rel); Res = getAnyRelocationAddress(RE); return object_error::success; |