[compiler-rt] [AIX][PGO] Handle atexit functions when dlclose'ing shared libraries (PR #102940)
Wael Yehia via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 28 12:25:32 PDT 2024
================
@@ -373,3 +373,72 @@ COMPILER_RT_VISIBILITY int lprofReleaseMemoryPagesToOS(uintptr_t Begin,
return 0;
#endif
}
+
+#ifdef _AIX
+typedef struct fn_node {
+ AtExit_Fn_ptr func;
+ struct fn_node *next;
+} fn_node;
+typedef struct {
+ fn_node *top;
+} fn_stack;
+
+static void fn_stack_push(fn_stack *, AtExit_Fn_ptr);
+static AtExit_Fn_ptr fn_stack_pop(fn_stack *);
+/* return 1 if stack is empty, 0 otherwise */
+static int fn_stack_is_empty(fn_stack *);
+
+static fn_stack AtExit_stack = {0};
+#define ATEXIT_STACK (&AtExit_stack)
----------------
w2yehia wrote:
I thought it improved readability; inspired by [this.](https://github.com/llvm/llvm-project/blob/c43190f99445b1b76d06b650247d72fc109b5d4b/compiler-rt/lib/profile/GCDAProfiling.c#L91)
https://github.com/llvm/llvm-project/pull/102940
More information about the llvm-commits
mailing list