public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Brooks Moses <brooks.moses@codesourcery.com>
To: gcc-patches@gcc.gnu.org
Subject: [patch] Avoid linker errors with --help= option. (PR 31353)
Date: Mon, 26 Mar 2007 02:34:00 -0000	[thread overview]
Message-ID: <46071605.4080201@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

:ADDPATCH other:

Currently, the handler for --help= in gcc.c creates a dummy file name to 
pass to the various cc1, f951, and other subprocesses.  This seems to 
fulfill its purpose of getting the later parts of gcc.c to call the 
various subprocesses, but it also means that the linker gets called with 
nothing to link.  The result is that the output of "gcc --help=target" 
(for example) ends with a linker error message.

The attached patch turns off the linker in the case where --help= has 
been specified.  In so doing, it gives meaning to the various numbers 
assigned to print_subprocess_help -- it's already assigned 2 in the 
--help= handler, and 1 in the --target-help handler, but those numbers 
are never checked.  I presume that something like this was the intended 
use, however.

-----------------------------------------------------------------
2007-03-25  Brooks Moses  <brooks.moses@codesourcery.com>

	PR other/31353
	* gcc.c (main): Do not run the linker if
	print_subprocess_help indicates that it shouldn't be
	run.

-----------------------------------------------------------------

Tested with a bootstrap (and a few minutes of "make check", to confirm 
that this isn't interfering with compiling code) on i686-pc-linux-gnu. 
Ok for trunk?

- Brooks

[-- Attachment #2: PR31353.diff --]
[-- Type: text/x-patch, Size: 388 bytes --]

Index: gcc.c
===================================================================
--- gcc.c	(revision 123170)
+++ gcc.c	(working copy)
@@ -6692,7 +6692,7 @@
 
   /* Run ld to link all the compiler output files.  */
 
-  if (num_linker_inputs > 0 && error_count == 0)
+  if (num_linker_inputs > 0 && error_count == 0 && print_subprocess_help < 2)
     {
       int tmp = execution_count;
 

             reply	other threads:[~2007-03-26  0:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-26  2:34 Brooks Moses [this message]
2007-03-30 17:39 ` Mark Mitchell

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=46071605.4080201@codesourcery.com \
    --to=brooks.moses@codesourcery.com \
    --cc=gcc-patches@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: link
Be 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).