Commit 1c70261c by Jakub Jelinek Committed by Jakub Jelinek

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
parent a60c3351
2017-01-16 Jakub Jelinek <jakub@redhat.com>
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 <ubizjak@gmail.com> 2017-01-16 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.h (HARD_REGNO_CALLER_SAVE_MODE): Apply HImode and * config/i386/i386.h (HARD_REGNO_CALLER_SAVE_MODE): Apply HImode and
......
2017-01-16 Jakub Jelinek <jakub@redhat.com>
PR driver/49726
* gcc-interface/lang.opt (gant, gnatO, gnat): Add Driver flag.
2017-01-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2017-01-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc-interface/Makefile.in (SPARC/Solaris): Fix typo. * gcc-interface/Makefile.in (SPARC/Solaris): Fix typo.
......
...@@ -81,15 +81,15 @@ Ada AdaWhy AdaSCIL ...@@ -81,15 +81,15 @@ Ada AdaWhy AdaSCIL
Make \"char\" signed by default. Make \"char\" signed by default.
gant gant
Ada AdaWhy AdaSCIL Joined Undocumented Ada AdaWhy AdaSCIL Driver Joined Undocumented
Catch typos. Catch typos.
gnatO gnatO
Ada AdaWhy AdaSCIL Separate Ada AdaWhy AdaSCIL Driver Separate
Set name of output ALI file (internal switch). Set name of output ALI file (internal switch).
gnat gnat
Ada AdaWhy AdaSCIL Joined Ada AdaWhy AdaSCIL Driver Joined
-gnat<options> Specify options to GNAT. -gnat<options> Specify options to GNAT.
fbuiltin-printf fbuiltin-printf
......
2017-01-16 Jakub Jelinek <jakub@redhat.com>
PR driver/49726
* c.opt (gen-decls): Add Driver flag.
2017-01-16 Paolo Carlini <paolo.carlini@oracle.com> 2017-01-16 Paolo Carlini <paolo.carlini@oracle.com>
Revert: Revert:
......
...@@ -1762,7 +1762,7 @@ ObjC ObjC++ Var(flag_zero_link) ...@@ -1762,7 +1762,7 @@ ObjC ObjC++ Var(flag_zero_link)
Generate lazy class lookup (via objc_getClass()) for use in Zero-Link mode. Generate lazy class lookup (via objc_getClass()) for use in Zero-Link mode.
gen-decls gen-decls
ObjC ObjC++ Var(flag_gen_declaration) ObjC ObjC++ Driver Var(flag_gen_declaration)
Dump declarations to a .decl file. Dump declarations to a .decl file.
femit-struct-debug-baseonly femit-struct-debug-baseonly
......
...@@ -2795,43 +2795,43 @@ Common Report Var(flag_zero_initialized_in_bss) Init(1) ...@@ -2795,43 +2795,43 @@ Common Report Var(flag_zero_initialized_in_bss) Init(1)
Put zero initialized data in the bss section. Put zero initialized data in the bss section.
g g
Common JoinedOrMissing Common Driver JoinedOrMissing
Generate debug information in default format. Generate debug information in default format.
gcoff gcoff
Common JoinedOrMissing Negative(gdwarf) Common Driver JoinedOrMissing Negative(gdwarf)
Generate debug information in COFF format. Generate debug information in COFF format.
gdwarf gdwarf
Common JoinedOrMissing Negative(gdwarf-) Common Driver JoinedOrMissing Negative(gdwarf-)
Generate debug information in default version of DWARF format. Generate debug information in default version of DWARF format.
gdwarf- 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. Generate debug information in DWARF v2 (or later) format.
ggdb ggdb
Common JoinedOrMissing Common Driver JoinedOrMissing
Generate debug information in default extended format. Generate debug information in default extended format.
gno-pubnames 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. Don't generate DWARF pubnames and pubtypes sections.
gpubnames 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. Generate DWARF pubnames and pubtypes sections.
ggnu-pubnames 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. Generate DWARF pubnames and pubtypes sections with GNU extensions.
gno-record-gcc-switches 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. Don't record gcc command line switches in DWARF DW_AT_producer.
grecord-gcc-switches 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. Record gcc command line switches in DWARF DW_AT_producer.
gno-split-dwarf gno-split-dwarf
...@@ -2843,35 +2843,35 @@ Common Driver RejectNegative Var(dwarf_split_debug_info,1) ...@@ -2843,35 +2843,35 @@ Common Driver RejectNegative Var(dwarf_split_debug_info,1)
Generate debug information in separate .dwo files. Generate debug information in separate .dwo files.
gstabs gstabs
Common JoinedOrMissing Negative(gstabs+) Common Driver JoinedOrMissing Negative(gstabs+)
Generate debug information in STABS format. Generate debug information in STABS format.
gstabs+ gstabs+
Common JoinedOrMissing Negative(gvms) Common Driver JoinedOrMissing Negative(gvms)
Generate debug information in extended STABS format. Generate debug information in extended STABS format.
gno-strict-dwarf 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. Emit DWARF additions beyond selected version.
gstrict-dwarf 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. Don't emit DWARF additions beyond selected version.
gtoggle gtoggle
Common Report Var(flag_gtoggle) Common Driver Report Var(flag_gtoggle)
Toggle debug information generation. Toggle debug information generation.
gvms gvms
Common JoinedOrMissing Negative(gxcoff) Common Driver JoinedOrMissing Negative(gxcoff)
Generate debug information in VMS format. Generate debug information in VMS format.
gxcoff gxcoff
Common JoinedOrMissing Negative(gxcoff+) Common Driver JoinedOrMissing Negative(gxcoff+)
Generate debug information in XCOFF format. Generate debug information in XCOFF format.
gxcoff+ gxcoff+
Common JoinedOrMissing Negative(gcoff) Common Driver JoinedOrMissing Negative(gcoff)
Generate debug information in extended XCOFF format. Generate debug information in extended XCOFF format.
Enum Enum
......
...@@ -202,9 +202,9 @@ extern GTY(()) int darwin_ms_struct; ...@@ -202,9 +202,9 @@ extern GTY(()) int darwin_ms_struct;
#define DSYMUTIL_SPEC \ #define DSYMUTIL_SPEC \
"%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%{v} \ %{v} \
%{gdwarf-2:%{!gstabs*:%{!g0: -idsym}}}\ %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -idsym}}}\
%{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: \ %{.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 #define LINK_COMMAND_SPEC LINK_COMMAND_SPEC_A DSYMUTIL_SPEC
...@@ -424,7 +424,7 @@ extern GTY(()) int darwin_ms_struct; ...@@ -424,7 +424,7 @@ extern GTY(()) int darwin_ms_struct;
/* Default ASM_DEBUG_SPEC. Darwin's as cannot currently produce dwarf /* Default ASM_DEBUG_SPEC. Darwin's as cannot currently produce dwarf
debugging data. */ 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. */ /* We still allow output of STABS if the assembler supports it. */
#ifdef HAVE_AS_STABS_DIRECTIVE #ifdef HAVE_AS_STABS_DIRECTIVE
......
...@@ -28,9 +28,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -28,9 +28,9 @@ along with GCC; see the file COPYING3. If not see
#define DSYMUTIL_SPEC \ #define DSYMUTIL_SPEC \
"%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%{v} \ %{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: \ %{.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. */ /* Tell collect2 to run dsymutil for us as necessary. */
#define COLLECT_RUN_DSYMUTIL 1 #define COLLECT_RUN_DSYMUTIL 1
...@@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see
yet generate dwarf.) */ yet generate dwarf.) */
#undef ASM_DEBUG_SPEC #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 #undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
......
...@@ -402,6 +402,7 @@ static const char *compare_debug_auxbase_opt_spec_function (int, const char **); ...@@ -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 *pass_through_libs_spec_func (int, const char **);
static const char *replace_extension_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 *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 *); static char *convert_white_space (char *);
/* The Specs Language /* The Specs Language
...@@ -833,14 +834,16 @@ proper position among the other output files. */ ...@@ -833,14 +834,16 @@ proper position among the other output files. */
&& defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG)
# define ASM_DEBUG_SPEC \ # define ASM_DEBUG_SPEC \
(PREFERRED_DEBUGGING_TYPE == DBX_DEBUG \ (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG \
? "%{!g0:%{gdwarf*:--gdwarf2}%{!gdwarf*:%{g*:--gstabs}}}" ASM_MAP \ ? "%{%:debug-level-gt(0):" \
: "%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}" ASM_MAP) "%{gdwarf*:--gdwarf2}%{!gdwarf*:%{g*:--gstabs}}}" ASM_MAP \
: "%{%:debug-level-gt(0):" \
"%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}" ASM_MAP)
# else # else
# if defined(DBX_DEBUGGING_INFO) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) # 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 # endif
# if defined(DWARF2_DEBUGGING_INFO) && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) # 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 # endif
#endif #endif
...@@ -1119,7 +1122,8 @@ static const char *cpp_unique_options = ...@@ -1119,7 +1122,8 @@ static const char *cpp_unique_options =
in turn cause preprocessor symbols to be defined specially. */ in turn cause preprocessor symbols to be defined specially. */
static const char *cpp_options = static const char *cpp_options =
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ "%(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}"; %{undef} %{save-temps*:-fpch-preprocess}";
/* This contains cpp options which are not passed when the preprocessor /* This contains cpp options which are not passed when the preprocessor
...@@ -1639,6 +1643,7 @@ static const struct spec_function static_spec_functions[] = ...@@ -1639,6 +1643,7 @@ static const struct spec_function static_spec_functions[] =
{ "pass-through-libs", pass_through_libs_spec_func }, { "pass-through-libs", pass_through_libs_spec_func },
{ "replace-extension", replace_extension_spec_func }, { "replace-extension", replace_extension_spec_func },
{ "gt", greater_than_spec_func }, { "gt", greater_than_spec_func },
{ "debug-level-gt", debug_level_greater_than_spec_func },
#ifdef EXTRA_SPEC_FUNCTIONS #ifdef EXTRA_SPEC_FUNCTIONS
EXTRA_SPEC_FUNCTIONS EXTRA_SPEC_FUNCTIONS
#endif #endif
...@@ -9863,6 +9868,27 @@ greater_than_spec_func (int argc, const char **argv) ...@@ -9863,6 +9868,27 @@ greater_than_spec_func (int argc, const char **argv)
return NULL; 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 /* Insert backslash before spaces in ORIG (usually a file path), to
avoid being broken by spec parser. avoid being broken by spec parser.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment