[ECOS] Current gcc snapshot, -ffunction-sections

Chan Shih-Ping Richard cshihpin@dso.org.sg
Wed Jan 19 16:43:00 GMT 2000


The current gcc snapshot (20000117) doesn't seem
to add prefixes (.data., .rodata.) to data sections
when compiled with -ffunction-sections -fdata-sections.
(Target is sparclite-elf). 

I think I've isolated the problem to config/elfos.h
/* BTW: sec = 0 means prefix .text.
        sec = 1 means prefix .data.
        sec = 2 means prefix .rodata.
        sec = 3 means no prefix */

                                                                \
      if (TREE_CODE (DECL) == FUNCTION_DECL)                    \
        sec = 0;  /* .text. */                                  \
      else if (DECL_INITIAL (DECL) == 0                         \
               || DECL_INITIAL (DECL) == error_mark_node)       \
        sec = 3;   /* NO PREFIX!! */                            \
      else if (DECL_READONLY_SECTION (DECL, RELOC))             \
        sec = 1;  /* prefix .rodata. but never seem to get here */ \
      else                                                      \
        sec = 2;  /* prefix .data. but never seem to get here */ 

Can anyone explain why the first "else if" captures all
the .data and .rodata sections which result in no
prefix. (Symptom is that the assembler complains about
"symbol already defined".) The ecosSWtools of 3/99 doesn't
have a catch-all clause and prepends .text./.rodata./.data.
as necessary.

Removing the offending clause "seems" to work. The resulting
cross-compiler (gcc-20000117, binutils-20000117, newlib-1.8.2)
is able to build the tutorial and run simple tests.

-- 

Chan Shih-Ping (Richard) <cshihpin@dso.org.sg>
DSO National Laboratories
20 Science Park Drive
Singapore 118230



More information about the Ecos-discuss mailing list