bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More info about libc/libio/gcc-3.0 static binaries


From: Marcus Brinkmann
Subject: Re: More info about libc/libio/gcc-3.0 static binaries
Date: Tue, 8 Jan 2002 01:02:26 +0100
User-agent: Mutt/1.3.24i

On Mon, Jan 07, 2002 at 10:51:40PM +0100, Marcus Brinkmann wrote:
> 0x8048494 <_hurd_stack_setup>:  push   %ebp
> 0x8048495 <_hurd_stack_setup+1>:        mov    %esp,%ebp
> 0x8048497 <_hurd_stack_setup+3>:        push   %ebx
> 0x8048498 <_hurd_stack_setup+4>:        sub    $0x24,%esp
> 0x804849b <_hurd_stack_setup+7>:        mov    0x8(%ebp),%eax

So far I have been able to reduce the offending code, by trial-and-error, to
this:

extern void __mach_init (void);

void
_hurd_stack_setup (int argc __attribute__ ((unused)), ...)
{
  void doinit (int *data)
    {
      *--data = (&argc)[-1];
    }
  __mach_init ();
}

Which produces:
_hurd_stack_setup:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    8(%ebp), %eax
        movl    %eax, -4(%ebp)
        call    __mach_init
        leave
        ret

Which has a movl 8(%ebp), %eax, just like the one above.  This is related to
the function-within-function.  For example:

extern void __mach_init (void);

void
_hurd_stack_setup (int argc __attribute__ ((unused)), ...)
{
  int *data;
  *--data = (&argc)[-1];
  __mach_init ();
}

Has:

_hurd_stack_setup:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    4(%ebp), %eax
        movl    %eax, -4(%edx)
        call    __mach_init
        leave
        ret

BTW, the corresponding glibc-2.2.4/gcc2.95 code for the above code (function
in function) is

_hurd_stack_setup:
        pushl %ebp
        movl %esp,%ebp
        subl $24,%esp
        leal 8(%ebp),%eax
        movl %eax,-4(%ebp)
        call __mach_init
        leave
        ret

Mmmh.  It does the same derefernce 8(%ebp).  Maybe the code is right and the
problem is even before that?

Thanks,
Marcus


-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]