Blame SOURCES/glibc-rh990388-3.patch

147e83
diff -pruN glibc-2.17-c758a686/nptl/pt-crti.S glibc-2.17-c758a686/nptl/pt-crti.S
147e83
--- glibc-2.17-c758a686/nptl/pt-crti.S	2012-12-25 08:32:13.000000000 +0530
147e83
+++ glibc-2.17-c758a686/nptl/pt-crti.S	2013-07-30 15:53:08.416386853 +0530
147e83
@@ -39,5 +39,6 @@
147e83
 
147e83
 #define PREINIT_FUNCTION __pthread_initialize_minimal_internal
147e83
 #define PREINIT_FUNCTION_WEAK 0
147e83
+#define PREINIT_FUNCTION_HAS_ARGS 1
147e83
 
147e83
 #include <crti.S>
147e83
diff -pruN glibc-2.17-c758a686/sysdeps/i386/crti.S glibc-2.17-c758a686/sysdeps/i386/crti.S
147e83
--- glibc-2.17-c758a686/sysdeps/i386/crti.S	2012-12-25 08:32:13.000000000 +0530
147e83
+++ glibc-2.17-c758a686/sysdeps/i386/crti.S	2013-07-30 16:38:41.085291690 +0530
147e83
@@ -49,6 +49,13 @@
147e83
 # define PREINIT_FUNCTION_WEAK 1
147e83
 #endif
147e83
 
147e83
+/* If the preinit function takes the argc, argv and envp arguments, push them
147e83
+   again on top before making the call.  This is only used by for pt-crti for
147e83
+   nptl.  */
147e83
+#ifndef PREINIT_FUNCTION_HAS_ARGS
147e83
+# define PREINIT_FUNCTION_HAS_ARGS 0
147e83
+#endif
147e83
+
147e83
 #if PREINIT_FUNCTION_WEAK
147e83
 	weak_extern (PREINIT_FUNCTION)
147e83
 #else
147e83
@@ -64,6 +68,18 @@ _init:
147e83
 	/* Maintain 16-byte stack alignment for called functions.  */
147e83
 	subl $8, %esp
147e83
 	LOAD_PIC_REG (bx)
147e83
+#if PREINIT_FUNCTION_HAS_ARGS
147e83
+/* Get argc, argv and envp from the stack and push them again on top so that
147e83
+   the called function can access them.  Maintain 16-byte alignment for value
147e83
+   in %esp for called functions.  */
147e83
+	movl 16(%esp), %eax
147e83
+	movl 20(%esp), %ecx
147e83
+	movl 24(%esp), %edx
147e83
+	subl $4, %esp
147e83
+	pushl %edx
147e83
+	pushl %ecx
147e83
+	pushl %eax
147e83
+#endif
147e83
 #if PREINIT_FUNCTION_WEAK
147e83
 	movl PREINIT_FUNCTION@GOT(%ebx), %eax
147e83
 	testl %eax, %eax
147e83
@@ -73,6 +89,9 @@ _init:
147e83
 #else
147e83
 	call PREINIT_FUNCTION
147e83
 #endif
147e83
+#if PREINIT_FUNCTION_HAS_ARGS
147e83
+	addl $16, %esp
147e83
+#endif
147e83
 
147e83
 	.section .fini,"ax",@progbits
147e83
 	.p2align 2