From: "Aaron W. LaFramboise" <aaronavay62@aaronwl.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: java-patches@gcc.gnu.org
Subject: Re: [PATCH] Don't reference main() in stacktrace.cc on MinGW
Date: Thu, 21 Aug 2008 13:04:00 -0000 [thread overview]
Message-ID: <48AD5C5F.4040304@aaronwl.com> (raw)
In-Reply-To: <48AD5C1D.8050604@aaronwl.com>
[-- 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;
}
prev parent reply other threads:[~2008-08-21 12:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-21 12:16 Aaron W. LaFramboise
2008-08-21 13:04 ` Aaron W. LaFramboise [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48AD5C5F.4040304@aaronwl.com \
--to=aaronavay62@aaronwl.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=java-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).