RFA: Recording GCC command line switches in object files

Nick Clifton nickc@redhat.com
Wed Jan 18 12:01:00 GMT 2006


Hi Guys,

  I would like to submit for review and ideally approval, a revised
  version of my patch to add the ability for GCC to record its command
  line into object files.  The purpose of the patch is described here:

    http://gcc.gnu.org/wiki/Record%20GCC%20command%20line%20switches%20in%20object%20files

  This new version adds a new command line switch:
  
    -frecord-gcc-switches

  which, if invoked, will cause the command line and any active
  options to be recorded in the assembler file being created by the
  compiler.  The patch allows targets to take full control of how this
  is done, but it also provides a default implementation that will
  work for any ELF or COFF based target.  For ELF targets the strings
  are stored in a mergeable string section so that when multiple
  object files containing the command line information are linked
  together the section will not grow too big.

  So, how about it ?  May I check this patch in please ?

Cheers
  Nick

gcc/ChangeLog
2006-01-18  Nick Clifton  <nickc@redhat.com>

	* target.h (enum print_switch_type): Define.
        (print_fn_type): Define.
        (struct gcc_target.asm_out): Add record_gcc_switches and
	gcc_switches_recording_section fields.
	* target-def.h (TARGET_ASM_RECORD_GCC_SWITCHES): Provide
	default definition.
	(TARGET_ASM_GCC_SWITCHES_RECORDING_SECTION): Provide default
	definition.
        (TARGET_ASM_OUT): Add TARGET_ASM_RECORD_GCC_SWITCHES and
	TARGET_ASM_GCC_SWITCHES_RECORDING_SECTION.
	* common.opt (frecord-gcc-switches): New switch.
        * toplev.c (print_single_switch): Reorganise to take a
        print_fn_type parameter.
        (print_switch_values): Likewise.
        (print_to_asm_out_file): New function.
        (print_to_stderr): New function.
        (init_asm_output): If flag_record_gcc_switches is true and the
	target function record_gcc_switches is defined then use it to
	print the switch values.
	* varasm (varasm_print_gcc_option): New helper function that
	prints a single gcc switch to the assembler output file.
        (default_record_gcc_switches): New function.  Records gcc
        switches to a mergeable string section.
        * doc/tm.texi (TARGET_ASM_RECORD_GCC_SWITCHES,
	TARGET_ASM_GCC_SWITCHES_RECORDING_SECTION): Document the new
	target hooks.
        * doc/invoke.texi (-frecord-gcc-switches): Document new switch.
	
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc.record_options.patch
Type: text/x-patch
Size: 19358 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060118/b4a4dc32/attachment.bin>


More information about the Gcc-patches mailing list