All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhangjin Wu <falcon@tinylab.org>
To: w@1wt.eu
Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, thomas@t-8ch.de
Subject: [PATCH v2 01/12] tools/nolibc: rename arch-<ARCH>.h to <ARCH>/arch.h
Date: Sat,  8 Jul 2023 23:26:42 +0800	[thread overview]
Message-ID: <ef34ee3cc8cb0e4f8ce7c7c9975a0e8d14473a84.1688828139.git.falcon@tinylab.org> (raw)
In-Reply-To: <cover.1688828139.git.falcon@tinylab.org>

Currently, the architecture specific arch.h has two parts, one is the
syscall declarations for sys.h, another is the _start code definition
for startup support.

The coming crt.h will provide the startup support with a new common
_start_c(), it will replace most of the assembly _start code and shrink
the original _start code to be minimal, as a result, _start_c() and the
left minimal _start code will work together to provide the startup
support, therefore, the left _start code will be only required by crt.h.

So, the syscall declarations part of arch.h can be split to sys_arch.h
and the _start code part of arch.h can be split to crt_arch.h and then,
they should only be included in sys.h and crt.h respectively.

At the same time, the architecture specific arch-<ARCH>.h should be
split to <ARCH>/crt.h and <ARCH>/sys.h.

As a preparation, this creates the architecture specific directory and
moves tools/include/nolibc/arch-<ARCH>.h to
tools/include/nolibc/<ARCH>/arch.h.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
 tools/include/nolibc/Makefile                    | 10 +++++-----
 .../nolibc/{arch-aarch64.h => aarch64/arch.h}    |  6 +++---
 tools/include/nolibc/arch.h                      | 16 ++++++++--------
 tools/include/nolibc/{arch-arm.h => arm/arch.h}  |  6 +++---
 .../include/nolibc/{arch-i386.h => i386/arch.h}  |  6 +++---
 .../{arch-loongarch.h => loongarch/arch.h}       |  6 +++---
 .../include/nolibc/{arch-mips.h => mips/arch.h}  |  6 +++---
 .../nolibc/{arch-riscv.h => riscv/arch.h}        |  6 +++---
 .../include/nolibc/{arch-s390.h => s390/arch.h}  |  6 +++---
 .../nolibc/{arch-x86_64.h => x86_64/arch.h}      |  6 +++---
 10 files changed, 37 insertions(+), 37 deletions(-)
 rename tools/include/nolibc/{arch-aarch64.h => aarch64/arch.h} (99%)
 rename tools/include/nolibc/{arch-arm.h => arm/arch.h} (99%)
 rename tools/include/nolibc/{arch-i386.h => i386/arch.h} (99%)
 rename tools/include/nolibc/{arch-loongarch.h => loongarch/arch.h} (99%)
 rename tools/include/nolibc/{arch-mips.h => mips/arch.h} (99%)
 rename tools/include/nolibc/{arch-riscv.h => riscv/arch.h} (99%)
 rename tools/include/nolibc/{arch-s390.h => s390/arch.h} (98%)
 rename tools/include/nolibc/{arch-x86_64.h => x86_64/arch.h} (99%)

diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index 64d67b080744..ce21ace8210e 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -24,7 +24,7 @@ Q=@
 endif
 
 nolibc_arch := $(patsubst arm64,aarch64,$(ARCH))
-arch_file := arch-$(nolibc_arch).h
+arch_file := $(nolibc_arch)/arch.h
 all_files := \
 		compiler.h \
 		ctype.h \
@@ -70,11 +70,11 @@ headers:
 	$(Q)cp $(all_files) $(OUTPUT)sysroot/include/
 	$(Q)if [ "$(ARCH)" = "x86" ]; then      \
 		sed -e                          \
-		  's,^#ifndef _NOLIBC_ARCH_X86_64_H,#if !defined(_NOLIBC_ARCH_X86_64_H) \&\& defined(__x86_64__),' \
-		  arch-x86_64.h;                \
+		  's,^#ifndef _NOLIBC_X86_64_ARCH_H,#if !defined(_NOLIBC_X86_64_ARCH_H) \&\& defined(__x86_64__),' \
+		  x86_64/arch.h;                \
 		sed -e                          \
