Hello! On Sun, Nov 26, 2006 at 11:27:58PM +0100, I wrote: > The patch for glibc follows:
Here is an updated version, ready for inclusion as far as I'm concerned. 2007-07-22 Thomas Schwinge <[EMAIL PROTECTED]> * sysdeps/mach/hurd/i386/init-first.c: Undo parts of Roland's `r 1.43' to `r 1.44' changes. (_hurd_stack_setup): Take a ``void *'' argument. Save the caller into CALLER and pass that one on. (init): Avoid an ugly typecast. Revert Roland patch. (Part of `r 1.44' to 'r 1.43'). #v+ Index: sysdeps/mach/hurd/i386/init-first.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/mach/hurd/i386/init-first.c,v retrieving revision 1.43.4.1 diff -u -p -r1.43.4.1 init-first.c --- sysdeps/mach/hurd/i386/init-first.c 23 Oct 2005 01:00:09 -0000 1.43.4.1 +++ sysdeps/mach/hurd/i386/init-first.c 20 Nov 2006 11:05:47 -0000 @@ -320,11 +320,11 @@ first_init (void) stack set up just as the user will see it, so it can switch stacks. */ void -_dl_init_first (void) +_dl_init_first (int argc, ...) { first_init (); - init ((int *) __builtin_frame_address (0) + 2); + init (&argc); } #endif @@ -351,23 +351,21 @@ strong_alias (posixland_init, __libc_ini This poorly-named function is called by static-start.S, which should not exist at all. */ void -_hurd_stack_setup (void) +_hurd_stack_setup (volatile int argc, ...) { - intptr_t caller = (intptr_t) __builtin_return_address (0); - void doinit (intptr_t *data) { /* This function gets called with the argument data at TOS. */ - void doinit1 (void) + void doinit1 (volatile int argc, ...) { - init ((int *) __builtin_frame_address (0) + 2); + init ((int *) &argc); } /* Push the user return address after the argument data, and then jump to `doinit1' (above), so it is as if __libc_init_first's caller had called `doinit1' with the argument data already on the stack. */ - *--data = caller; + *--data = (&argc)[-1]; asm volatile ("movl %0, %%esp\n" /* Switch to new outermost stack. */ "movl $0, %%ebp\n" /* Clear outermost frame pointer. */ "jmp *%1" : : "r" (data), "r" (&doinit1) : "sp"); @@ -376,7 +374,7 @@ _hurd_stack_setup (void) first_init (); - _hurd_startup ((void **) __builtin_frame_address (0) + 2, &doinit); + _hurd_startup ((void **) &argc, &doinit); } #endif #v- Make the code work with GCC 4.1. This is essentially what Roland had done -- moving the resolution of the return address out of the nested subfunction -- but this time without replacing it with `__builtin_return_address'. #v+ --- sysdeps/mach/hurd/i386/init-first.c 2007-07-22 16:50:03.000000000 +0200 +++ sysdeps/mach/hurd/i386/init-first.c 2007-07-22 18:33:45.540000000 +0200 @@ -350,8 +351,10 @@ This poorly-named function is called by static-start.S, which should not exist at all. */ void -_hurd_stack_setup (volatile int argc, ...) +_hurd_stack_setup (void *arg, ...) { + void *caller = (&arg)[-1]; + void doinit (intptr_t *data) { /* This function gets called with the argument data at TOS. */ @@ -364,7 +367,7 @@ jump to `doinit1' (above), so it is as if __libc_init_first's caller had called `doinit1' with the argument data already on the stack. */ - *--data = (&argc)[-1]; + *--data = (intptr_t) caller; asm volatile ("movl %0, %%esp\n" /* Switch to new outermost stack. */ "movl $0, %%ebp\n" /* Clear outermost frame pointer. */ "jmp *%1" : : "r" (data), "r" (&doinit1) : "sp"); @@ -373,7 +376,7 @@ first_init (); - _hurd_startup ((void **) &argc, &doinit); + _hurd_startup (&arg, &doinit); } #endif #v- Cosmetical and documentation fixes. #v+ Index: sysdeps/mach/hurd/i386/init-first.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/mach/hurd/i386/init-first.c,v retrieving revision 1.43.4.1 diff -u -p -r1.43.4.1 init-first.c --- sysdeps/mach/hurd/i386/init-first.c 23 Oct 2005 01:00:09 -0000 1.43.4.1 +++ sysdeps/mach/hurd/i386/init-first.c 20 Nov 2006 11:05:47 -0000 @@ -1,6 +1,7 @@ /* Initialization code run first thing by the ELF startup code. For i386/Hurd. - Copyright (C) 1995,96,97,98,99,2000,01,02,03,04,05 - Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -243,8 +243,8 @@ init (int *data) be the return address for `init1'; we will jump there with NEWSP as the stack pointer. */ *--newsp = data[-1]; - ((void **) data)[-1] = switch_stacks; - /* Force NEWSP into %ecx and &init1 into %eax, which are not restored + data[-1] = (int) &switch_stacks; + /* Force NEWSP into %eax and &init1 into %ecx, which are not restored by function return. */ asm volatile ("# a %0 c %1" : : "a" (newsp), "c" (&init1)); } #v- Regards, Thomas
signature.asc
Description: Digital signature
_______________________________________________ Bug-hurd mailing list Bug-hurd@gnu.org http://lists.gnu.org/mailman/listinfo/bug-hurd