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

From: Zhangjin Wu
Date: Mon Jul 03 2023 - 06:02:03 EST


Hi, Thomas

>
> 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.
>

I have tried so, but since crt.h itself is not architecture specific, add it
before arch.h will avoid every new arch porting add the same thing again and
again, currently, we only need to add once. I have even planned to move
compiler.h out of arch-*.h, but not yet ;-)

And also, crt.h may require more features in the future, like init/fini
support, it may be not only used by arch-*.h files.

> >
> > Signed-off-by: Zhangjin Wu <falcon@xxxxxxxxxxx>
> > ---
> > 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.
>

Ok, thanks very much.

Best regards,
Zhangjin

> > ctype.h \
> > errno.h \
> > nolibc.h \