Subject: Re: CVS commit: src/lib/csu/i386_elf
To: Jason Thorpe <thorpej@shagadelic.org>
From: Christos Zoulas <christos@zoulas.com>
List: source-changes
Date: 05/17/2006 12:53:10
On May 17,  9:45am, thorpej@shagadelic.org (Jason Thorpe) wrote:
-- Subject: Re: CVS commit: src/lib/csu/i386_elf

| On May 17, 2006, at 9:39 AM, Christos Zoulas wrote:
| 
| >
| > Module Name:	src
| > Committed By:	christos
| > Date:		Wed May 17 16:39:25 UTC 2006
| >
| > Modified Files:
| > 	src/lib/csu/i386_elf: crt0.c
| >
| > Log Message:
| > Avoid weak symbol related bug with _DYNAMIC not being referenced in  
| > the
| > code at all for gcc-4. Fixes statically linked binaries, but the  
| > fix is
| > bogus.
| 
| Is every platform going to have this problem?

I am looking into it. On i386 gcc-3 produced:


.L20:
        cmpl    $0, 28(%ebp)
        je      .L23
        movl    __ps_strings@GOT(%ebx), %edx
        movl    28(%ebp), %eax
        movl    %eax, (%edx)
.L23:
        movl    _DYNAMIC@GOT(%ebx), %eax
        testl   %eax, %eax
        je      .L24
        subl    $8, %esp
        pushl   24(%ebp)
        pushl   20(%ebp)
        call    _rtld_setup@PLT
        addl    $16, %esp

Gcc 4 produces:

.L2:
        cmpl    $0, 28(%ebp)
        je      .L6
        movl    __ps_strings@GOT(%ebx), %edx
        movl    28(%ebp), %eax
        movl    %eax, (%edx)
.L6:
        subl    $8, %esp
        pushl   24(%ebp)
        pushl   20(%ebp)
        call    _rtld_setup@PLT
        addl    $16, %esp

Matt says that it appears that gcc-4 does not believe that &var can be NULL...

christos