Jamie Lokier wrote:
> > OK, I've tracked it down now. Seems to be a stack overflow in
busybox.
> > Adding
> >
> > LDFLAGS += -Wl,-elf2flt="-r -s 65536"
> >
> > to user/busybox/Makefile solves the problem.
>
> Be careful: the "-s" option just changes the _initial_ thread's stack.
>
> The stack size for subsequent threads is hard-coded into libpthread,
> in uclibc. You can override it with pthread_attr_init,
> pthread_attr_setstacksize, and modifying all calls to pthread_create.
> Unfortunately no global run-time setting.
Thanks for the clarification, Jamie!
Unfortunately, the problem seems to be with busybox, not with my own
application. I don't like to modify busybox unless I am really sure
what is going on and that my modification don't break anything.
And there I get some more confusion to this topic: The above setting
don't actually change the stack size:
~/uClinux-dist-20051014/user/busybox> flthdr busybox
busybox
Magic: bFLT
Rev: 4
Entry: 0x50
Data Start: 0x3cf40
Data End: 0x46470
BSS End: 0x47d00
Stack Size: 0x4e20
Reloc Start: 0x46470
Reloc Count: 0x20d
Flags: 0x2 ( Has-PIC-GOT )
[ ... checked the application, it don't work now ... ]
~/uClinux-dist-20051014/user/busybox> (cd ../..; make)
[ ... Thousands of lines deleted. Checked that the LDCONFIG setting
shown above is actually used for busybox ... ]
[ ... checked the application again. Works now ... ]
~/uClinux-dist-20051014/user/busybox> flthdr busybox
busybox
Magic: bFLT
Rev: 4
Entry: 0x50
Data Start: 0x3cf40
Data End: 0x46470
BSS End: 0x47d00
Stack Size: 0x4e20
Reloc Start: 0x46470
Reloc Count: 0x20d
Flags: 0x3 ( Load-to-Ram Has-PIC-GOT )
~/uClinux-dist-20051014/user/busybox> flthdr -r -s 65536 busybox
~/uClinux-dist-20051014/user/busybox> flthdr busybox
busybox
Magic: bFLT
Rev: 4
Entry: 0x50
Data Start: 0x3cf40
Data End: 0x46470
BSS End: 0x47d00
Stack Size: 0x10000
Reloc Start: 0x46470
Reloc Count: 0x20d
Flags: 0x3 ( Load-to-Ram Has-PIC-GOT )
~/uClinux-dist-20051014/user/busybox> emacs /media/32_00_00/huhu
So the above setting seems to only change the "Load-to-Ram" flag. This
raises two questions:
1. Why don't LDFLAGS += -Wl,-elf2flt="-r -s 65536" actually increase
stack
size?
2. Why does the Load-to-Ram flag have any effect? Busybox is stored on
cramfs and I don't use XIP, so there is no way to execute it without
loading to RAM. IMHO, that means it should be loaded to RAM no
matter
how the load-to-ram flag is set. But then, how comes that after
setting
this flag the problem disappears?
Any ideas?
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev