[PATCH] disable profiling in collect2 sub-compile

David Edelsohn dje@watson.ibm.com
Wed Dec 17 16:41:00 GMT 2003


	On some targets, collect2 creates and compiles a temporary file of
static constructors and destructors.  collect2 compiles the file with the
same options used to invoke the compiler driver that invoked collect2.  If
profiling is enabled, the temporary filenames will not match and no
profiling information will be present, producing (irrelevant) messages.

	The messages about profiling used to be suppressed by collect2
explicitly invoking GCC with "-w", but the information about profiling now
is produced as informational messages, not warnings.

	The following patch explicitly disables profiling flags when
invoking GCC for the sub-compile, following the precedent of adding the
"-w" and "-fno-exceptions" commandline options.

	Is this okay for mainline?

Thanks, David


	* collect2.c (main): Add -fno-profile-arcs -fno-test-coverage
	-fno-branch-probabilities to arguments when compiling ctors and
	dtors.

Index: collect2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/collect2.c,v
retrieving revision 1.156
diff -c -p -r1.156 collect2.c
*** collect2.c	8 Dec 2003 04:18:44 -0000	1.156
--- collect2.c	15 Dec 2003 01:07:38 -0000
*************** main (int argc, char **argv)
*** 884,891 ****
      }
    obstack_free (&temporary_obstack, temporary_firstobj);
  
!   /* -fno-exceptions -w */
!   num_c_args += 2;
  
    c_ptr = (const char **) (c_argv = xcalloc (sizeof (char *), num_c_args));
  
--- 884,892 ----
      }
    obstack_free (&temporary_obstack, temporary_firstobj);
  
!   /* -fno-profile-arcs -fno-test-coverage -fno-branch-probabilities
!      -fno-exceptions -w */
!   num_c_args += 5;
  
    c_ptr = (const char **) (c_argv = xcalloc (sizeof (char *), num_c_args));
  
*************** main (int argc, char **argv)
*** 1046,1051 ****
--- 1047,1055 ----
  	}
      }
    obstack_free (&temporary_obstack, temporary_firstobj);
+   *c_ptr++ = "-fno-profile-arcs";
+   *c_ptr++ = "-fno-test-coverage";
+   *c_ptr++ = "-fno-branch-probabilities";
    *c_ptr++ = "-fno-exceptions";
    *c_ptr++ = "-w";
  



More information about the Gcc-patches mailing list