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

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 14:00:41 PST 2016


Is it possible to manufacture a test in unittests/Object/ ?

> On 2016-Nov-11, at 11:02, Kuba Brecka via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 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) {
> 
> 
> <D26537.77635.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list