* [patch] Fix PR target/67172
@ 2016-04-04 7:41 Eric Botcazou
2016-04-04 14:11 ` Bernd Schmidt
0 siblings, 1 reply; 3+ messages in thread
From: Eric Botcazou @ 2016-04-04 7:41 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 2046 bytes --]
Hi,
this is the bootstrap failure on MinGW configured w/ --disable-sjlj-exceptions
--with-dwarf2, a regression present on the mainline and 5 branch. The problem
is the undefined symbol __EH_FRAME_BEGIN__ coming from libgcc2.c, which
prevents libgcc_s.dll from being linked.
The audit trail of the PR is quite confused: __LIBGCC_EH_FRAME_SECTION_NAME__
needs to be (and is correctly) defined during the libgcc build because DWARF2
exceptions are used. The problem is that libgcc2.c expects the usual non-ELF
setup, with __EH_FRAME_BEGIN__ defined in crtstuff.c. Now t-cygwin has:
CUSTOM_CRTSTUFF = yes
crtbegin.o: $(srcdir)/config/i386/cygming-crtbegin.c
$(crt_compile) -fno-omit-frame-pointer -c $<
crtbeginS.o: $(srcdir)/config/i386/cygming-crtbegin.c
$(crt_compile) -fno-omit-frame-pointer -c $< -DCRTSTUFFS_O
# We intentionally use a implementation-reserved init priority of 0,
# so allow the warning.
crtend.o: $(srcdir)/config/i386/cygming-crtend.c
$(crt_compile) -fno-omit-frame-pointer -Wno-error -c $<
That is to say, crtstuff.c is not compiled and instead __EH_FRAME_BEGIN__ is
private to cygming-crtbegin.c:
/* Stick a label at the beginning of the frame unwind info so we can
register/deregister it with the exception handling library code. */
#if DWARF2_UNWIND_INFO
static EH_FRAME_SECTION_CONST char __EH_FRAME_BEGIN__[]
__attribute__((used, section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4)))
= { };
with the registration/deregistration machinery in the same file. Therefore
the equivalent code in libgcc2.c simply needs to be skipped.
This code is already entirely skipped for Cygwin because of:
#ifndef __CYGWIN__
so the attached patch adds a similar test on MinGW for the problematic code.
Tested on x86/Windows configured with --disable-sjlj-exceptions --with-dwarf2,
OK for the mainline and 5 branch?
2016-04-04 Eric Botcazou <ebotcazou@adacore.com>
PR target/67172
* libgcc2.c (L__main): Undefine __LIBGCC_EH_FRAME_SECTION_NAME__ if
__MINGW32__ is defined.
--
Eric Botcazou
[-- Attachment #2: pr67172.diff --]
[-- Type: text/x-patch, Size: 715 bytes --]
Index: libgcc2.c
===================================================================
--- libgcc2.c (revision 234695)
+++ libgcc2.c (working copy)
@@ -2209,7 +2209,12 @@ TRANSFER_FROM_TRAMPOLINE
#if !defined (HAS_INIT_SECTION) || !defined (OBJECT_FORMAT_ELF)
/* Some ELF crosses use crtstuff.c to provide __CTOR_LIST__, but use this
- code to run constructors. In that case, we need to handle EH here, too. */
+ code to run constructors. In that case, we need to handle EH here, too.
+ But MINGW32 is special because it handles CRTSTUFF and EH on its own. */
+
+#ifdef __MINGW32__
+#undef __LIBGCC_EH_FRAME_SECTION_NAME__
+#endif
#ifdef __LIBGCC_EH_FRAME_SECTION_NAME__
#include "unwind-dw2-fde.h"
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Fix PR target/67172
2016-04-04 7:41 [patch] Fix PR target/67172 Eric Botcazou
@ 2016-04-04 14:11 ` Bernd Schmidt
2016-04-04 22:23 ` Eric Botcazou
0 siblings, 1 reply; 3+ messages in thread
From: Bernd Schmidt @ 2016-04-04 14:11 UTC (permalink / raw)
To: Eric Botcazou, gcc-patches
On 04/04/2016 09:39 AM, Eric Botcazou wrote:
> The audit trail of the PR is quite confused: __LIBGCC_EH_FRAME_SECTION_NAME__
> needs to be (and is correctly) defined during the libgcc build because DWARF2
> exceptions are used. The problem is that libgcc2.c expects the usual non-ELF
> setup, with __EH_FRAME_BEGIN__ defined in crtstuff.c. Now t-cygwin has:
That's t-cygming, not t-cygwin, right?
> This code is already entirely skipped for Cygwin because of:
>
> #ifndef __CYGWIN__
>
> so the attached patch adds a similar test on MinGW for the problematic code.
>
> Tested on x86/Windows configured with --disable-sjlj-exceptions --with-dwarf2,
> OK for the mainline and 5 branch?
It looks plausible. One could argue that gcc shouldn't define
__LIBGCC_EH_FRAME_SECTION_NAME__ in this case, but since it's used in
cygming-crtbegin.c, that seems to gain relatively little.
So, I think this is ok.
Bernd
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Fix PR target/67172
2016-04-04 14:11 ` Bernd Schmidt
@ 2016-04-04 22:23 ` Eric Botcazou
0 siblings, 0 replies; 3+ messages in thread
From: Eric Botcazou @ 2016-04-04 22:23 UTC (permalink / raw)
To: Bernd Schmidt; +Cc: gcc-patches
> That's t-cygming, not t-cygwin, right?
Right, sorry about that.
> So, I think this is ok.
Thanks!
--
Eric Botcazou
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-04 22:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-04 7:41 [patch] Fix PR target/67172 Eric Botcazou
2016-04-04 14:11 ` Bernd Schmidt
2016-04-04 22:23 ` Eric Botcazou
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).