public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: move __caller_return_address to mm/malloc_wrapper.cc
@ 2022-08-10 16:13 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2022-08-10 16:13 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=afa71179992e704734ff8aa5da1a3e02b8cdcd27
commit afa71179992e704734ff8aa5da1a3e02b8cdcd27
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Wed Aug 10 17:07:52 2022 +0200
Cygwin: move __caller_return_address to mm/malloc_wrapper.cc
It's used in this file only anyway, so make it static inline.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/local_includes/miscfuncs.h | 4 ----
winsup/cygwin/miscfuncs.cc | 13 -------------
winsup/cygwin/mm/malloc_wrapper.cc | 17 +++++++++++++++++
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/winsup/cygwin/local_includes/miscfuncs.h b/winsup/cygwin/local_includes/miscfuncs.h
index 947b52c2c..706b7a62b 100644
--- a/winsup/cygwin/local_includes/miscfuncs.h
+++ b/winsup/cygwin/local_includes/miscfuncs.h
@@ -77,10 +77,6 @@ public:
extern "C" void yield ();
-#define caller_return_address() \
- __caller_return_address (__builtin_return_address (0))
-void * __caller_return_address (void *);
-
void backslashify (const char *, char *, bool);
void slashify (const char *, char *, bool);
#define isslash(c) ((c) == '/')
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 0af2e0217..6453fa047 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -315,19 +315,6 @@ NT_readline::gets ()
}
}
-/* 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
diff --git a/winsup/cygwin/mm/malloc_wrapper.cc b/winsup/cygwin/mm/malloc_wrapper.cc
index 5af39d361..8d12eb637 100644
--- a/winsup/cygwin/mm/malloc_wrapper.cc
+++ b/winsup/cygwin/mm/malloc_wrapper.cc
@@ -27,6 +27,23 @@ extern "C" struct mallinfo dlmallinfo ();
static bool use_internal = true;
static bool internal_malloc_determined;
+/* 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 ();
+
+static inline void *
+__caller_return_address (void *builtin_ret_addr)
+{
+ return builtin_ret_addr == &_sigbe
+ ? (void *) _my_tls.retaddr () : builtin_ret_addr;
+}
+
+#define caller_return_address() \
+ __caller_return_address (__builtin_return_address (0))
+void * __caller_return_address (void *);
+
/* Return an address from the import jmp table of main program. */
static inline void *
import_address (void *imp)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-10 16:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 16:13 [newlib-cygwin] Cygwin: move __caller_return_address to mm/malloc_wrapper.cc Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).