-		  's,^#ifndef _NOLIBC_ARCH_I386_H,#if !defined(_NOLIBC_ARCH_I386_H) \&\& !defined(__x86_64__),' \
-		  arch-i386.h;                  \
+		  's,^#ifndef _NOLIBC_I386_ARCH_H,#if !defined(_NOLIBC_I386_ARCH_H) \&\& !defined(__x86_64__),' \
+		  i386/arch.h;                  \
 	elif [ -e "$(arch_file)" ]; then        \
 		cat $(arch_file);               \
 	else                                    \
diff --git a/tools/include/nolibc/arch-aarch64.h b/tools/include/nolibc/aarch64/arch.h
similarity index 99%
rename from tools/include/nolibc/arch-aarch64.h
rename to tools/include/nolibc/aarch64/arch.h
index 6227b77a4a09..7d38da13c72b 100644
--- a/tools/include/nolibc/arch-aarch64.h
+++ b/tools/include/nolibc/aarch64/arch.h
@@ -4,8 +4,8 @@
  * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
  */
 
-#ifndef _NOLIBC_ARCH_AARCH64_H
-#define _NOLIBC_ARCH_AARCH64_H
+#ifndef _NOLIBC_AARCH64_ARCH_H
+#define _NOLIBC_AARCH64_ARCH_H
 
 #include "compiler.h"
 
@@ -201,4 +201,4 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __no_stack_pr
 	);
 	__builtin_unreachable();
 }
-#endif /* _NOLIBC_ARCH_AARCH64_H */
+#endif /* _NOLIBC_AARCH64_ARCH_H */
diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h
index 82b43935650f..f98616f5b219 100644
--- a/tools/include/nolibc/arch.h
+++ b/tools/include/nolibc/arch.h
@@ -16,21 +16,21 @@
 #define _NOLIBC_ARCH_H
 
 #if defined(__x86_64__)
-#include "arch-x86_64.h"
+#include "x86_64/arch.h"
 #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
-#include "arch-i386.h"
+#include "i386/arch.h"
 #elif defined(__ARM_EABI__)
-#include "arch-arm.h"
+#include "arm/arch.h"
 #elif defined(__aarch64__)
-#include "arch-aarch64.h"
+#include "aarch64/arch.h"
 #elif defined(__mips__) && defined(_ABIO32)
-#include "arch-mips.h"
+#include "mips/arch.h"
 #elif defined(__riscv)
-#include "arch-riscv.h"
+#include "riscv/arch.h"
 #elif defined(__s390x__)
-#include "arch-s390.h"
+#include "s390/arch.h"
 #elif defined(__loongarch__)
-#include "arch-loongarch.h"
+#include "loongarch/arch.h"
 #endif
 
 #endif /* _NOLIBC_ARCH_H */
diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc/arm/arch.h
similarity index 99%
rename from tools/include/nolibc/arch-arm.h
rename to tools/include/nolibc/arm/arch.h
index 4d4887a5f04b..473d2c000740 100644
--- a/tools/include/nolibc/arch-arm.h
+++ b/tools/include/nolibc/arm/arch.h
@@ -4,8 +4,8 @@
  * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
  */
 
-#ifndef _NOLIBC_ARCH_ARM_H
-#define _NOLIBC_ARCH_ARM_H
+#ifndef _NOLIBC_ARM_ARCH_H
+#define _NOLIBC_ARM_ARCH_H
 
 #include "compiler.h"
 
@@ -267,4 +267,4 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __no_stack_pr
 	__builtin_unreachable();
 }
 
-#endif /* _NOLIBC_ARCH_ARM_H */
+#endif /* _NOLIBC_ARM_ARCH_H */
diff --git a/tools/include/nolibc/arch-i386.h b/tools/include/nolibc/i386/arch.h
similarity index 99%
rename from tools/include/nolibc/arch-i386.h
rename to tools/include/nolibc/i386/arch.h
index 4c6b7c04e2e7..66052742763e 100644
--- a/tools/include/nolibc/arch-i386.h
+++ b/tools/include/nolibc/i386/arch.h
@@ -4,8 +4,8 @@
  * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
  */
 
