From be184b1d265431c975332eea4047d3a69f7e9f57 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 22 Jan 2005 07:55:35 +0000 Subject: Update. 2005-01-21 Jakub Jelinek * elf/Makefile: Add rules to build and run tst-align2. * elf/tst-align2.c: New test. * elf/tst-alignmod2.c: New file. * sysdeps/powerpc/tst-stack-align.h: New file. * sysdeps/i386/dl-machine.h (RTLD_START): Align stack and clear frame pointer before calling _dl_init. * sysdeps/x86_64/dl-machine.h (RTLD_START): Likewise. --- sysdeps/i386/dl-machine.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sysdeps/i386/dl-machine.h') diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index e1cc10e9cc..b7fd448ef6 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. i386 version. - Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2003, 2004, 2005 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 @@ -215,11 +215,21 @@ _dl_start_user:\n\ movl _rtld_local@GOTOFF(%ebx), %eax\n\ leal 8(%esp,%edx,4), %esi\n\ leal 4(%esp), %ecx\n\ + movl %esp, %ebp\n\ + # Make sure _dl_init is run with 16 byte aligned stack.\n\ + andl $-16, %esp\n\ + pushl %eax\n\ + pushl %eax\n\ + pushl %ebp\n\ pushl %esi\n\ + # Clear %ebp, so that even constructors have terminated backchain.\n\ + xorl %ebp, %ebp\n\ # Call the function to run the initializers.\n\ call _dl_init_internal@PLT\n\ # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\ leal _dl_fini@GOTOFF(%ebx), %edx\n\ + # Restore %esp _start expects.\n\ + movl (%esp), %esp\n\ # Jump to the user's entry point.\n\ jmp *%edi\n\ .previous\n\ -- cgit v1.2.3