================
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 %s -triple=i686-pc-win32 -fms-extensions -emit-llvm -o - | 
FileCheck %s
+
+int __cdecl myexit(void (__cdecl *pf)(void));
+
+struct S {
+  S();
+  ~S();
+};
+
+#pragma init_seg(".myseg", myexit)
+
+S s;
+
+// The initializer pointer is still placed in the custom section.
+// CHECK: @__cxx_init_fn_ptr = private constant ptr @"??__Es@@YAXXZ", section 
".myseg"
+
+// The destructor registration calls myexit instead of atexit.
+// CHECK-LABEL: define {{.*}} @"??__Es@@YAXXZ"
+// CHECK: call i32 @"?myexit@@{{[^"]+}}"(
+// CHECK-NOT: call {{.*}} @atexit(
----------------
rnk wrote:

I would also add a trailing anchor point, ret void, like this structure:
```
CHECK-NOT: call {{.*}} @atexit
CHECK: @myexit
CHECK-NOT: @atexit
CHECK: ret void
```

https://github.com/llvm/llvm-project/pull/203769
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to