Has anybody used 0.9.30 on sh4?

Rob Landley rob at landley.net
Sun Feb 22 08:36:53 UTC 2009


If I enable CTOR/DTOR support, I get undefined _init and _fini.  I don't 
remember which .o file those two are in, but it's linking in the same group as 
all the other targets and those work, sh4 doesn't.

# gcc -v thread-hello2.c -lpthread
...
/usr/bin/../lib/crt1.o: In function `_start':
(.text+0x24): undefined reference to `_init'
/usr/bin/../lib/crt1.o: In function `_start':
(.text+0x28): undefined reference to `_fini'
collect2: ld returned 1 exit status

When I disassemble crti.o on i686, I see definitions of _init and _fini, but 
when I disassemble crti.o on sh4, the functions are called .init and .fini:

/ # objdump -d /usr/lib/crti.o

/usr/lib/crti.o:     file format elf32-sh-linux

Disassembly of section .init:

00000000 <.init>:
   0:	c6 2f       	mov.l	r12, at -r15
   2:	e6 2f       	mov.l	r14, at -r15
   4:	22 4f       	sts.l	pr, at -r15
   6:	f3 6e       	mov	r15,r14
   8:	00 a0       	bra	0xc
   a:	09 00       	nop	
Disassembly of section .fini:

00000000 <.fini>:
   0:	c6 2f       	mov.l	r12, at -r15
   2:	e6 2f       	mov.l	r14, at -r15
   4:	22 4f       	sts.l	pr, at -r15
   6:	f3 6e       	mov	r15,r14
   8:	00 a0       	bra	0xc
   a:	09 00       	nop	

I looked at uClibc/libc/sysdeps/linux/sh/crti.S  and tried removing the 
"hidden" directives for both those, but it didn't help.

Any clues?

Rob


More information about the uClibc mailing list