[compiler-rt] [AIX][PGO] Handle atexit functions when dlclose'ing shared libraries (PR #102940)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 14:50:05 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)
----------------
vitalybuka wrote:

why do you need this define?

https://github.com/llvm/llvm-project/pull/102940


More information about the llvm-commits mailing list