This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
MIPS n64 stack alignment fix
- From: Daniel Jacobowitz <drow at false dot org>
- To: libc-alpha at sourceware dot org
- Cc: Andreas Jaeger <aj at suse dot de>
- Date: Sun, 29 Jan 2006 11:07:24 -0500
- Subject: MIPS n64 stack alignment fix
The MIPS startup code carefully realigns the stack to the size of a register
(32-bit on o32, 64-bit otherwise), but then uses PTR_S with an offset of 4
modulo 8. There's already enough room on the stack; it should be SZREG.
--
Daniel Jacobowitz
CodeSourcery
2006-01-29 Daniel Jacobowitz <dan@codesourcery.com>
* sysdeps/mips/dl-machine.h (RTLD_START): Correct offsets for
N64.
Index: libc/sysdeps/mips/dl-machine.h
===================================================================
--- libc.orig/sysdeps/mips/dl-machine.h 2006-01-29 10:51:36.000000000 -0500
+++ libc/sysdeps/mips/dl-machine.h 2006-01-29 10:51:44.000000000 -0500
@@ -266,13 +266,13 @@ do { \
" STRINGXP(PTR_ADDU) " $7, $7, " STRINGXP (PTRSIZE) " \n\
# Make sure the stack pointer is aligned for _dl_init_internal.\n\
and $2, $29, -2 * " STRINGXP(SZREG) "\n\
- " STRINGXP(PTR_S) " $29, -4($2)\n\
+ " STRINGXP(PTR_S) " $29, -" STRINGXP(SZREG) "($2)\n\
" STRINGXP(PTR_SUBIU) " $29, $2, 32\n\
" STRINGXP(SAVE_GP(16)) "\n\
# Call the function to run the initializers.\n\
jal _dl_init_internal\n\
# Restore the stack pointer for _start.\n\
- " STRINGXP(PTR_L) " $29, 28($29)\n\
+ " STRINGXP(PTR_L) " $29, 32-" STRINGXP(SZREG) "($29)\n\
# Pass our finalizer function to the user in $2 as per ELF ABI.\n\
" STRINGXP(PTR_LA) " $2, _dl_fini\n\
# Jump to the user entry point.\n\