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 | eec7d48f8ebff799bffabfa4aefcc67581274cba (patch) | |
tree | 1999e96cf61b70a201919fea248da9f39c534c47 /lib/Object/MachOObjectFile.cpp | |
parent | 7df905954106fe2302df36d96e4952b736817298 (diff) | |
download | llvm-eec7d48f8ebff799bffabfa4aefcc67581274cba.tar.gz llvm-eec7d48f8ebff799bffabfa4aefcc67581274cba.tar.bz2 llvm-eec7d48f8ebff799bffabfa4aefcc67581274cba.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object/MachOObjectFile.cpp')
-rw-r--r-- | lib/Object/MachOObjectFile.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp index 7ce62eb2a4..ce4b3d5d0c 100644 --- a/lib/Object/MachOObjectFile.cpp +++ b/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; |