mescc: Mes C Library: Support make: Support main with envp.

* lib/linux/x86-mes-gcc/crt1.c (_start): Also push envp.
* lib/linux/x86-mes/crt1.c (_start): Also push envp.
* lib/linux/x86_64-mes-gcc/crt1.c (_start): Also mov environment,%rdx.
This commit is contained in:
Jan Nieuwenhuizen 2018-08-26 23:39:43 +02:00
parent 8b9d51e4a4
commit 2fe2e556e8
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
3 changed files with 5 additions and 2 deletions

View File

@ -19,7 +19,7 @@
*/
char **environ = 0;
int main (int argc, char *argv[]);
int main (int argc, char *argv[], char *envp[]);
void
_start ()
@ -32,6 +32,7 @@ _start ()
"shl $2,%%eax\n\t"
"add %%ebp,%%eax\n\t"
"mov %%eax,%0\n\t"
"push %%eax\n\t"
: "=r" (environ)
: //no inputs ""
);

View File

@ -19,7 +19,7 @@
*/
char **environ = 0;
int main (int argc, char *argv[]);
int main (int argc, char *argv[], char *envp[]);
int
_start ()
@ -33,6 +33,7 @@ _start ()
asm ("shl____$i8,%eax !0x02");
asm ("add____%ebp,%eax");
asm ("mov____%eax,0x32 &environ");
asm ("push___%eax");
asm ("mov____%ebp,%eax");
asm ("add____$i8,%eax !8");

View File

@ -35,6 +35,7 @@ _start ()
"shl $3,%%rax\n\t"
"add %%rbp,%%rax\n\t"
"mov %%rax,%0\n\t"
"mov %%rax,%%rdx\n\t"
: "=r" (environ)
: //no inputs ""
);