C++ support in DSLINUX
Amadeus
amadeus at iksw-muees.de
Tue Oct 17 22:07:50 CEST 2006
Hmmmm....
On Monday 16 October 2006 22:58, Amadeus wrote:
in rtest.o, I see:
000003d4 <puts>:
3d4: e92d4030 stmdb sp!, {r4, r5, lr}
3d8: e59f3038 ldr r3, [pc, #56] ; 418
<puts+0x44>
3dc: e79a2003 ldr r2, [sl, r3]
3e0: e5924000 ldr r4, [r2]
3e4: e1a01004 mov r1, r4
3e8: eb000089 bl 614 <__fputs_unlocked>
3ec: e1a05000 mov r5, r0
3f0: e3750001 cmn r5, #1 ; 0x1
3f4: e1a01004 mov r1, r4
3f8: e3a0000a mov r0, #10 ; 0xa
3fc: 0a000003 beq 410 <puts+0x3c>
400: eb00003c bl 4f8 <__fputc_unlocked>
404: e2855001 add r5, r5, #1 ; 0x1
408: e3700001 cmn r0, #1 ; 0x1
40c: 01a05000 moveq r5, r0
410: e1a00005 mov r0, r5
414: e8bd8030 ldmia sp!, {r4, r5, pc}
418: 0000003c andeq r0, r0, ip, lsr r0
obviously, the value 3c at 418 is an offset into a table. Base address
of this table is in register sl. Value is read from the table and
dereferenced.
My problem is that the value in r1/r4 is pointing to page 0.
So I have a relocation error!
The value read in r1/r4 is supposed to be a stream * named "stdout".
This stream pointer is defined in /uClibc/libc/stdio/_stdio.c:
static FILE _stdio_streams[] = {
__STDIO_INIT_FILE_STRUCT(_stdio_streams[0], \
__FLAG_LBF|__FLAG_READONLY, \
0, \
_stdio_streams + 1, \
_fixed_buffers, \
BUFSIZ ),
__STDIO_INIT_FILE_STRUCT(_stdio_streams[1], \
__FLAG_LBF|__FLAG_WRITEONLY, \
1, \
_stdio_streams + 2, \
_fixed_buffers + BUFSIZ, \
BUFSIZ ),
__STDIO_INIT_FILE_STRUCT(_stdio_streams[2], \
__FLAG_NBF|__FLAG_WRITEONLY, \
2, \
NULL, \
NULL, \
0 )
};
FILE *stdin = _stdio_streams;
FILE *stdout = _stdio_streams + 1;
FILE *stderr = _stdio_streams + 2;
The problem is here that without valid stdout/stderr streams, debugging
is very difficult....
This error is ONLY there if there are c++ items (classes, objects, etc)
in the file.
A simple rtest.xxx with a printf() and no classes is fine.
Any idea of how to debug? There must be something wrong with the binfmt
relocations...
regards
Amadeus
--
We're back to the times when men were men
and wrote their own device drivers.
(Linus Torvalds)
More information about the dslinux-devel
mailing list