Browse Source

Correct passing envp to main

git-svn-id: trunk@20288 -
pierre 13 years ago
parent
commit
d9249ab44d
1 changed files with 5 additions and 1 deletions
  1. 5 1
      rtl/netbsd/i386/cprt0.as

+ 5 - 1
rtl/netbsd/i386/cprt0.as

@@ -63,6 +63,7 @@ __start:
 	pushl	%ecx
 	pushl	%edx
 	pushl	%eax
+	movl	%ecx,operatingsystem_parameter_envp
 	movl	%eax,operatingsystem_parameter_argc
 	movl	%edx,operatingsystem_parameter_argv
 	call	___start
@@ -87,7 +88,6 @@ ___start:
 	movl 28(%ebp),%edi
 	movl environ@GOT(%ebx),%eax
 	movl %edx,(%eax)
-	movl %edx,operatingsystem_parameter_envp
 	movl __progname@GOT(%ebx),%edx
 	movl (%esi),%eax
 	movl %eax,(%edx)
@@ -140,6 +140,7 @@ ___start:
 
 //        xorl    %ebp,%ebp               /* Detect main from nested */
                                         /* procs/unwinding? */
+        movl operatingsystem_parameter_envp, %eax
 	pushl (%eax)
 	pushl (%esi)
 	pushl 8(%ebp)
@@ -420,6 +421,9 @@ _dladdr:
 .Lfe8:
 	.size	 _dladdr,.Lfe8-_dladdr
 	.comm	environ,4,4
+        .comm operatingsystem_parameter_envp,4,4
+        .comm operatingsystem_parameter_argc,4,4
+        .comm operatingsystem_parameter_argv,4,4
 	.comm	__mainprog_obj,4,4