summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-11-15 21:07:03 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-11-15 21:07:03 +0000
commita3ccf3ddbd12a0db6522f9990a9e30e535ca76dc (patch)
treea3739b4cd583ecc736fd6e448e123987b1c641f4 /llvm/include
parented55a05b010eb62747e19ad179eb8555e28483ac (diff)
downloadbcm5719-llvm-a3ccf3ddbd12a0db6522f9990a9e30e535ca76dc.tar.gz
bcm5719-llvm-a3ccf3ddbd12a0db6522f9990a9e30e535ca76dc.zip
Fix llvm-symbolizer to correctly sort a symbol array and calculate symbol sizes
Sometimes, llvm-symbolizer gives wrong results due to incorrect sizes of some symbols. The reason for that was an incorrectly sorted array in computeSymbolSizes. The comparison function used subtraction of unsigned types, which is incorrect. Let's change this to return explicit -1 or 1. Differential Revision: https://reviews.llvm.org/D26537 llvm-svn: 287028
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Object/SymbolSize.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/include/llvm/Object/SymbolSize.h b/llvm/include/llvm/Object/SymbolSize.h
index f2ce70f4208..1a1dc875294 100644
--- a/llvm/include/llvm/Object/SymbolSize.h
+++ b/llvm/include/llvm/Object/SymbolSize.h
@@ -15,8 +15,19 @@
namespace llvm {
namespace object {
+
+struct SymEntry {
+ symbol_iterator I;
+ uint64_t Address;
+ unsigned Number;
+ unsigned SectionID;
+};
+
+int compareAddress(const SymEntry *A, const SymEntry *B);
+
std::vector<std::pair<SymbolRef, uint64_t>>
computeSymbolSizes(const ObjectFile &O);
+
}
} // namespace llvm
OpenPOWER on IntegriCloud