This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: init_priority fix for services/memalloc
On Mon, 2004-09-27 at 21:36, Andrew Lunn wrote:
> > > I would not shout compiler bug. Rather i would ask what the expected
> > > behavious is. Its a more tactfull approach.
> >
> > It is not a compiler bug, it is the intended behaviour! :-)
> >
> > http://gcc.gnu.org/ml/gcc/2002-08/msg00792.html
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14161
>
> Does you fixed code still work OK with 3.2.1?
Attached is a fixed version of my patch to the tcl scripts that
generates code which compiles with GCC 3.2.1.
However, I wasn't able to run my test app since things are in pieces
currently.
I believe the form above will compile and do the correct thing with both
versions of the compiler.
Otherwise, it gets messy.
Obviously this is not the last we've heard of this issue. It would be
nice to narrow down precisely what the problem is and visit every
CYGBLD_ATTRIB_INIT in eCos to verify that they are OK.
That said, my application boots with GCC 3.4.2 and the attached patch +
GCC 3.2.1 compiles(and probably runs).
> The bugzilla report
> suggests it might not compiler. If it does not, its going to get messy
> to fix :-)
>
> Andrew
--
Øyvind Harboe
http://www.zylin.com
Index: current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/memalloc/common/current/ChangeLog,v
retrieving revision 1.31
diff -w -u -r1.31 ChangeLog
--- current/ChangeLog 5 Jul 2004 11:07:04 -0000 1.31
+++ current/ChangeLog 28 Sep 2004 08:15:37 -0000
@@ -1,3 +1,18 @@
+2004-09-27 Oyvind Harboe <oyvind.harboe@zylin.com>
+
+ * heapgen.tcl: place __attribute((init_priority())) attribute
+ in the right position such that it works with GCC 3.4.2. GCC 3.4.2
+ was intentionally changed in a way such that the following works
+ w/GCC 3.4.2:
+
+ static foo CYGBLD_ATTRIB_INIT_PRI(N) bar;
+
+ this does not:
+
+ static foo bar CYGBLD_ATTRIB_INIT_PRI(N);
+
+ The second case compiles, but the attribute is ignored.
+
2004-06-24 Oyvind Harboe <oyvind.harboe@zylin.com>
* Added cyg_memalloc_alloc_fail() fn which is invoked before
Index: current/src/heapgen.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/memalloc/common/current/src/heapgen.tcl,v
retrieving revision 1.8
diff -w -u -r1.8 heapgen.tcl
--- current/src/heapgen.tcl 4 Feb 2003 10:25:19 -0000 1.8
+++ current/src/heapgen.tcl 28 Sep 2004 08:15:57 -0000
@@ -172,15 +172,15 @@
foreach heap $heaps {
puts $cfile "#ifdef HAL_MEM_REAL_REGION_TOP\n"
- puts $cfile [ format "%s cygmem_pool_%s ( (cyg_uint8 *)CYGMEM_SECTION_%s ," \
+ puts $cfile [ format "%s CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_MEMALLOC) 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 " ;\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" \
+ puts $cfile [ format "%s CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_MEMALLOC) cygmem_pool_%s ( (cyg_uint8 *)CYGMEM_SECTION_%s , CYGMEM_SECTION_%s_SIZE ) ;\n" \
$malloc_impl_class $heap $heap $heap ]
puts $cfile "#endif"