Has anybody used 0.9.30 on sh4?

Rob Landley rob at landley.net
Mon Mar 2 04:01:57 UTC 2009


On Thursday 26 February 2009 08:36:13 Carmelo AMOROSO wrote:
> Rob Landley wrote:
> > 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
>
> Rob,
> it seems like the assembler mixed section name with symbol name.
> May you try, to rename the symbold _init/_fini to something different
> and recompile he crti.S only ? just to see if something change.
>
> Anyway, I tried with my toolchain and I got the correct results as below
> (both with  cross-compiler on x86 host and on real sh4 box)
>
> [amorosoc at ctn003831~/uClibc-work/SVN/uClibc-0.9.30]sh4-linux-uclibc-objdump
> -dzS lib/crti.o
>
> 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	c <_init+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	c <_fini+0xc>
>    a:	09 00       	nop
>
> As you can see, the _init and _fini symbols are correctly defined
> in their relative .init and .fini section.
>
> Just for comparisons, which gcc/binutils version are you using ?
> in my case:

GCC 4.1.2 and Binutils 2.17, but I'm thinking of bumping to gcc 4.2.x.  
(That's still gplv2.)

> gcc is based on 4.2.4
> binutils is  2.18.50.0.8
> sh4-linux-uclibc-as -v GNU assembler version 2.18.50.0.8
> (sh4-linux-uclibc) using BFD version (Linux/GNU Binutils)
> 2.18.50.0.8.20080709
>
> Never seen similar problem before (also with older toolchains)

I tried the attached patch, and the uClibc build did this:

  AS lib/crti.o
crti.S: Assembler messages:
crti.S:23: Error: unrecognized symbol type "eeekfunction"
make: *** [lib/crti.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes.  Stop.

Alas, I have no idea what I'm doing with sh4 assembly.

I'll try 4.2 and see if this (and the arm eabi issue I'm having) just 
magically go away...

Thanks,

Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uClibc-test.patch
Type: text/x-patch
Size: 660 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20090301/80d206fa/attachment-0001.bin>


More information about the uClibc mailing list