Subject: Re: Patch for building Wine on NetBSD
To: Bang Jun-Young <bjy@mogua.org>
From: Nick Hudson <skrll@netbsd.org>
List: port-i386
Date: 05/09/2001 15:38:04
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