From: Jakub Jelinek Date: Mon, 16 Jan 2017 21:33:07 +0000 (+0100) Subject: re PR driver/49726 (-g0 file.S -g does not produce debug info) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c70261c9a4d7faedfb03a79753b9acf81195561;p=gcc.git re PR driver/49726 (-g0 file.S -g does not produce debug info) PR driver/49726 * gcc.c (debug_level_greater_than_spec_func): New function. (static_spec_functions): Add debug-level-gt spec function. (ASM_DEBUG_SPEC, cpp_options): Use %:debug-level-gt(0) instead of !g0. * config/darwin.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise. * config/darwin9.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise. * common.opt (g, gcoff, gdwarf, gdwarf-, ggdb, gno-pubnames, gpubnames, ggnu-pubnames, gno-record-gcc-switches, grecord-gcc-switches, gno-strict-dwarf, gstrict-dwarf, gstabs, gstabs+, gtoggle, gvms, gxcoff, gxcoff+): Add Driver flag. c-family/ * c.opt (gen-decls): Add Driver flag. ada/ * gcc-interface/lang.opt (gant, gnatO, gnat): Add Driver flag. From-SVN: r244505 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3cbda6afe8..a69094cb506 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2017-01-16 Jakub Jelinek + + PR driver/49726 + * gcc.c (debug_level_greater_than_spec_func): New function. + (static_spec_functions): Add debug-level-gt spec function. + (ASM_DEBUG_SPEC, cpp_options): Use %:debug-level-gt(0) instead of + !g0. + * config/darwin.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise. + * config/darwin9.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise. + * common.opt (g, gcoff, gdwarf, gdwarf-, ggdb, gno-pubnames, + gpubnames, ggnu-pubnames, gno-record-gcc-switches, + grecord-gcc-switches, gno-strict-dwarf, gstrict-dwarf, gstabs, + gstabs+, gtoggle, gvms, gxcoff, gxcoff+): Add Driver flag. + 2017-01-16 Uros Bizjak * config/i386/i386.h (HARD_REGNO_CALLER_SAVE_MODE): Apply HImode and diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e5a684699a9..5b224435335 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2017-01-16 Jakub Jelinek + + PR driver/49726 + * gcc-interface/lang.opt (gant, gnatO, gnat): Add Driver flag. + 2017-01-13 Rainer Orth * gcc-interface/Makefile.in (SPARC/Solaris): Fix typo. diff --git a/gcc/ada/gcc-interface/lang.opt b/gcc/ada/gcc-interface/lang.opt index ccae6fa3619..241eafc90ad 100644 --- a/gcc/ada/gcc-interface/lang.opt +++ b/gcc/ada/gcc-interface/lang.opt @@ -81,15 +81,15 @@ Ada AdaWhy AdaSCIL Make \"char\" signed by default. gant -Ada AdaWhy AdaSCIL Joined Undocumented +Ada AdaWhy AdaSCIL Driver Joined Undocumented Catch typos. gnatO -Ada AdaWhy AdaSCIL Separate +Ada AdaWhy AdaSCIL Driver Separate Set name of output ALI file (internal switch). gnat -Ada AdaWhy AdaSCIL Joined +Ada AdaWhy AdaSCIL Driver Joined -gnat Specify options to GNAT. fbuiltin-printf diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index de958748882..6138f5276e1 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2017-01-16 Jakub Jelinek + + PR driver/49726 + * c.opt (gen-decls): Add Driver flag. + 2017-01-16 Paolo Carlini Revert: diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 33caeb2cded..3bb42f6d913 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1762,7 +1762,7 @@ ObjC ObjC++ Var(flag_zero_link) Generate lazy class lookup (via objc_getClass()) for use in Zero-Link mode. gen-decls -ObjC ObjC++ Var(flag_gen_declaration) +ObjC ObjC++ Driver Var(flag_gen_declaration) Dump declarations to a .decl file. femit-struct-debug-baseonly diff --git a/gcc/common.opt b/gcc/common.opt index 8ad5b77fe06..693b743f5d5 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2795,43 +2795,43 @@ Common Report Var(flag_zero_initialized_in_bss) Init(1) Put zero initialized data in the bss section. g -Common JoinedOrMissing +Common Driver JoinedOrMissing Generate debug information in default format. gcoff -Common JoinedOrMissing Negative(gdwarf) +Common Driver JoinedOrMissing Negative(gdwarf) Generate debug information in COFF format. gdwarf -Common JoinedOrMissing Negative(gdwarf-) +Common Driver JoinedOrMissing Negative(gdwarf-) Generate debug information in default version of DWARF format. gdwarf- -Common Joined UInteger Var(dwarf_version) Init(4) Negative(gstabs) +Common Driver Joined UInteger Var(dwarf_version) Init(4) Negative(gstabs) Generate debug information in DWARF v2 (or later) format. ggdb -Common JoinedOrMissing +Common Driver JoinedOrMissing Generate debug information in default extended format. gno-pubnames -Common Negative(gpubnames) Var(debug_generate_pub_sections, 0) Init(-1) +Common Driver Negative(gpubnames) Var(debug_generate_pub_sections, 0) Init(-1) Don't generate DWARF pubnames and pubtypes sections. gpubnames -Common Negative(ggnu-pubnames) Var(debug_generate_pub_sections, 1) +Common Driver Negative(ggnu-pubnames) Var(debug_generate_pub_sections, 1) Generate DWARF pubnames and pubtypes sections. ggnu-pubnames -Common Negative(gno-pubnames) Var(debug_generate_pub_sections, 2) +Common Driver Negative(gno-pubnames) Var(debug_generate_pub_sections, 2) Generate DWARF pubnames and pubtypes sections with GNU extensions. gno-record-gcc-switches -Common RejectNegative Var(dwarf_record_gcc_switches,0) Init(1) +Common Driver RejectNegative Var(dwarf_record_gcc_switches,0) Init(1) Don't record gcc command line switches in DWARF DW_AT_producer. grecord-gcc-switches -Common RejectNegative Var(dwarf_record_gcc_switches,1) +Common Driver RejectNegative Var(dwarf_record_gcc_switches,1) Record gcc command line switches in DWARF DW_AT_producer. gno-split-dwarf @@ -2843,35 +2843,35 @@ Common Driver RejectNegative Var(dwarf_split_debug_info,1) Generate debug information in separate .dwo files. gstabs -Common JoinedOrMissing Negative(gstabs+) +Common Driver JoinedOrMissing Negative(gstabs+) Generate debug information in STABS format. gstabs+ -Common JoinedOrMissing Negative(gvms) +Common Driver JoinedOrMissing Negative(gvms) Generate debug information in extended STABS format. gno-strict-dwarf -Common RejectNegative Var(dwarf_strict,0) Init(0) +Common Driver RejectNegative Var(dwarf_strict,0) Init(0) Emit DWARF additions beyond selected version. gstrict-dwarf -Common Report RejectNegative Var(dwarf_strict,1) +Common Driver Report RejectNegative Var(dwarf_strict,1) Don't emit DWARF additions beyond selected version. gtoggle -Common Report Var(flag_gtoggle) +Common Driver Report Var(flag_gtoggle) Toggle debug information generation. gvms -Common JoinedOrMissing Negative(gxcoff) +Common Driver JoinedOrMissing Negative(gxcoff) Generate debug information in VMS format. gxcoff -Common JoinedOrMissing Negative(gxcoff+) +Common Driver JoinedOrMissing Negative(gxcoff+) Generate debug information in XCOFF format. gxcoff+ -Common JoinedOrMissing Negative(gcoff) +Common Driver JoinedOrMissing Negative(gcoff) Generate debug information in extended XCOFF format. Enum diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 3a130291a38..a8397cd2331 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -202,9 +202,9 @@ extern GTY(()) int darwin_ms_struct; #define DSYMUTIL_SPEC \ "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %{v} \ - %{gdwarf-2:%{!gstabs*:%{!g0: -idsym}}}\ + %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -idsym}}}\ %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: \ - %{gdwarf-2:%{!gstabs*:%{!g0: -dsym}}}}}}}}}}}" + %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}" #define LINK_COMMAND_SPEC LINK_COMMAND_SPEC_A DSYMUTIL_SPEC @@ -424,7 +424,7 @@ extern GTY(()) int darwin_ms_struct; /* Default ASM_DEBUG_SPEC. Darwin's as cannot currently produce dwarf debugging data. */ -#define ASM_DEBUG_SPEC "%{g*:%{!g0:%{!gdwarf*:--gstabs}}}" +#define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):%{!gdwarf*:--gstabs}}}" /* We still allow output of STABS if the assembler supports it. */ #ifdef HAVE_AS_STABS_DIRECTIVE diff --git a/gcc/config/darwin9.h b/gcc/config/darwin9.h index 55b342b1d27..7e9165823b7 100644 --- a/gcc/config/darwin9.h +++ b/gcc/config/darwin9.h @@ -28,9 +28,9 @@ along with GCC; see the file COPYING3. If not see #define DSYMUTIL_SPEC \ "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %{v} \ - %{g*:%{!gstabs*:%{!g0: -idsym}}}\ + %{g*:%{!gstabs*:%{%:debug-level-gt(0): -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}}}}}}}}}}}" + %{g*:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}" /* Tell collect2 to run dsymutil for us as necessary. */ #define COLLECT_RUN_DSYMUTIL 1 @@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see yet generate dwarf.) */ #undef ASM_DEBUG_SPEC -#define ASM_DEBUG_SPEC "%{g*:%{!g0:%{gstabs:--gstabs}}}" +#define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):%{gstabs:--gstabs}}}" #undef ASM_OUTPUT_ALIGNED_COMMON #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ diff --git a/gcc/gcc.c b/gcc/gcc.c index 1c5e42802c5..0ed7da94f17 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -402,6 +402,7 @@ static const char *compare_debug_auxbase_opt_spec_function (int, const char **); static const char *pass_through_libs_spec_func (int, const char **); static const char *replace_extension_spec_func (int, const char **); static const char *greater_than_spec_func (int, const char **); +static const char *debug_level_greater_than_spec_func (int, const char **); static char *convert_white_space (char *); /* The Specs Language @@ -833,14 +834,16 @@ proper position among the other output files. */ && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) # define ASM_DEBUG_SPEC \ (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG \ - ? "%{!g0:%{gdwarf*:--gdwarf2}%{!gdwarf*:%{g*:--gstabs}}}" ASM_MAP \ - : "%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}" ASM_MAP) + ? "%{%:debug-level-gt(0):" \ + "%{gdwarf*:--gdwarf2}%{!gdwarf*:%{g*:--gstabs}}}" ASM_MAP \ + : "%{%:debug-level-gt(0):" \ + "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}" ASM_MAP) # else # if defined(DBX_DEBUGGING_INFO) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) -# define ASM_DEBUG_SPEC "%{g*:%{!g0:--gstabs}}" ASM_MAP +# define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):--gstabs}}" ASM_MAP # endif # if defined(DWARF2_DEBUGGING_INFO) && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) -# define ASM_DEBUG_SPEC "%{g*:%{!g0:--gdwarf2}}" ASM_MAP +# define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):--gdwarf2}}" ASM_MAP # endif # endif #endif @@ -1119,7 +1122,8 @@ static const char *cpp_unique_options = in turn cause preprocessor symbols to be defined specially. */ static const char *cpp_options = "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ - %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\ + %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\ + %{!fno-working-directory:-fworking-directory}}} %{O*}\ %{undef} %{save-temps*:-fpch-preprocess}"; /* This contains cpp options which are not passed when the preprocessor @@ -1639,6 +1643,7 @@ static const struct spec_function static_spec_functions[] = { "pass-through-libs", pass_through_libs_spec_func }, { "replace-extension", replace_extension_spec_func }, { "gt", greater_than_spec_func }, + { "debug-level-gt", debug_level_greater_than_spec_func }, #ifdef EXTRA_SPEC_FUNCTIONS EXTRA_SPEC_FUNCTIONS #endif @@ -9863,6 +9868,27 @@ greater_than_spec_func (int argc, const char **argv) return NULL; } +/* Returns "" if debug_info_level is greater than ARGV[ARGC-1]. + Otherwise, return NULL. */ + +static const char * +debug_level_greater_than_spec_func (int argc, const char **argv) +{ + char *converted; + + if (argc != 1) + fatal_error (input_location, + "wrong number of arguments to %%:debug-level-gt"); + + long arg = strtol (argv[0], &converted, 10); + gcc_assert (converted != argv[0]); + + if (debug_info_level > arg) + return ""; + + return NULL; +} + /* Insert backslash before spaces in ORIG (usually a file path), to avoid being broken by spec parser.