[PATCH] D70034: Fix include guard and properly order __deregister_frame_info.

Sterling Augustine via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 17:13:52 PST 2019


saugustine updated this revision to Diff 228786.
saugustine added a comment.

- Fix space.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70034/new/

https://reviews.llvm.org/D70034

Files:
  compiler-rt/lib/crt/crtbegin.c
  compiler-rt/test/crt/ctor_dtor.c


Index: compiler-rt/test/crt/ctor_dtor.c
===================================================================
--- compiler-rt/test/crt/ctor_dtor.c
+++ compiler-rt/test/crt/ctor_dtor.c
@@ -4,9 +4,23 @@
 
 #include <stdio.h>
 
-// CHECK:      ctor()
+// Ensure the various startup functions are called in the proper order.
+
+// CHECK: __register_frame_info()
+// CHECK-NEXT: ctor()
 // CHECK-NEXT: main()
 // CHECK-NEXT: dtor()
+// CHECK-NEXT: __deregister_frame_info()
+
+struct object;
+
+void __register_frame_info(const void *fi, struct object *obj) {
+  printf("__register_frame_info()\n");
+}
+
+void __deregister_frame_info(const void *fi) {
+  printf("__deregister_frame_info()\n");
+}
 
 void __attribute__((constructor)) ctor() {
   printf("ctor()\n");
Index: compiler-rt/lib/crt/crtbegin.c
===================================================================
--- compiler-rt/lib/crt/crtbegin.c
+++ compiler-rt/lib/crt/crtbegin.c
@@ -73,12 +73,12 @@
     __cxa_finalize(__dso_handle);
 
 #ifndef CRT_HAS_INITFINI_ARRAY
-  if (__deregister_frame_info)
-    __deregister_frame_info(__EH_FRAME_LIST__);
-
   const size_t n = __DTOR_LIST_END__ - __DTOR_LIST__ - 1;
   for (size_t i = 1; i <= n; i++) __DTOR_LIST__[i]();
 #endif
+
+  if (__deregister_frame_info)
+    __deregister_frame_info(__EH_FRAME_LIST__);
 }
 
 #ifdef CRT_HAS_INITFINI_ARRAY


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70034.228786.patch
Type: text/x-patch
Size: 1349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191112/00442d39/attachment.bin>


More information about the llvm-commits mailing list