[compiler-rt] 7f1026a - [cfi][test] cross-dso/stats.cpp: don't assume the order of static constructors

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 15:50:58 PST 2020


Author: Fangrui Song
Date: 2020-01-08T15:50:51-08:00
New Revision: 7f1026a7520eb3d7e99da77f6738deb72de17980

URL: https://github.com/llvm/llvm-project/commit/7f1026a7520eb3d7e99da77f6738deb72de17980
DIFF: https://github.com/llvm/llvm-project/commit/7f1026a7520eb3d7e99da77f6738deb72de17980.diff

LOG: [cfi][test] cross-dso/stats.cpp: don't assume the order of static constructors

__sanitizer_stat_init is called for the executable first, then the
shared object. In WriterModuleReport(), the information for the shared
object will be recorded first. It'd be nice to get rid of the order
requirement of static constructors. (This should make .ctors platforms
work.)

Added: 
    

Modified: 
    compiler-rt/test/cfi/cross-dso/stats.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/cfi/cross-dso/stats.cpp b/compiler-rt/test/cfi/cross-dso/stats.cpp
index 09a7217bf066..9d8c2ee3e0d9 100644
--- a/compiler-rt/test/cfi/cross-dso/stats.cpp
+++ b/compiler-rt/test/cfi/cross-dso/stats.cpp
@@ -22,24 +22,24 @@ extern "C" void nvcall(A *a);
 #ifdef SHARED_LIB
 
 extern "C" __attribute__((noinline)) void vcall(A *a) {
-  // CHECK: stats.cpp:[[@LINE+1]] vcall.cfi cfi-vcall 37
+  // CHECK-DAG: stats.cpp:[[@LINE+1]] vcall.cfi cfi-vcall 37
   a->vf();
 }
 
 extern "C" __attribute__((noinline)) void nvcall(A *a) {
-  // CHECK: stats.cpp:[[@LINE+1]] nvcall.cfi cfi-nvcall 51
+  // CHECK-DAG: stats.cpp:[[@LINE+1]] nvcall.cfi cfi-nvcall 51
   a->nvf();
 }
 
 #else
 
 extern "C" __attribute__((noinline)) A *dcast(A *a) {
-  // CHECK: stats.cpp:[[@LINE+1]] dcast.cfi cfi-derived-cast 24
+  // CHECK-DAG: stats.cpp:[[@LINE+1]] dcast.cfi cfi-derived-cast 24
   return (A *)(ABase *)a;
 }
 
 extern "C" __attribute__((noinline)) A *ucast(A *a) {
-  // CHECK: stats.cpp:[[@LINE+1]] ucast.cfi cfi-unrelated-cast 81
+  // CHECK-DAG: stats.cpp:[[@LINE+1]] ucast.cfi cfi-unrelated-cast 81
   return (A *)(char *)a;
 }
 


        


More information about the llvm-commits mailing list