* [PATCH] Don't reference main() in stacktrace.cc on MinGW
@ 2008-08-21 12:16 Aaron W. LaFramboise
2008-08-21 13:04 ` Aaron W. LaFramboise
0 siblings, 1 reply; 2+ messages in thread
From: Aaron W. LaFramboise @ 2008-08-21 12:16 UTC (permalink / raw)
To: gcc-patches; +Cc: java-patches
The generic i386 fall-back unwinder has logic to stop early at main().
However, on Windows, main() isn't always available, primarily when we're
in a shared library (DLL). Also, when libgcj is linked as a DLL (patch
coming soon), the 'main' symbol doesn't have the proper dynamic linkage
to get the one we want, so things won't work.
This patch fixes this issue by removing this stopping condition on Windows.
I tested this by building a static libjava on i386-pc-mingw32.
OK to commit?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Don't reference main() in stacktrace.cc on MinGW
2008-08-21 12:16 [PATCH] Don't reference main() in stacktrace.cc on MinGW Aaron W. LaFramboise
@ 2008-08-21 13:04 ` Aaron W. LaFramboise
0 siblings, 0 replies; 2+ messages in thread
From: Aaron W. LaFramboise @ 2008-08-21 13:04 UTC (permalink / raw)
To: gcc-patches; +Cc: java-patches
[-- Attachment #1: Type: text/plain, Size: 562 bytes --]
Aaron W. LaFramboise wrote:
> The generic i386 fall-back unwinder has logic to stop early at main().
> However, on Windows, main() isn't always available, primarily when we're
> in a shared library (DLL). Also, when libgcj is linked as a DLL (patch
> coming soon), the 'main' symbol doesn't have the proper dynamic linkage
> to get the one we want, so things won't work.
>
> This patch fixes this issue by removing this stopping condition on Windows.
>
> I tested this by building a static libjava on i386-pc-mingw32.
>
> OK to commit?
Patch attached.
[-- Attachment #2: gcc-4.4.0-20080821-stacktrace.patch --]
[-- Type: text/plain, Size: 1113 bytes --]
2008-08-21 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
* sysdep/i386/backtrace.h (DONT_REFERENCE_MAIN) [_WIN32]: New.
(fallback_backtrace) [DONT_REFERENCE_MAIN]: Don't generate references to main().
Index: sysdep/i386/backtrace.h
===================================================================
--- sysdep/i386/backtrace.h (revision 139186)
+++ sysdep/i386/backtrace.h (working copy)
@@ -13,7 +13,13 @@ details. */
#include <java-stack.h>
+#ifdef _WIN32
+#define DONT_REFERENCE_MAIN
+#endif
+
+#ifndef DONT_REFERENCE_MAIN
extern int main (int, char **);
+#endif
/* The context used to keep track of our position while unwinding through
the call stack. */
@@ -104,7 +110,10 @@ fallback_backtrace (_Unwind_Trace_Fn tra
const char **, bool))_Jv_RunMain;
if (ctx.meth_addr == (_Jv_uintptr_t)jv_runmain
|| ctx.meth_addr == (_Jv_uintptr_t)_Jv_ThreadStart
- || (ctx.meth_addr - (_Jv_uintptr_t)main) < 16)
+#ifndef DONT_REFERENCE_MAIN
+ || (ctx.meth_addr - (_Jv_uintptr_t)main) < 16
+#endif
+ )
break;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-21 12:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-21 12:16 [PATCH] Don't reference main() in stacktrace.cc on MinGW Aaron W. LaFramboise
2008-08-21 13:04 ` Aaron W. LaFramboise
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).