Re: [PATCH,V3 2/2] dwarf: new dwarf_debuginfo_p predicate
On 5/20/21 2:40 AM, Richard Biener wrote: On Thu, May 13, 2021 at 12:52 AM Indu Bhagat via Gcc-patches wrote: [Changes from V2] - Tested build (make all-gcc) of cross compiler for target triplets containing c6x/mips/powerpc and darwin/cygwin. [End of changes from V2] This patch introduces a dwarf_debuginfo_p predicate that abstracts and replaces complex checks on write_symbols. OK. Thanks, Richard. Committed. Thanks, Indu gcc/c-family/ChangeLog: * c-lex.c (init_c_lex): Use dwarf_debuginfo_p. gcc/ChangeLog: * config/c6x/c6x.c (c6x_output_file_unwind): Use dwarf_debuginfo_p. * config/darwin.c (darwin_override_options): Likewise. * config/i386/cygming.h (DBX_REGISTER_NUMBER): Likewise. * config/i386/darwin.h (DBX_REGISTER_NUMBER): Likewise. (DWARF2_FRAME_REG_OUT): Likewise. * config/mips/mips.c (mips_output_filename): Likewise. * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): Likewise. (rs6000_dbx_register_number): Likewise. * dbxout.c: Include flags.h. * dwarf2cfi.c (cfi_label_required_p): Likewise. (dwarf2out_do_frame): Likewise. * except.c: Include flags.h. * final.c (dwarf2_debug_info_emitted_p): Likewise. (final_scan_insn_1): Likewise. * flags.h (dwarf_debuginfo_p): New function declaration. * opts.c (dwarf_debuginfo_p): New function definition. * targhooks.c (default_debug_unwind_info): Use dwarf_debuginfo_p. * toplev.c (process_options): Likewise. --- gcc/c-family/c-lex.c | 4 ++-- gcc/config/c6x/c6x.c | 4 ++-- gcc/config/darwin.c| 3 ++- gcc/config/i386/cygming.h | 2 +- gcc/config/i386/darwin.h | 4 ++-- gcc/config/mips/mips.c | 3 ++- gcc/config/rs6000/rs6000.c | 4 ++-- gcc/dbxout.c | 1 + gcc/dwarf2cfi.c| 9 - gcc/except.c | 1 + gcc/final.c| 15 ++- gcc/flags.h| 4 gcc/opts.c | 8 gcc/targhooks.c| 2 +- gcc/toplev.c | 6 ++ 15 files changed, 40 insertions(+), 30 deletions(-) diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 1c66ecd..c44e7a1 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "stor-layout.h" #include "c-pragma.h" #include "debug.h" +#include "flags.h" #include "file-prefix-map.h" /* remap_macro_filename() */ #include "langhooks.h" #include "attribs.h" @@ -87,8 +88,7 @@ init_c_lex (void) /* Set the debug callbacks if we can use them. */ if ((debug_info_level == DINFO_LEVEL_VERBOSE - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG)) + && dwarf_debuginfo_p ()) || flag_dump_go_spec != NULL) { cb->define = cb_define; diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index f9ad1e5..e2011f0 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -59,6 +59,7 @@ #include "regrename.h" #include "dumpfile.h" #include "builtins.h" +#include "flags.h" /* This file should be included last. */ #include "target-def.h" @@ -439,8 +440,7 @@ c6x_output_file_unwind (FILE * f) { if (flag_unwind_tables || flag_exceptions) { - if (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) asm_fprintf (f, "\t.cfi_sections .debug_frame, .c6xabi.exidx\n"); else asm_fprintf (f, "\t.cfi_sections .c6xabi.exidx\n"); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 5d17391..026c1fb 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "lto-section-names.h" #include "intl.h" #include "optabs.h" +#include "flags.h" /* Fix and Continue. @@ -3348,7 +3349,7 @@ darwin_override_options (void) && generating_for_darwin_version >= 9 && (flag_gtoggle ? (debug_info_level == DINFO_LEVEL_NONE) : (debug_info_level >= DINFO_LEVEL_NORMAL)) - && write_symbols == DWARF2_DEBUG) + && dwarf_debuginfo_p ()) flag_var_tracking_uninit = flag_var_tracking; /* Final check on PCI options; for Darwin these are not dependent on the PIE diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index cfbca34..ac458cd 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see #undef DBX_REGISTER_NUMBER #define DBX_REGISTER_NUMBER(n) \ (TARGET_64BIT ? dbx64_register_map[n]\ - : (write_symbols == DWARF2_DEBUG\ + : (dwarf_debuginfo_p ()
Re: [PATCH,V3 2/2] dwarf: new dwarf_debuginfo_p predicate
On Thu, May 13, 2021 at 12:52 AM Indu Bhagat via Gcc-patches wrote: > > [Changes from V2] > - Tested build (make all-gcc) of cross compiler for target triplets > containing c6x/mips/powerpc and darwin/cygwin. > [End of changes from V2] > > This patch introduces a dwarf_debuginfo_p predicate that abstracts and > replaces complex checks on write_symbols. OK. Thanks, Richard. > gcc/c-family/ChangeLog: > > * c-lex.c (init_c_lex): Use dwarf_debuginfo_p. > > gcc/ChangeLog: > > * config/c6x/c6x.c (c6x_output_file_unwind): Use dwarf_debuginfo_p. > * config/darwin.c (darwin_override_options): Likewise. > * config/i386/cygming.h (DBX_REGISTER_NUMBER): Likewise. > * config/i386/darwin.h (DBX_REGISTER_NUMBER): Likewise. > (DWARF2_FRAME_REG_OUT): Likewise. > * config/mips/mips.c (mips_output_filename): Likewise. > * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): > Likewise. > (rs6000_dbx_register_number): Likewise. > * dbxout.c: Include flags.h. > * dwarf2cfi.c (cfi_label_required_p): Likewise. > (dwarf2out_do_frame): Likewise. > * except.c: Include flags.h. > * final.c (dwarf2_debug_info_emitted_p): Likewise. > (final_scan_insn_1): Likewise. > * flags.h (dwarf_debuginfo_p): New function declaration. > * opts.c (dwarf_debuginfo_p): New function definition. > * targhooks.c (default_debug_unwind_info): Use dwarf_debuginfo_p. > * toplev.c (process_options): Likewise. > --- > gcc/c-family/c-lex.c | 4 ++-- > gcc/config/c6x/c6x.c | 4 ++-- > gcc/config/darwin.c| 3 ++- > gcc/config/i386/cygming.h | 2 +- > gcc/config/i386/darwin.h | 4 ++-- > gcc/config/mips/mips.c | 3 ++- > gcc/config/rs6000/rs6000.c | 4 ++-- > gcc/dbxout.c | 1 + > gcc/dwarf2cfi.c| 9 - > gcc/except.c | 1 + > gcc/final.c| 15 ++- > gcc/flags.h| 4 > gcc/opts.c | 8 > gcc/targhooks.c| 2 +- > gcc/toplev.c | 6 ++ > 15 files changed, 40 insertions(+), 30 deletions(-) > > diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c > index 1c66ecd..c44e7a1 100644 > --- a/gcc/c-family/c-lex.c > +++ b/gcc/c-family/c-lex.c > @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see > #include "stor-layout.h" > #include "c-pragma.h" > #include "debug.h" > +#include "flags.h" > #include "file-prefix-map.h" /* remap_macro_filename() */ > #include "langhooks.h" > #include "attribs.h" > @@ -87,8 +88,7 @@ init_c_lex (void) > >/* Set the debug callbacks if we can use them. */ >if ((debug_info_level == DINFO_LEVEL_VERBOSE > - && (write_symbols == DWARF2_DEBUG > - || write_symbols == VMS_AND_DWARF2_DEBUG)) > + && dwarf_debuginfo_p ()) >|| flag_dump_go_spec != NULL) > { >cb->define = cb_define; > diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c > index f9ad1e5..e2011f0 100644 > --- a/gcc/config/c6x/c6x.c > +++ b/gcc/config/c6x/c6x.c > @@ -59,6 +59,7 @@ > #include "regrename.h" > #include "dumpfile.h" > #include "builtins.h" > +#include "flags.h" > > /* This file should be included last. */ > #include "target-def.h" > @@ -439,8 +440,7 @@ c6x_output_file_unwind (FILE * f) > { >if (flag_unwind_tables || flag_exceptions) > { > - if (write_symbols == DWARF2_DEBUG > - || write_symbols == VMS_AND_DWARF2_DEBUG) > + if (dwarf_debuginfo_p ()) > asm_fprintf (f, "\t.cfi_sections .debug_frame, .c6xabi.exidx\n"); > else > asm_fprintf (f, "\t.cfi_sections .c6xabi.exidx\n"); > diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c > index 5d17391..026c1fb 100644 > --- a/gcc/config/darwin.c > +++ b/gcc/config/darwin.c > @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see > #include "lto-section-names.h" > #include "intl.h" > #include "optabs.h" > +#include "flags.h" > > /* Fix and Continue. > > @@ -3348,7 +3349,7 @@ darwin_override_options (void) >&& generating_for_darwin_version >= 9 >&& (flag_gtoggle ? (debug_info_level == DINFO_LEVEL_NONE) >: (debug_info_level >= DINFO_LEVEL_NORMAL)) > - && write_symbols == DWARF2_DEBUG) > + && dwarf_debuginfo_p ()) > flag_var_tracking_uninit = flag_var_tracking; > >/* Final check on PCI options; for Darwin these are not dependent on the > PIE > diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h > index cfbca34..ac458cd 100644 > --- a/gcc/config/i386/cygming.h > +++ b/gcc/config/i386/cygming.h > @@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see > #undef DBX_REGISTER_NUMBER > #define DBX_REGISTER_NUMBER(n) \ >(TARGET_64BIT ? dbx64_register_map[n]\ > - :
[PATCH,V3 2/2] dwarf: new dwarf_debuginfo_p predicate
[Changes from V2] - Tested build (make all-gcc) of cross compiler for target triplets containing c6x/mips/powerpc and darwin/cygwin. [End of changes from V2] This patch introduces a dwarf_debuginfo_p predicate that abstracts and replaces complex checks on write_symbols. gcc/c-family/ChangeLog: * c-lex.c (init_c_lex): Use dwarf_debuginfo_p. gcc/ChangeLog: * config/c6x/c6x.c (c6x_output_file_unwind): Use dwarf_debuginfo_p. * config/darwin.c (darwin_override_options): Likewise. * config/i386/cygming.h (DBX_REGISTER_NUMBER): Likewise. * config/i386/darwin.h (DBX_REGISTER_NUMBER): Likewise. (DWARF2_FRAME_REG_OUT): Likewise. * config/mips/mips.c (mips_output_filename): Likewise. * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): Likewise. (rs6000_dbx_register_number): Likewise. * dbxout.c: Include flags.h. * dwarf2cfi.c (cfi_label_required_p): Likewise. (dwarf2out_do_frame): Likewise. * except.c: Include flags.h. * final.c (dwarf2_debug_info_emitted_p): Likewise. (final_scan_insn_1): Likewise. * flags.h (dwarf_debuginfo_p): New function declaration. * opts.c (dwarf_debuginfo_p): New function definition. * targhooks.c (default_debug_unwind_info): Use dwarf_debuginfo_p. * toplev.c (process_options): Likewise. --- gcc/c-family/c-lex.c | 4 ++-- gcc/config/c6x/c6x.c | 4 ++-- gcc/config/darwin.c| 3 ++- gcc/config/i386/cygming.h | 2 +- gcc/config/i386/darwin.h | 4 ++-- gcc/config/mips/mips.c | 3 ++- gcc/config/rs6000/rs6000.c | 4 ++-- gcc/dbxout.c | 1 + gcc/dwarf2cfi.c| 9 - gcc/except.c | 1 + gcc/final.c| 15 ++- gcc/flags.h| 4 gcc/opts.c | 8 gcc/targhooks.c| 2 +- gcc/toplev.c | 6 ++ 15 files changed, 40 insertions(+), 30 deletions(-) diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 1c66ecd..c44e7a1 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "stor-layout.h" #include "c-pragma.h" #include "debug.h" +#include "flags.h" #include "file-prefix-map.h" /* remap_macro_filename() */ #include "langhooks.h" #include "attribs.h" @@ -87,8 +88,7 @@ init_c_lex (void) /* Set the debug callbacks if we can use them. */ if ((debug_info_level == DINFO_LEVEL_VERBOSE - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG)) + && dwarf_debuginfo_p ()) || flag_dump_go_spec != NULL) { cb->define = cb_define; diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index f9ad1e5..e2011f0 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -59,6 +59,7 @@ #include "regrename.h" #include "dumpfile.h" #include "builtins.h" +#include "flags.h" /* This file should be included last. */ #include "target-def.h" @@ -439,8 +440,7 @@ c6x_output_file_unwind (FILE * f) { if (flag_unwind_tables || flag_exceptions) { - if (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) asm_fprintf (f, "\t.cfi_sections .debug_frame, .c6xabi.exidx\n"); else asm_fprintf (f, "\t.cfi_sections .c6xabi.exidx\n"); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 5d17391..026c1fb 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "lto-section-names.h" #include "intl.h" #include "optabs.h" +#include "flags.h" /* Fix and Continue. @@ -3348,7 +3349,7 @@ darwin_override_options (void) && generating_for_darwin_version >= 9 && (flag_gtoggle ? (debug_info_level == DINFO_LEVEL_NONE) : (debug_info_level >= DINFO_LEVEL_NORMAL)) - && write_symbols == DWARF2_DEBUG) + && dwarf_debuginfo_p ()) flag_var_tracking_uninit = flag_var_tracking; /* Final check on PCI options; for Darwin these are not dependent on the PIE diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index cfbca34..ac458cd 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see #undef DBX_REGISTER_NUMBER #define DBX_REGISTER_NUMBER(n) \ (TARGET_64BIT ? dbx64_register_map[n]\ - : (write_symbols == DWARF2_DEBUG\ + : (dwarf_debuginfo_p () \ ? svr4_dbx_register_map[n] : dbx_register_map[n])) /* Map gcc register number to DWARF 2 CFA column number. For 32 bit diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index afa9f1b..5312003 100644 ---