summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/lib/atexit.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-11-05 09:48:00 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-11-05 09:48:00 +0000
commit4d67bb4936135c7089f1f6e7a1208c30af2c5ee9 (patch)
treee3af795a62d33ab67227b9b64abf5cba6543c96b /winsup/cygwin/lib/atexit.c
parenta2ba36a67d4d6caa4da75bbd18a467651caf1497 (diff)
downloadcygnal-4d67bb4936135c7089f1f6e7a1208c30af2c5ee9.tar.gz
cygnal-4d67bb4936135c7089f1f6e7a1208c30af2c5ee9.tar.bz2
cygnal-4d67bb4936135c7089f1f6e7a1208c30af2c5ee9.zip
* Makefile.in (NEW_FUNCTIONS): Add atexit to be not exported.
* lib/atexit.c (atexit): New, statically linkable version of atexit. * dcrt0.cc (cygwin_atexit): Add comment to mark this function as old entry point. Indiscriminately check for DSO of function pointer for all functions, if checking for DSO of return address fails on x86_64. Change comment accordingly.
Diffstat (limited to 'winsup/cygwin/lib/atexit.c')
-rw-r--r--winsup/cygwin/lib/atexit.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/winsup/cygwin/lib/atexit.c b/winsup/cygwin/lib/atexit.c
new file mode 100644
index 000000000..0b724771a
--- /dev/null
+++ b/winsup/cygwin/lib/atexit.c
@@ -0,0 +1,23 @@
+/* atexit.c: atexit entry point
+
+ Copyright 2014 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#include <stddef.h>
+
+/* Statically linked replacement for the former cygwin_atexit. We need
+ the function here to be able to access the correct __dso_handle of the
+ caller's DSO. */
+int
+atexit (void (*fn) (void))
+{
+ extern int __cxa_atexit(void (*)(void*), void*, void*);
+ extern void *__dso_handle;
+
+ return __cxa_atexit ((void (*)(void*))fn, NULL, &__dso_handle);
+}