On 2007-03-27, Grant Edwards <[email protected]> wrote:
> On 2007-03-27, Grant Edwards <[email protected]> wrote:
>> When I use -ffunction-sections I get a warning:
>>
>> cc1: warning: -ffunction-sections may affect debugging on some targets
>>
>> I've been using -ffunction-sections for many years on many
>> targets and I've never seen that warning before. 
>>
>> Why do I get that warning on MSP430 and not other targets?
>
> It appears to happen for msp430-gcc because it isn't used the
> ELF object format.  At least that's what gcc thinks. Here's the
> code in toplev.c that generates the warning:
>
> #ifndef OBJECT_FORMAT_ELF
>   if (flag_function_sections && write_symbols != NO_DEBUG)
>     warning ("-ffunction-sections may affect debugging on some targets");
> #endif
>
> Why is OBJECT_FORMAT_ELF not defined?

Here's the patch I'm currently using, but I think the correct
solution would be to properly configure mspgcc to use the ELF
file format.

------------------------------8<------------------------------
Only in .: disable-ffunction-section_warning.patch
diff -r -U10 ../gcc-3.2.3-orig/gcc/toplev.c ./gcc/toplev.c
--- ../gcc-3.2.3-orig/gcc/toplev.c      2003-02-21 23:37:46.000000000 -0600
+++ ./gcc/toplev.c      2007-03-27 11:18:26.000000000 -0500
@@ -5031,22 +5031,22 @@
 
   /* This combination of options isn't handled for i386 targets and doesn't
      make much sense anyway, so don't allow it.  */
   if (flag_prefetch_loop_arrays && optimize_size)
     {
       warning ("-fprefetch-loop-arrays is not supported with -Os");
       flag_prefetch_loop_arrays = 0;
     }
 
 #ifndef OBJECT_FORMAT_ELF
-  if (flag_function_sections && write_symbols != NO_DEBUG)
-    warning ("-ffunction-sections may affect debugging on some targets");
+//  if (flag_function_sections && write_symbols != NO_DEBUG)
+//    warning ("-ffunction-sections may affect debugging on some targets");
 #endif
 }
 
 /* Language-independent initialization, before language-dependent
    initialization.  */
 static void
 lang_independent_init ()
 {
   decl_printable_name = decl_name;
   lang_expand_expr = (lang_expand_expr_t) do_abort;
------------------------------8<------------------------------

-- 
Grant Edwards                   grante             Yow!  I think my career
                                  at               is ruined!
                               visi.com            


Reply via email to