public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Avoid linker errors with --help= option. (PR 31353)
@ 2007-03-26  2:34 Brooks Moses
  2007-03-30 17:39 ` Mark Mitchell
  0 siblings, 1 reply; 2+ messages in thread
From: Brooks Moses @ 2007-03-26  2:34 UTC (permalink / raw)
  To: gcc-patches

[-- 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;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] Avoid linker errors with --help= option. (PR 31353)
  2007-03-26  2:34 [patch] Avoid linker errors with --help= option. (PR 31353) Brooks Moses
@ 2007-03-30 17:39 ` Mark Mitchell
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Mitchell @ 2007-03-30 17:39 UTC (permalink / raw)
  To: Brooks Moses; +Cc: gcc-patches

Brooks Moses wrote:
> 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.

:REVIEWMAIL: OK

Thansk,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-30 17:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-26  2:34 [patch] Avoid linker errors with --help= option. (PR 31353) Brooks Moses
2007-03-30 17:39 ` Mark Mitchell

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).