Subject: Re: removing init/fini_fallthru
To: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
From: Nick Hudson <nick.hudson@dsl.pipex.com>
List: tech-toolchain
Date: 06/21/2006 08:23:43
On Wednesday 21 June 2006 01:36, Valeriy E. Ushakov wrote:
> On Tue, Jun 20, 2006 at 00:38:30 +1000, Simon Burge wrote:
> > MIPS with gcc4 is having some problems generating bad code which we sort
> > of worked around but breaking gcc3 in the process. Nick Hudson and I
> > have come up with the following which does away with the init_fallthru
> > and fini_fallthru functions and just puts _init and _fini directly in
> > the .init and .fini sections.
>
> I'm confused. crti.c says:
>
> void _init(void) __attribute__((section(".init")));
> void _fini(void) __attribute__((section(".fini")));
>
> so these functions are already in .init and .fini respectively.
ps. _init/_fini and init/fini_fallthru both need to be in .init/.fini. For
example,
$ objdump -D /usr/lib/crti.o -j .init
/usr/lib/crti.o: file format elf32-i386
Disassembly of section .init:
00000000 <_init>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: e8 00 00 00 00 call 9 <_init+0x9>
9: 5b pop %ebx
a: 81 c3 03 00 00 00 add $0x3,%ebx
10: 50 push %eax
11: e8 fc ff ff ff call 12 <_init+0x12>
16: 8b 5d fc mov 0xfffffffc(%ebp),%ebx
19: c9 leave
1a: c3 ret
0000001b <init_fallthru>:
1b: 90 nop
1c: 8d 74 26 00 lea 0x0(%esi),%esi
Nick