public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-6965] gccgo driver: always act as though -g is passed Date: Thu, 28 Jan 2021 23:54:21 +0000 (GMT) [thread overview] Message-ID: <20210128235421.AC14A38438A3@sourceware.org> (raw) https://gcc.gnu.org/g:e6bce7fe17bf32ce969abc6f77f07acd352f6977 commit r11-6965-ge6bce7fe17bf32ce969abc6f77f07acd352f6977 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 28 15:46:59 2021 -0800 gccgo driver: always act as though -g is passed The go1 compiler always turns on debugging, to support Go stack traces and functions like runtime.Callers. With the recent switch to turn on DWARF 5 by default, this caused failures with some versions of gas, such as 2.35.1, because the assembly code would assume DWARF 5 but the driver would not pass --gdwarf-5 to gas. gas would then give an error: "file number less than one". This change avoids that problem by having the gccgo driver spec add a -g option to the command line if no other -g option is present. The newly added -g option is passed to the assembler as --gdwarf-5. * gospec.c (lang_specific_driver): Add -g if no debugging options were passed. Diff: --- gcc/go/gospec.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gcc/go/gospec.c b/gcc/go/gospec.c index aaf64e73949..cf8d0f2b60e 100644 --- a/gcc/go/gospec.c +++ b/gcc/go/gospec.c @@ -127,6 +127,9 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* The first input file with an extension of .go. */ const char *first_go_file = NULL; + /* Whether we saw any -g option. */ + bool saw_opt_g = false; + argc = *in_decoded_options_count; decoded_options = *in_decoded_options; added_libraries = *in_added_libraries; @@ -208,6 +211,18 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, saw_opt_o = true; break; + case OPT_g: + case OPT_gdwarf: + case OPT_gdwarf_: + case OPT_ggdb: + case OPT_gstabs: + case OPT_gstabs_: + case OPT_gvms: + case OPT_gxcoff: + case OPT_gxcoff_: + saw_opt_g = true; + break; + case OPT_static: static_link = 1; break; @@ -271,6 +286,15 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, j++; } + /* The go1 compiler is going to enable debug info by default. If we + don't see any -g options, force -g, so that we invoke the + assembler with the right debug option. */ + if (!saw_opt_g) + { + generate_option (OPT_g, "1", 0, CL_DRIVER, &new_decoded_options[j]); + j++; + } + /* NOTE: We start at 1 now, not 0. */ while (i < argc) {
reply other threads:[~2021-01-28 23:54 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210128235421.AC14A38438A3@sourceware.org \ --to=ian@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).