Patchwork Fix PR46037

login
register
mail settings
Submitter Jack Howarth
Date Jan. 12, 2011, 3:26 a.m.
Message ID <20110112032631.GA19061@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/78501/
State New
Headers show

Comments

Jack Howarth - Jan. 12, 2011, 3:26 a.m.
Honza,
    Doh! In http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46037#c16, we had
the conditional backwards. If I use...


...both the standard and lto-bootstrap complete. I'll regression test both
and submit a revised patch.
               Jack
Jack Howarth - Jan. 12, 2011, 3:42 a.m.
On Tue, Jan 11, 2011 at 10:26:31PM -0500, Jack Howarth wrote:
> Honza,
>     Doh! In http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46037#c16, we had
> the conditional backwards. If I use...
> 
> Index: gcc/config/darwin.c
> ===================================================================
> --- gcc/config/darwin.c	(revision 168683)
> +++ gcc/config/darwin.c	(working copy)
> @@ -2616,9 +2616,10 @@ darwin_override_options (void)
>      }
>  
>    if (flag_var_tracking
> -      && (generating_for_darwin_version >= 9)
> -      && debug_info_level >= DINFO_LEVEL_NORMAL
> -      && debug_hooks->var_location != do_nothing_debug_hooks.var_location)
> +      && generating_for_darwin_version >= 9
> +      && (flag_gtoggle ? (debug_info_level == DINFO_LEVEL_NONE)
> +      : (debug_info_level >= DINFO_LEVEL_NORMAL))
> +      && write_symbols == DWARF2_DEBUG)
>      flag_var_tracking_uninit = 1;
>  
>    if (MACHO_DYNAMIC_NO_PIC_P)
> 
> ...both the standard and lto-bootstrap complete. I'll regression test both
> and submit a revised patch.
>                Jack

Mike,
   FYI, this patch seems to work properly with -gtoggle...

[MacPro:~] howarth% ./dist/bin/gcc -g0 -gtoggle -O2 himenoBMTxpa.c
[MacPro:~] howarth% ls -l a.out
-rwxr-xr-x  1 howarth  howarth  19080 Jan 11 22:38 a.out

[MacPro:~] howarth% ./dist/bin/gcc -g0 -O2 himenoBMTxpa.c
[MacPro:~] howarth% ls -l a.out
-rwxr-xr-x  1 howarth  howarth  17960 Jan 11 22:39 a.out

but '-g0 -gtoggle' doesn't trigger a call to dsymutil to create a a.out.dSYM.
I'll file a PR for that later.
                Jack
Jan Hubicka - Jan. 12, 2011, 10:25 a.m.
> 
> Mike,
>    FYI, this patch seems to work properly with -gtoggle...
> 
> [MacPro:~] howarth% ./dist/bin/gcc -g0 -gtoggle -O2 himenoBMTxpa.c
> [MacPro:~] howarth% ls -l a.out
> -rwxr-xr-x  1 howarth  howarth  19080 Jan 11 22:38 a.out
> 
> [MacPro:~] howarth% ./dist/bin/gcc -g0 -O2 himenoBMTxpa.c
> [MacPro:~] howarth% ls -l a.out
> -rwxr-xr-x  1 howarth  howarth  17960 Jan 11 22:39 a.out
> 
> but '-g0 -gtoggle' doesn't trigger a call to dsymutil to create a a.out.dSYM.
> I'll file a PR for that later.
I think it will break also with compiling the lex.i testcase with LTO and -gtoggle.

I am quite convinced that we can't do that without modifing toplev.c.  
What would be the consequences of moving -gtoggle handling before option override?

Honza
Jack Howarth - Jan. 12, 2011, 1:52 p.m.
On Wed, Jan 12, 2011 at 11:25:16AM +0100, Jan Hubicka wrote:
> > 
> > Mike,
> >    FYI, this patch seems to work properly with -gtoggle...
> > 
> > [MacPro:~] howarth% ./dist/bin/gcc -g0 -gtoggle -O2 himenoBMTxpa.c
> > [MacPro:~] howarth% ls -l a.out
> > -rwxr-xr-x  1 howarth  howarth  19080 Jan 11 22:38 a.out
> > 
> > [MacPro:~] howarth% ./dist/bin/gcc -g0 -O2 himenoBMTxpa.c
> > [MacPro:~] howarth% ls -l a.out
> > -rwxr-xr-x  1 howarth  howarth  17960 Jan 11 22:39 a.out
> > 
> > but '-g0 -gtoggle' doesn't trigger a call to dsymutil to create a a.out.dSYM.
> > I'll file a PR for that later.
> I think it will break also with compiling the lex.i testcase with LTO and -gtoggle.
> 
> I am quite convinced that we can't do that without modifing toplev.c.  
> What would be the consequences of moving -gtoggle handling before option override?
> 
> Honza

Honza,
   I think you are misunderstanding me here. The revised patch I now propose to
apply is at http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00721.html and is exactly
that which you originally proposed (except you had the gtoggle conditiional on
the debug_info_level test backwards). I have done both a simple bootstrap and a lto-bootstrap
on x86_64-apple-darwin10 without regressions. Are you okay with this revised patch?
  The dsymutil issue I was referring to was from gcc/config/darwin9.h where we have...

/* Since DWARF2 is default, conditions for running dsymutil are different.  */
#undef DSYMUTIL_SPEC
#define DSYMUTIL_SPEC \
   "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
    %{v} \
    %{g*:%{!gstabs*:%{!g0: -idsym}}}\
    %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm|.s|.f|.f90|.f95|.f03|.f77|.for|.F|.F90|.F95|.F03: \
    %{g*:%{!gstabs*:%{!g0: -dsym}}}}}}}}}}}"

This code causes Xcode's dsymutil utility to be called on executables to create archived DWARF
debug symbol files from the DWARF debug information found in its object files. I discovered
that DSYMUTIL_SPEC currently doesn't handle the -gtoggle flag so that, while '-g0 -gtoggle'
properly creates DWARF debug information in the object files and the executable, dsymutil isn't
called on the executable to create the .dSYM directory.
             Jack

Patch

Index: gcc/config/darwin.c
===================================================================
--- gcc/config/darwin.c	(revision 168683)
+++ gcc/config/darwin.c	(working copy)
@@ -2616,9 +2616,10 @@  darwin_override_options (void)
     }
 
   if (flag_var_tracking
-      && (generating_for_darwin_version >= 9)
-      && debug_info_level >= DINFO_LEVEL_NORMAL
-      && debug_hooks->var_location != do_nothing_debug_hooks.var_location)
+      && generating_for_darwin_version >= 9
+      && (flag_gtoggle ? (debug_info_level == DINFO_LEVEL_NONE)
+      : (debug_info_level >= DINFO_LEVEL_NORMAL))
+      && write_symbols == DWARF2_DEBUG)
     flag_var_tracking_uninit = 1;
 
   if (MACHO_DYNAMIC_NO_PIC_P)