diff options
author | Tim Northover <tnorthover@apple.com> | 2014-07-04 10:57:56 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2014-07-04 10:57:56 +0000 |
commit | 07f99fb769719ce703aa3f334e531f9e1ff852d2 (patch) | |
tree | 5032d9c5d19cb8ab8f56ecff0736122cbd8d2cfc /llvm/lib/Object/MachOObjectFile.cpp | |
parent | a420df2999fd0362933d381f71ab81e1e6e1fa1e (diff) | |
download | bcm5719-llvm-07f99fb769719ce703aa3f334e531f9e1ff852d2.tar.gz bcm5719-llvm-07f99fb769719ce703aa3f334e531f9e1ff852d2.zip |
llvm-readobj: fix MachO relocatoin printing a bit.
There were two issues here:
1. At the very least, scattered relocations cannot use the same code to
determine the corresponding symbol being referred to. For some reason we
pretend there is no symbol, even when one actually exists in the symtab, so to
match this behaviour getRelocationSymbol should simply return symbols_end for
scattered relocations.
2. Printing "-" when we can't get a symbol (including the scattered case, but
not exclusively), isn't that helpful. In both cases there *is* interesting
information in that field, so we should print it. As hex will do.
Small part of rdar://problem/17553104
llvm-svn: 212332
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 50e7f63a930..4919114d234 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -868,6 +868,9 @@ std::error_code MachOObjectFile::getRelocationOffset(DataRefImpl Rel, symbol_iterator MachOObjectFile::getRelocationSymbol(DataRefImpl Rel) const { MachO::any_relocation_info RE = getRelocation(Rel); + if (isRelocationScattered(RE)) + return symbol_end(); + uint32_t SymbolIdx = getPlainRelocationSymbolNum(RE); bool isExtern = getPlainRelocationExternal(RE); if (!isExtern) |