This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Avoid linker errors with --help= option. (PR 31353)


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]