we have a case where gcc is used as preprocessor/assembler combination (i.e. for an .S file), and -g0 is explicitely passed to make it not generate any debug information. Unfortunately in that situation gcc (the driver) still passes --gdwarf2 to GNU as, which was explicitely requested not to happen. This patch deactivates this if -g0 is seen in the command line in the same ways its already deactivated for *cpp_option. Bootstraping on x86 works, regtesting in progress. Okay if it passes? Ciao, Michael. * gcc.c (ASM_DEBUG_SPEC): Test -g0. Index: gcc/gcc.c =================================================================== --- gcc/gcc.c.orig 2009-11-20 13:50:34.000000000 +0100 +++ gcc/gcc.c 2009-11-20 13:50:39.000000000 +0100 @@ -670,14 +670,14 @@ proper position among the other output f && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) # define ASM_DEBUG_SPEC \ (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG \ - ? "%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}" ASM_MAP \ - : "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}" ASM_MAP) + ? "%{!g0:%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}}" ASM_MAP \ + : "%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}" ASM_MAP) # else # if defined(DBX_DEBUGGING_INFO) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) -# define ASM_DEBUG_SPEC "%{g*:--gstabs}" ASM_MAP +# define ASM_DEBUG_SPEC "%{g*:%{!g0:--gstabs}}" ASM_MAP # endif # if defined(DWARF2_DEBUGGING_INFO) && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) -# define ASM_DEBUG_SPEC "%{g*:--gdwarf2}" ASM_MAP +# define ASM_DEBUG_SPEC "%{g*:%{!g0:--gdwarf2}}" ASM_MAP # endif # endif #endif