-#ifndef _NOLIBC_ARCH_I386_H
-#define _NOLIBC_ARCH_I386_H
+#ifndef _NOLIBC_I386_ARCH_H
+#define _NOLIBC_I386_ARCH_H
 
 #include "compiler.h"
 
@@ -221,4 +221,4 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __no_stack_pr
 	__builtin_unreachable();
 }
 
-#endif /* _NOLIBC_ARCH_I386_H */
+#endif /* _NOLIBC_I386_ARCH_H */
diff --git a/tools/include/nolibc/arch-loongarch.h b/tools/include/nolibc/loongarch/arch.h
similarity index 99%
rename from tools/include/nolibc/arch-loongarch.h
rename to tools/include/nolibc/loongarch/arch.h
index 8aa7724fe38e..63fee1e8f4d9 100644
--- a/tools/include/nolibc/arch-loongarch.h
+++ b/tools/include/nolibc/loongarch/arch.h
@@ -4,8 +4,8 @@
  * Copyright (C) 2023 Loongson Technology Corporation Limited
  */
 
-#ifndef _NOLIBC_ARCH_LOONGARCH_H
-#define _NOLIBC_ARCH_LOONGARCH_H
+#ifndef _NOLIBC_LOONGARCH_ARCH_H
+#define _NOLIBC_LOONGARCH_ARCH_H
 
 #include "compiler.h"
 
@@ -197,4 +197,4 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __no_stack_pr
 	__builtin_unreachable();
 }
 
-#endif /* _NOLIBC_ARCH_LOONGARCH_H */
+#endif /* _NOLIBC_LOONGARCH_ARCH_H */
diff --git a/tools/include/nolibc/arch-mips.h b/tools/include/nolibc/mips/arch.h
similarity index 99%
rename from tools/include/nolibc/arch-mips.h
rename to tools/include/nolibc/mips/arch.h
index a2bfdf57b957..1581b721b714 100644
--- a/tools/include/nolibc/arch-mips.h
+++ b/tools/include/nolibc/mips/arch.h
@@ -4,8 +4,8 @@
  * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
  */
 
-#ifndef _NOLIBC_ARCH_MIPS_H
-#define _NOLIBC_ARCH_MIPS_H
+#ifndef _NOLIBC_MIPS_ARCH_H
+#define _NOLIBC_MIPS_ARCH_H
 
 #include "compiler.h"
 
@@ -250,4 +250,4 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __no_stack_pr
 	__builtin_unreachable();
 }
 
-#endif /* _NOLIBC_ARCH_MIPS_H */
+#endif /* _NOLIBC_MIPS_ARCH_H */
diff --git a/tools/include/nolibc/arch-riscv.h b/tools/include/nolibc/riscv/arch.h
similarity index 99%
rename from tools/include/nolibc/arch-riscv.h
rename to tools/include/nolibc/riscv/arch.h
index cd958b2f4b1b..de68759f5959 100644
--- a/tools/include/nolibc/arch-riscv.h
+++ b/tools/include/nolibc/riscv/arch.h
@@ -4,8 +4,8 @@
  * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
  */
 
-#ifndef _NOLIBC_ARCH_RISCV_H
-#define _NOLIBC_ARCH_RISCV_H
+#ifndef _NOLIBC_RISCV_ARCH_H
+#define _NOLIBC_RISCV_ARCH_H
 
 #include "compiler.h"
 
@@ -214,4 +214,4 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __no_stack_pr
 	__builtin_unreachable();
 }
 
-#endif /* _NOLIBC_ARCH_RISCV_H */
+#endif /* _NOLIBC_RISCV_ARCH_H */
diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/s390/arch.h
similarity index 98%
rename from tools/include/nolibc/arch-s390.h
rename to tools/include/nolibc/s390/arch.h
index a644ecd361c0..a7b512e81234 100644
--- a/tools/include/nolibc/arch-s390.h
+++ b/tools/include/nolibc/s390/arch.h
@@ -3,8 +3,8 @@
  * s390 specific definitions for NOLIBC
  */
 
