[PATCH v1 03/11] tools/nolibc: include crt.h before arch.h

Thomas Weißschuh thomas at t-8ch.de
Sun Jul 2 11:57:09 PDT 2023


On 2023-06-29 02:54:35+0800, Zhangjin Wu wrote:
> The crt.h provides a new _start_c() function, which is required by the
> new assembly _start entry of arch-<ARCH>.h (included by arch.h), let's
> include crt.h before arch.h.
> 
> This '#include "crt.h"' doesn't let the new _start_c() work immediately,
> but it is a base of the coming patches to move most of the assembly
> _start operations to the _start_c() function for every supported
> architecture.

Why don't the arch-*.h files include this new header?
They are the users of the new symbol.

> 
> Signed-off-by: Zhangjin Wu <falcon at tinylab.org>
> ---
>  tools/include/nolibc/Makefile | 1 +
>  tools/include/nolibc/nolibc.h | 1 +
>  tools/include/nolibc/signal.h | 1 +
>  tools/include/nolibc/stdio.h  | 1 +
>  tools/include/nolibc/stdlib.h | 1 +
>  tools/include/nolibc/sys.h    | 1 +
>  tools/include/nolibc/time.h   | 1 +
>  tools/include/nolibc/unistd.h | 1 +
>  8 files changed, 8 insertions(+)
> 
> diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
> index 875e13e3c851..00471e59b11e 100644
> --- a/tools/include/nolibc/Makefile
> +++ b/tools/include/nolibc/Makefile
> @@ -37,6 +37,7 @@ NARCH            = $(or $(NARCH_$(ARCH)),$(ARCH))
>  arch_file := arch-$(NARCH).h
>  all_files := \
>  		compiler.h \
> +		crt.h \

This should be part of the patch adding the file.

>  		ctype.h \
>  		errno.h \
>  		nolibc.h \
> diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
> index 1f8d821000ac..2cc9ccd90d56 100644
> --- a/tools/include/nolibc/nolibc.h
> +++ b/tools/include/nolibc/nolibc.h
> @@ -93,6 +93,7 @@
>  #define _NOLIBC_H
>  
>  #include "std.h"
> +#include "crt.h"
>  #include "arch.h"
>  #include "types.h"
>  #include "sys.h"
> diff --git a/tools/include/nolibc/signal.h b/tools/include/nolibc/signal.h
> index 137552216e46..f0a1418c1cb2 100644
> --- a/tools/include/nolibc/signal.h
> +++ b/tools/include/nolibc/signal.h
> @@ -8,6 +8,7 @@
>  #define _NOLIBC_SIGNAL_H
>  
>  #include "std.h"
> +#include "crt.h"
>  #include "arch.h"
>  #include "types.h"
>  #include "sys.h"
> diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h
> index 0eef91daf289..89d3749b3620 100644
> --- a/tools/include/nolibc/stdio.h
> +++ b/tools/include/nolibc/stdio.h
> @@ -10,6 +10,7 @@
>  #include <stdarg.h>
>  
>  #include "std.h"
> +#include "crt.h"
>  #include "arch.h"
>  #include "errno.h"
>  #include "types.h"
> diff --git a/tools/include/nolibc/stdlib.h b/tools/include/nolibc/stdlib.h
> index 902162f80337..0ff7fac40bd4 100644
> --- a/tools/include/nolibc/stdlib.h
> +++ b/tools/include/nolibc/stdlib.h
> @@ -8,6 +8,7 @@
>  #define _NOLIBC_STDLIB_H
>  
>  #include "std.h"
> +#include "crt.h"
>  #include "arch.h"
>  #include "types.h"
>  #include "sys.h"
> diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
> index 2c302f3feb71..b6c33c40c037 100644
> --- a/tools/include/nolibc/sys.h
> +++ b/tools/include/nolibc/sys.h
> @@ -24,6 +24,7 @@
>  #include <linux/reboot.h> /* for LINUX_REBOOT_* */
>  #include <linux/prctl.h>
>  
> +#include "crt.h"
>  #include "arch.h"
>  #include "errno.h"
>  #include "types.h"
> diff --git a/tools/include/nolibc/time.h b/tools/include/nolibc/time.h
> index 84655361b9ad..bbe8f9aa3e9b 100644
> --- a/tools/include/nolibc/time.h
> +++ b/tools/include/nolibc/time.h
> @@ -8,6 +8,7 @@
>  #define _NOLIBC_TIME_H
>  
>  #include "std.h"
> +#include "crt.h"
>  #include "arch.h"
>  #include "types.h"
>  #include "sys.h"
> diff --git a/tools/include/nolibc/unistd.h b/tools/include/nolibc/unistd.h
> index e38f3660c051..f1677224bb5a 100644
> --- a/tools/include/nolibc/unistd.h
> +++ b/tools/include/nolibc/unistd.h
> @@ -8,6 +8,7 @@
>  #define _NOLIBC_UNISTD_H
>  
>  #include "std.h"
> +#include "crt.h"
>  #include "arch.h"
>  #include "types.h"
>  #include "sys.h"
> -- 
> 2.25.1
> 



More information about the linux-riscv mailing list