diff mbox series

don't enable DWARF5 by default on Windows (PR98860)

Message ID CAM43=SNVnPuGgKtyT4H2qQd-vx8kH7NJh-8FYyXdg2fYZ_syiQ@mail.gmail.com
State New
Headers show
Series don't enable DWARF5 by default on Windows (PR98860) | expand

Commit Message

Mikael Pettersson Feb. 8, 2021, 9:44 p.m. UTC
PR98860 is a gcc-11 regression where bootstrap fails on Windows since
the switch to enable DWARF5 by default. The symptoms are that
executables generated by the stage1 compiler fail to run with "Exec
format error", which confuses subsequent configure steps and causes
hard errors. This happens even with the very latest binutils master.

Fixed by updating SUBTARGET_OVERRIDE_OPTIONS to set dwarf_version to 4
unless the user explicitly requested another version. I see some other
targets did the same.

Tested on Cygwin64 and mingw-w64.

Ok for master?

2021-02-08  Mikael Pettersson  <mikpelinux@gmail.com>

        PR bootstrap/98860
        * config/i386/cygming.h (SUBTARGET_OVERRIDE_OPTIONS): Override
        dwarf_version to 4.

Comments

Richard Biener Feb. 9, 2021, 6:47 a.m. UTC | #1
On February 8, 2021 10:44:26 PM GMT+01:00, Mikael Pettersson via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>PR98860 is a gcc-11 regression where bootstrap fails on Windows since
>the switch to enable DWARF5 by default. The symptoms are that
>executables generated by the stage1 compiler fail to run with "Exec
>format error", which confuses subsequent configure steps and causes
>hard errors. This happens even with the very latest binutils master.
>
>Fixed by updating SUBTARGET_OVERRIDE_OPTIONS to set dwarf_version to 4
>unless the user explicitly requested another version. I see some other
>targets did the same.
>
>Tested on Cygwin64 and mingw-w64.
>
>Ok for master?

It might be better to expose the default via configure (I've heard desires to control that elsewhere). 

Richard. 

>2021-02-08  Mikael Pettersson  <mikpelinux@gmail.com>
>
>        PR bootstrap/98860
>        * config/i386/cygming.h (SUBTARGET_OVERRIDE_OPTIONS): Override
>        dwarf_version to 4.
>
>--- a/gcc/config/i386/cygming.h
>+++ b/gcc/config/i386/cygming.h
>@@ -209,6 +209,9 @@ along with GCC; see the file COPYING3.  If not see
>#define SUBTARGET_OVERRIDE_OPTIONS                                    
>\
>do {                                                                  
>\
>flag_pic = TARGET_64BIT ? 1 : 0;                                      \
>+  /* DWARF5 currently does not work on Windows. */                    
>\
>+  if (!global_options_set.x_dwarf_version)                            
>\
>+    dwarf_version = 4;                                                
>\
> } while (0)
>
> /* Define this macro if references to a symbol must be treated
Jakub Jelinek Feb. 9, 2021, 9:07 a.m. UTC | #2
On Tue, Feb 09, 2021 at 07:47:00AM +0100, Richard Biener via Gcc-patches wrote:
> On February 8, 2021 10:44:26 PM GMT+01:00, Mikael Pettersson via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> >PR98860 is a gcc-11 regression where bootstrap fails on Windows since
> >the switch to enable DWARF5 by default. The symptoms are that
> >executables generated by the stage1 compiler fail to run with "Exec
> >format error", which confuses subsequent configure steps and causes
> >hard errors. This happens even with the very latest binutils master.
> >
> >Fixed by updating SUBTARGET_OVERRIDE_OPTIONS to set dwarf_version to 4
> >unless the user explicitly requested another version. I see some other
> >targets did the same.
> >
> >Tested on Cygwin64 and mingw-w64.
> >
> >Ok for master?
> 
> It might be better to expose the default via configure (I've heard desires to control that elsewhere). 

But also it would be better to see some analysis what exactly and why
doesn't work.
What program emits that Exec format error message and why.

	Jakub
Jeff Law Feb. 15, 2021, 11:27 p.m. UTC | #3
On 2/9/21 2:07 AM, Jakub Jelinek via Gcc-patches wrote:
> On Tue, Feb 09, 2021 at 07:47:00AM +0100, Richard Biener via Gcc-patches wrote:
>> On February 8, 2021 10:44:26 PM GMT+01:00, Mikael Pettersson via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>>> PR98860 is a gcc-11 regression where bootstrap fails on Windows since
>>> the switch to enable DWARF5 by default. The symptoms are that
>>> executables generated by the stage1 compiler fail to run with "Exec
>>> format error", which confuses subsequent configure steps and causes
>>> hard errors. This happens even with the very latest binutils master.
>>>
>>> Fixed by updating SUBTARGET_OVERRIDE_OPTIONS to set dwarf_version to 4
>>> unless the user explicitly requested another version. I see some other
>>> targets did the same.
>>>
>>> Tested on Cygwin64 and mingw-w64.
>>>
>>> Ok for master?
>> It might be better to expose the default via configure (I've heard desires to control that elsewhere). 
> But also it would be better to see some analysis what exactly and why
> doesn't work.
> What program emits that Exec format error message and why.
Yea.  It seems quite odd that a change in debug format triggers an exec
format error.   I'd want to have a better understanding why before
acking this patch as well.

jeff
diff mbox series

Patch

From 9d1b9e26cc77d325fd5574cb422771588d6aa71f Mon Sep 17 00:00:00 2001
From: Mikael Pettersson <mikpelinux@gmail.com>
Date: Sat, 6 Feb 2021 22:59:43 +0100
Subject: [PATCH] cygming: DWARF5 does not work on Windows

---
 gcc/config/i386/cygming.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index cfbca34f996..071f83cfd2d 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -209,6 +209,9 @@  along with GCC; see the file COPYING3.  If not see
 #define SUBTARGET_OVERRIDE_OPTIONS					\
 do {									\
   flag_pic = TARGET_64BIT ? 1 : 0;                                      \
+  /* DWARF5 currently does not work on Windows. */			\
+  if (!global_options_set.x_dwarf_version)				\
+    dwarf_version = 4;							\
 } while (0)
 
 /* Define this macro if references to a symbol must be treated
-- 
2.26.2