summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/miscfuncs.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/miscfuncs.cc')
-rw-r--r--winsup/cygwin/miscfuncs.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index e6ea5cc2d..7f324b946 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -1,7 +1,7 @@
/* miscfuncs.cc: misc funcs that don't belong anywhere else
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
This file is part of Cygwin.
@@ -534,6 +534,19 @@ __import_address (void *imp)
return NULL;
}
+/* Helper function to generate the correct caller address. For external
+ calls, the return address on the stack is _sigbe. In that case the
+ actual caller return address is on the cygtls stack. Use this function
+ via the macro caller_return_address. */
+extern "C" void _sigbe ();
+
+void *
+__caller_return_address (void *builtin_ret_addr)
+{
+ return builtin_ret_addr == &_sigbe
+ ? (void *) _my_tls.retaddr () : builtin_ret_addr;
+}
+
/* CygwinCreateThread.
Replacement function for CreateThread. What we do here is to remove