[PATCH] D26537: Fix llvm-symbolizer to correctly sort a symbol array and calculate symbol sizes

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 11:02:18 PST 2016


kubabrecka removed rL LLVM as the repository for this revision.
kubabrecka updated this revision to Diff 77635.
kubabrecka added a comment.

> testcase?

Unfortunately, it's hard to come up with a reasonable testcase because the issue is hard to reproduce on small inputs (because the sorting usually works and only edge cases sort incorrectly).  One of compiler-rt tests fail due to this, however.  So with this patch, I can enable the test again.  Is that enough?


https://reviews.llvm.org/D26537

Files:
  lib/Object/SymbolSize.cpp
  projects/compiler-rt/test/asan/TestCases/use-after-scope-types.cc


Index: projects/compiler-rt/test/asan/TestCases/use-after-scope-types.cc
===================================================================
--- projects/compiler-rt/test/asan/TestCases/use-after-scope-types.cc
+++ projects/compiler-rt/test/asan/TestCases/use-after-scope-types.cc
@@ -11,9 +11,6 @@
 // RUN: not %run %t 9 2>&1 | FileCheck %s
 // RUN: not %run %t 10 2>&1 | FileCheck %s
 
-// Temporarily disable to fix the bot.
-// UNSUPPORTED: darwin
-
 #include <stdlib.h>
 #include <string>
 #include <vector>
Index: lib/Object/SymbolSize.cpp
===================================================================
--- lib/Object/SymbolSize.cpp
+++ lib/Object/SymbolSize.cpp
@@ -27,8 +27,10 @@
 
 static int compareAddress(const SymEntry *A, const SymEntry *B) {
   if (A->SectionID != B->SectionID)
-    return A->SectionID - B->SectionID;
-  return A->Address - B->Address;
+    return A->SectionID < B->SectionID ? -1 : 1;
+  if (A->Address != B->Address)
+    return A->Address < B->Address ? -1 : 1;
+  return 0;
 }
 
 static unsigned getSectionID(const ObjectFile &O, SectionRef Sec) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26537.77635.patch
Type: text/x-patch
Size: 1091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161111/29d76a79/attachment.bin>


More information about the llvm-commits mailing list