-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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,@-r15 > 2: e6 2f mov.l r14,@-r15 > 4: 22 4f sts.l pr,@-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,@-r15 > 2: e6 2f mov.l r14,@-r15 > 4: 22 4f sts.l pr,@-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) [amoro...@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,@-r15 2: e6 2f mov.l r14,@-r15 4: 22 4f sts.l pr,@-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,@-r15 2: e6 2f mov.l r14,@-r15 4: 22 4f sts.l pr,@-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 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) cheers, Carmelo > _______________________________________________ > uClibc mailing list > [email protected] > http://lists.busybox.net/mailman/listinfo/uclibc > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkmmqNwACgkQoRq/3BrK1s8wGACfbXE1k7wB2IM7pF7+6N602HLa tWEAoOuctM1EsW8a+PD9vNOjM+AEjRkV =PfnO -----END PGP SIGNATURE----- _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
