From 4a0bb97d70c2ece55476c791b2fda8014af9e4d4 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Sun, 27 Aug 2023 12:53:37 +0200 Subject: [PATCH] Revert "crt1: Move main declaration to mes/lib-mini.h." This reverts commit 5b55627e0ccf7c798284a380a20a2eb4d6b9c4c0. --- include/mes/lib-mini.h | 2 -- lib/freebsd/x86-mes-gcc/crt1.c | 1 + lib/freebsd/x86-mes-mescc/crt1.c | 1 + lib/gnu/x86-mes-gcc/crt1.c | 2 +- lib/linux/arm-mes-gcc/crt1.c | 1 + lib/linux/arm-mes-m2/crt1.c | 1 + lib/linux/arm-mes-mescc/crt1.c | 1 + lib/linux/riscv64-mes-gcc/crt1.c | 1 + lib/linux/riscv64-mes-m2/crt1.c | 1 + lib/linux/riscv64-mes-mescc/crt1.c | 3 ++- lib/linux/x86-mes-gcc/crt1.c | 1 + lib/linux/x86-mes-m2/crt1.c | 1 + lib/linux/x86-mes-mescc/crt1.c | 1 + lib/linux/x86_64-mes-gcc/crt0.c | 1 + lib/linux/x86_64-mes-gcc/crt1.c | 1 + lib/linux/x86_64-mes-m2/crt1.c | 1 + lib/linux/x86_64-mes-mescc/crt1.c | 1 + 17 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/mes/lib-mini.h b/include/mes/lib-mini.h index c64f93d4..d02751d2 100644 --- a/include/mes/lib-mini.h +++ b/include/mes/lib-mini.h @@ -52,8 +52,6 @@ extern int __stdout; extern int __stderr; void __init_io (); -int main (int argc, char *argv[], char *envp[]); - int eputs (char const *s); int puts (char const *s); int oputs (char const *s); diff --git a/lib/freebsd/x86-mes-gcc/crt1.c b/lib/freebsd/x86-mes-gcc/crt1.c index abb91367..f282fbf2 100644 --- a/lib/freebsd/x86-mes-gcc/crt1.c +++ b/lib/freebsd/x86-mes-gcc/crt1.c @@ -19,6 +19,7 @@ */ #include +int main (int argc, char *argv[], char *envp[]); // *INDENT-OFF* void diff --git a/lib/freebsd/x86-mes-mescc/crt1.c b/lib/freebsd/x86-mes-mescc/crt1.c index d984cbc2..cb2ea878 100644 --- a/lib/freebsd/x86-mes-mescc/crt1.c +++ b/lib/freebsd/x86-mes-mescc/crt1.c @@ -19,6 +19,7 @@ */ #include "mes/lib-mini.h" +int main (int argc, char *argv[], char *envp[]); int _start () diff --git a/lib/gnu/x86-mes-gcc/crt1.c b/lib/gnu/x86-mes-gcc/crt1.c index 895e28e9..3138e33f 100644 --- a/lib/gnu/x86-mes-gcc/crt1.c +++ b/lib/gnu/x86-mes-gcc/crt1.c @@ -18,8 +18,8 @@ * along with Mes. If not, see . */ -#include #include +int main (int argc, char *argv[], char *envp[]); char **environ; int __stdin; diff --git a/lib/linux/arm-mes-gcc/crt1.c b/lib/linux/arm-mes-gcc/crt1.c index c2ac5c76..134057ae 100644 --- a/lib/linux/arm-mes-gcc/crt1.c +++ b/lib/linux/arm-mes-gcc/crt1.c @@ -20,6 +20,7 @@ */ #include +int main (int argc, char *argv[], char *envp[]); /* Note: GCC automatically emits a preable in order to set up the frame pointer: "push {fp}" "add fp, sp, 0" diff --git a/lib/linux/arm-mes-m2/crt1.c b/lib/linux/arm-mes-m2/crt1.c index 2a627618..1f8fb0ab 100644 --- a/lib/linux/arm-mes-m2/crt1.c +++ b/lib/linux/arm-mes-m2/crt1.c @@ -24,6 +24,7 @@ int __stdin; int __stdout; int __stderr; char **environ; +int main (int argc, char **argv, char **envp); /* FIXME: this is going to be called `FUNCTION__start' */ //#int diff --git a/lib/linux/arm-mes-mescc/crt1.c b/lib/linux/arm-mes-mescc/crt1.c index 841c5598..8576e3ec 100644 --- a/lib/linux/arm-mes-mescc/crt1.c +++ b/lib/linux/arm-mes-mescc/crt1.c @@ -20,6 +20,7 @@ */ #include "mes/lib-mini.h" +int main (int argc, char *argv[], char *envp[]); void /* must not return */ _start () diff --git a/lib/linux/riscv64-mes-gcc/crt1.c b/lib/linux/riscv64-mes-gcc/crt1.c index 0f85dad1..3f3d7ce8 100644 --- a/lib/linux/riscv64-mes-gcc/crt1.c +++ b/lib/linux/riscv64-mes-gcc/crt1.c @@ -21,6 +21,7 @@ */ #include +int main (int argc, char *argv[], char *envp[]); /* gcc will generate the following preamble: diff --git a/lib/linux/riscv64-mes-m2/crt1.c b/lib/linux/riscv64-mes-m2/crt1.c index d808d1b9..da4c4824 100644 --- a/lib/linux/riscv64-mes-m2/crt1.c +++ b/lib/linux/riscv64-mes-m2/crt1.c @@ -24,6 +24,7 @@ int __stdin; int __stdout; int __stderr; char **environ; +int main (int argc, char **argv, char **envp); /* FIXME: this is going to be called `FUNCTION__start' */ //#int diff --git a/lib/linux/riscv64-mes-mescc/crt1.c b/lib/linux/riscv64-mes-mescc/crt1.c index 6bc94b70..dc9c222e 100644 --- a/lib/linux/riscv64-mes-mescc/crt1.c +++ b/lib/linux/riscv64-mes-mescc/crt1.c @@ -21,9 +21,10 @@ */ #include "mes/lib-mini.h" -int main (int argc, char *argv[], char *envp[]); #include "linux/riscv64/syscall.h" +int main (int argc, char *argv[], char *envp[]); + /* mesc will generate the following preamble: push ra diff --git a/lib/linux/x86-mes-gcc/crt1.c b/lib/linux/x86-mes-gcc/crt1.c index 65368e2a..7c5ba6f8 100644 --- a/lib/linux/x86-mes-gcc/crt1.c +++ b/lib/linux/x86-mes-gcc/crt1.c @@ -20,6 +20,7 @@ */ #include +int main (int argc, char *argv[], char *envp[]); // *INDENT-OFF* void diff --git a/lib/linux/x86-mes-m2/crt1.c b/lib/linux/x86-mes-m2/crt1.c index 2a627618..1f8fb0ab 100644 --- a/lib/linux/x86-mes-m2/crt1.c +++ b/lib/linux/x86-mes-m2/crt1.c @@ -24,6 +24,7 @@ int __stdin; int __stdout; int __stderr; char **environ; +int main (int argc, char **argv, char **envp); /* FIXME: this is going to be called `FUNCTION__start' */ //#int diff --git a/lib/linux/x86-mes-mescc/crt1.c b/lib/linux/x86-mes-mescc/crt1.c index aaf28e11..a184e99c 100644 --- a/lib/linux/x86-mes-mescc/crt1.c +++ b/lib/linux/x86-mes-mescc/crt1.c @@ -19,6 +19,7 @@ */ #include "mes/lib-mini.h" +int main (int argc, char *argv[], char *envp[]); int _start () diff --git a/lib/linux/x86_64-mes-gcc/crt0.c b/lib/linux/x86_64-mes-gcc/crt0.c index 1d10d0e0..d27db794 100644 --- a/lib/linux/x86_64-mes-gcc/crt0.c +++ b/lib/linux/x86_64-mes-gcc/crt0.c @@ -24,6 +24,7 @@ // let's try _main first #include +int main (int argc, char *argv[], char *envp[]); // gcc x86_64 calling convention: // rdi, rsi, rdx, rcx, r8, r9, , diff --git a/lib/linux/x86_64-mes-gcc/crt1.c b/lib/linux/x86_64-mes-gcc/crt1.c index d5b825db..a12603d6 100644 --- a/lib/linux/x86_64-mes-gcc/crt1.c +++ b/lib/linux/x86_64-mes-gcc/crt1.c @@ -19,6 +19,7 @@ */ #include +int main (int argc, char *argv[], char *envp[]); // gcc x86_64 calling convention: // rdi, rsi, rdx, rcx, r8, r9, , diff --git a/lib/linux/x86_64-mes-m2/crt1.c b/lib/linux/x86_64-mes-m2/crt1.c index d808d1b9..da4c4824 100644 --- a/lib/linux/x86_64-mes-m2/crt1.c +++ b/lib/linux/x86_64-mes-m2/crt1.c @@ -24,6 +24,7 @@ int __stdin; int __stdout; int __stderr; char **environ; +int main (int argc, char **argv, char **envp); /* FIXME: this is going to be called `FUNCTION__start' */ //#int diff --git a/lib/linux/x86_64-mes-mescc/crt1.c b/lib/linux/x86_64-mes-mescc/crt1.c index 6a66b95e..0d66039f 100644 --- a/lib/linux/x86_64-mes-mescc/crt1.c +++ b/lib/linux/x86_64-mes-mescc/crt1.c @@ -19,6 +19,7 @@ */ #include "mes/lib-mini.h" +int main (int argc, char *argv[], char *envp[]); int _start ()