File suse-record-gcc-opts.diff of Package gcc46

Index: gcc/varasm.c
===================================================================
*** gcc/varasm.c.orig	2010-11-05 13:58:02.000000000 +0100
--- gcc/varasm.c	2010-11-05 14:29:25.000000000 +0100
*************** file_end_indicate_split_stack (void)
*** 6682,6687 ****
--- 6682,6716 ----
      }
  }
  
+ /* This is a generic routine emitting a SUSE specific section for
+    QA check marks. */
+ 
+ void
+ suse_file_end_indicate_optflags (void)
+ {
+   unsigned int flags = SECTION_DEBUG | SECTION_STRINGS | SECTION_MERGE | (SECTION_ENTSIZE & 1);
+ 
+   /*
+      o/O: optimize was off/on
+      s/S: size optimisation was off/on
+      p/P: stack-protector was off/on
+      w/W: warnings were off/on
+      g/G: debug was off/on
+      */
+ 
+   char opts_buffer[6];
+ 
+   opts_buffer[0] = (optimize >= 2) ? 'O' : 'o';
+   opts_buffer[1] = (optimize >= 1 && optimize_size) ? 'S' : 's';
+   opts_buffer[2] = (flag_stack_protect >= 1) ? 'P' : 'p';
+   opts_buffer[3] = (warn_uninitialized >= 1 && warn_sequence_point >= 1) ? 'W' : 'w';
+   opts_buffer[4] = (debug_info_level > DINFO_LEVEL_NONE) ? 'G' : 'g';
+   opts_buffer[5] = '\0';
+ 
+   switch_to_section (get_section (".comment.SUSE.OPTs", flags, NULL));
+   ASM_OUTPUT_ASCII (asm_out_file, opts_buffer, strlen (opts_buffer) + 1);
+ }
+ 
  /* Output DIRECTIVE (a C string) followed by a newline.  This is used as
     a get_unnamed_section callback.  */
  
Index: gcc/output.h
===================================================================
*** gcc/output.h.orig	2010-10-12 15:16:27.000000000 +0200
--- gcc/output.h	2010-11-05 14:29:57.000000000 +0100
*************** extern void default_asm_declare_constant
*** 633,638 ****
--- 633,639 ----
  extern void default_file_start (void);
  extern void file_end_indicate_exec_stack (void);
  extern void file_end_indicate_split_stack (void);
+ extern void suse_file_end_indicate_optflags (void);
  
  extern void default_elf_asm_output_external (FILE *file, tree,
  					     const char *);
Index: gcc/toplev.c
===================================================================
*** gcc/toplev.c.orig	2010-11-05 13:58:02.000000000 +0100
--- gcc/toplev.c	2010-11-05 14:29:25.000000000 +0100
*************** compile_file (void)
*** 1007,1012 ****
--- 1007,1014 ----
    /* Invoke registered plugin callbacks.  */
    invoke_plugin_callbacks (PLUGIN_FINISH_UNIT, NULL);
  
+   suse_file_end_indicate_optflags ();
+ 
    /* This must be at the end.  Some target ports emit end of file directives
       into the assembly file here, and hence we can not output anything to the
       assembly file after this point.  */
openSUSE Build Service is sponsored by