This is the mail archive of the ecos-bugs@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1000098] New: initialization priority attribute for heap not honored by gcc 3.4.0


http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000098

           Summary: initialization priority attribute for heap not honored
                    by gcc 3.4.0
           Product: eCos
           Version: CVS
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: normal
         Component: Memory allocators
        AssignedTo: jifl@ecoscentric.com
        ReportedBy: jp@biotronik-erlangen.de
         QAContact: ecos-bugs@sources.redhat.com


While recompiling a working application for the ARM7 core (on a AT91 chip) with 
the gcc 3.4.0 (source: binary package taken from www.gnuarm.com) i got abort 
error during the initialization phase, where all static constructors are called.
I was able to track the problem down to be that the constructor of the heap in 
heaps.cxx (which itself is generated out of heaps.tcl) is called later than 
specified by the attribute macro CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_MEMALLOC).

The compiler is issuing a warning which describes why it is ignoring the 
attribute: 
"heaps.cxx:19: warning: attributes after parenthesized initializer ignored"

Some googling found out that that kind of usage of attributes is now deprecated.
Links: 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14161
http://gcc.gnu.org/ml/gcc/2002-08/msg00792.html

The latter linked document explains the rationale and even gives some hints on 
how to avoid the inappropriate usage of attributes by placing the attribute 
between the identifier and the parentheses of the initializer. 

Summary: ECOS uses a attribute syntax which is no longer supportet by gcc 3.4.0 
or later.
Proposed change: put attributes between identifier and parentheses.

Affected source code files: 
packages/services/memalloc/common/current/src/heapgen.tcl

affected lines (of version 1.18) 172-187

original: 
foreach heap $heaps {
    puts $cfile "#ifdef HAL_MEM_REAL_REGION_TOP\n"

    puts $cfile [ format "%s cygmem_pool_%s ( (cyg_uint8 *)CYGMEM_SECTION_%s ," 
\
            $malloc_impl_class $heap $heap ]
    puts $cfile [ format "    HAL_MEM_REAL_REGION_TOP( (cyg_uint8 *)
CYGMEM_SECTION_%s + CYGMEM_SECTION_%s_SIZE ) - (cyg_uint8 *)CYGMEM_SECTION_%s ) 
" \
            $heap $heap $heap ]
    puts $cfile "        CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_MEMALLOC);\n"

    puts $cfile "#else\n"

    puts $cfile [ format "%s cygmem_pool_%s ( (cyg_uint8 *)CYGMEM_SECTION_%s , 
CYGMEM_SECTION_%s_SIZE ) CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_MEMALLOC);\n" \
            $malloc_impl_class $heap $heap $heap ]

    puts $cfile "#endif"
}
-------------
proposed change:
foreach heap $heaps {
    puts $cfile "#ifdef HAL_MEM_REAL_REGION_TOP\n"

    puts $cfile [ format "%s cygmem_pool_%s  
CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_MEMALLOC) ( (cyg_uint8 *)CYGMEM_SECTION_%s ," \
            $malloc_impl_class $heap $heap ]
    puts $cfile [ format "    HAL_MEM_REAL_REGION_TOP( (cyg_uint8 *)
CYGMEM_SECTION_%s + CYGMEM_SECTION_%s_SIZE ) - (cyg_uint8 *)CYGMEM_SECTION_%s ) 
" \
            $heap $heap $heap ]
    puts $cfile "       ;\n"

    puts $cfile "#else\n"

    puts $cfile [ format "%s cygmem_pool_%s  
CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_MEMALLOC) ( (cyg_uint8 *)CYGMEM_SECTION_%s , 
CYGMEM_SECTION_%s_SIZE );\n" \
            $malloc_impl_class $heap $heap $heap ]

    puts $cfile "#endif"
}
---------------

Disclaimer: with the proposed changes it works now for me with gcc 3.4.0
I did not test it with any older version of gcc for compatability!



------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]