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