Subject: Re: bin/12865 [ was Re: Patch for building Wine on NetBSD ]
To: None <bjy@mogua.org, skrll@netbsd.org>
From: Ross Harvey <ross@ghs.com>
List: port-i386
Date: 05/09/2001 12:55:35
This problem is understood and is being worked on right now.  It isn't
a linker or loader bug, it's a botch in the way our crtbegin.c and
crtend.c functions are written. I will add an explanatory note to
the PR with a pointer to the source code when the PR is closed. 

// ross

> From nick@smtp.fibili.co.uk Wed May  9 07:38:37 2001
> Date: Wed, 09 May 2001 15:38:04 +0100
> From: Nick Hudson <skrll@netbsd.org>
> X-Accept-Language: en
> To: Bang Jun-Young <bjy@mogua.org>
> Cc: Frederick Bruckman <fb@enteract.com>,
>    "Charles M. Hannum" <abuse@spamalicious.com>, port-i386@netbsd.org
> Subject: Re: Patch for building Wine on NetBSD
>
> Bang Jun-Young wrote:
> > 
> [...]
> > 
> > Thanks to Eric Pouech, I have found some of the reason. Let's have a
> > look at the following code:
> > 
> > extern void init(void) __attribute__((section(".init")));
> > extern void fini(void) __attribute__((section(".fini")));
> > 
> > main()
> > {
> >         printf("%s\n", __FUNCTION__);
> > }
> > 
> > asm("\n.section\t.init, \"ax\"\n"
> >     "\tcall init\n"
> >     "\t.previous\n");
> > 
> > asm("\n.section\t.fini, \"ax\"\n"
> >     "\tcall fini\n"
> >     "\t.previous\n");
> > 
> > void init(void)
> > {
> >         printf("%s\n", __FUNCTION__);
> > }
> > 
> > void fini(void)
> > {
> >         printf("%s\n", __FUNCTION__);
> > }
> > 
> > On FreeBSD, the output is like as follows:
> > 
> > init
> > init
> > main
> > fini
> > fini
> > 
> > Functions in the .init and .fini sections are automatically
> > executed at the init and exit time, respectively.
> > 
> > On the other hand, on NetBSD they are just ignored (without compile
> > error) and never called. For details, see
> > 
> >   http://www.winehq.com/hypermail/wine-devel/2001/05/0021.html
> > 
> > For now I suspect that it's a bug of ld(1) or ld.elf_so(1).
> > 
> > Jun-Young
>
> I raised a PR about this a couple of days ago: bin/12865
>
> Nick
> -- 
> aka skrll@netbsd.org, skrll@excite.co.uk
>