This is the mail archive of the ecos-patches@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]

Re: new memory debug feature


On Thu, Jul 01, 2004 at 10:00:54AM +0200, ?yvind Harboe wrote:
> I had to make some more changes to make it compile again.
> 
> ><cyg/kernel/kapi.h> is not needed. In fact i think memalloc is
> >independant of the kernel, so using this header file would be a bad
> >idea since it might not exist.
> 
> I had to add it back in since  memalloc/common/current/include/kapi.h
> depends on the definition on e.g. cyg_handle_t.

Yes, i found that as well. But i don't want to make memalloc dependent
on the kernel. Redboot makes use of it, and so breaks since redboot
does not have the kernel included in the configuration. The prototype
has to go somewhere else, maybe next to malloc in stdlib.h?
 
> > Now the problem. I added the missing weak attribute. However, this
> > causes problems for me. When the option is enabled and a failure
> > happens, it crashes. All the tests in memalloc package fail
> > horribly. If i remove the weak attribute they work. 
> 
> Can't we just leave out the weak attribute?

Have you tried having your own implementation of
cyg_memalloc_alloc_fail(). You should get a linker error since there
are then two implementations of the same function and the linker does
not know which to use. The solution to this is to make the one in the
eCos library weak. The linker will then only use the weak symbol when
there is no strong symbol.
 
> cyg_memalloc_alloc_fail() has its own file "debug.c".
> 
> I find bugs in GCC as "fascinating" as the next guy :-), but I'm happy
> to leave this one be.
> 
> > It looks like a problem with the linker or maybe the compiler. The
> > image does not contain the cyg_memalloc_alloc_fail function. I've got
> > binutils 2.14.90.0 and gcc 3.3.4 (Debian) and im testing on synth. 
> 
> I'm running arm-elf-gcc 3.2.1 and I get compilation errors with the weak
> attribute defined.

Interesting. I could be i have the syntax wrong somehow. I will play
with the arm compiler and see if i can get it to at least compile cleanly.

        Andrew


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