-#ifndef _NOLIBC_ARCH_S390_H
-#define _NOLIBC_ARCH_S390_H
+#ifndef _NOLIBC_S390_ARCH_H
+#define _NOLIBC_S390_ARCH_H
 #include <asm/signal.h>
 #include <asm/unistd.h>
 
@@ -234,4 +234,4 @@ pid_t sys_fork(void)
 }
 #define sys_fork sys_fork
 
-#endif /* _NOLIBC_ARCH_S390_H */
+#endif /* _NOLIBC_S390_ARCH_H */
diff --git a/tools/include/nolibc/arch-x86_64.h b/tools/include/nolibc/x86_64/arch.h
similarity index 99%
rename from tools/include/nolibc/arch-x86_64.h
rename to tools/include/nolibc/x86_64/arch.h
index e69113742a99..602791c3461a 100644
--- a/tools/include/nolibc/arch-x86_64.h
+++ b/tools/include/nolibc/x86_64/arch.h
@@ -4,8 +4,8 @@
  * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
  */
 
-#ifndef _NOLIBC_ARCH_X86_64_H
-#define _NOLIBC_ARCH_X86_64_H
+#ifndef _NOLIBC_X86_64_ARCH_H
+#define _NOLIBC_X86_64_ARCH_H
 
 #include "compiler.h"
 
@@ -217,4 +217,4 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __no_stack_pr
 	__builtin_unreachable();
 }
 
-#endif /* _NOLIBC_ARCH_X86_64_H */
+#endif /* _NOLIBC_X86_64_ARCH_H */
-- 
2.25.1


  reply	other threads:[~2023-07-08 15:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-08 15:25 [PATCH v2 00/12] tools/nolibc: shrink arch support Zhangjin Wu
2023-07-08 15:26 ` Zhangjin Wu [this message]
2023-07-09  9:56   ` [PATCH v2 01/12] tools/nolibc: rename arch-<ARCH>.h to <ARCH>/arch.h Willy Tarreau
2023-07-10  7:23     ` Zhangjin Wu
2023-07-10 15:51       ` Thomas Weißschuh
2023-07-11  7:41         ` Willy Tarreau
2023-07-11 16:38           ` Zhangjin Wu
2023-07-11 19:28             ` Willy Tarreau
2023-07-08 15:27 ` [PATCH v2 02/12] tools/nolibc: split arch.h to crt.h and sys.h Zhangjin Wu
2023-07-08 15:28 ` [PATCH v2 03/12] tools/nolibc: sys.h: remove the old sys_stat support Zhangjin Wu
2023-07-08 15:29 ` [PATCH v2 04/12] tools/nolibc: crt.h: add _start_c Zhangjin Wu
2023-07-09 18:49   ` Thomas Weißschuh
2023-07-09 21:00     ` Thomas Weißschuh
2023-07-10  9:26     ` Zhangjin Wu
2023-07-10 15:24       ` Thomas Weißschuh
2023-07-10 16:45         ` Zhangjin Wu
2023-07-08 15:31 ` [PATCH v2 05/12] tools/nolibc: arm/crt.h: shrink _start with _start_c Zhangjin Wu
2023-07-08 15:32 ` [PATCH v2 06/12] tools/nolibc: aarch64/crt.h: " Zhangjin Wu
2023-07-08 15:33 ` [PATCH v2 07/12] tools/nolibc: i386/crt.h: " Zhangjin Wu
2023-07-08 15:34 ` [PATCH v2 08/12] tools/nolibc: x86_64/crt.h: " Zhangjin Wu
2023-07-08 15:35 ` [PATCH v2 09/12] tools/nolibc: mips/crt.h: " Zhangjin Wu
2023-07-08 15:36 ` [PATCH v2 10/12] tools/nolibc: loongarch/crt.h: " Zhangjin Wu
2023-07-08 15:37 ` [PATCH v2 11/12] tools/nolibc: riscv/crt.h: " Zhangjin Wu
2023-07-08 15:38 ` [PATCH v2 12/12] tools/nolibc: s390/crt.h: " Zhangjin Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef34ee3cc8cb0e4f8ce7c7c9975a0e8d14473a84.1688828139.git.falcon@tinylab.org \
    --to=falcon@tinylab.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=thomas@t-8ch.de \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.