diff mbox series

[v2,1/8] lib: split _ctype[] into its own object, under lib/

Message ID 8bf44bbd-8c39-7ab1-3ccb-52bf3744592b@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: beginnings of moving library-like code into an archive | expand

Commit Message

Jan Beulich Oct. 23, 2020, 10:16 a.m. UTC
This is, besides for tidying, in preparation of then starting to use an
archive rather than an object file for generic library code which
arch-es (or even specific configurations within a single arch) may or
may not need.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile     |  3 ++-
 xen/Rules.mk     |  2 +-
 xen/common/lib.c | 29 -----------------------------
 xen/lib/Makefile |  1 +
 xen/lib/ctype.c  | 38 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 42 insertions(+), 31 deletions(-)
 create mode 100644 xen/lib/ctype.c

Comments

Julien Grall Nov. 18, 2020, 5 p.m. UTC | #1
Hi Jan,

On 23/10/2020 11:16, Jan Beulich wrote:
> This is, besides for tidying, in preparation of then starting to use an
> archive rather than an object file for generic library code which
> arch-es (or even specific configurations within a single arch) may or
> may not need.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,

> ---
>   xen/Makefile     |  3 ++-
>   xen/Rules.mk     |  2 +-
>   xen/common/lib.c | 29 -----------------------------
>   xen/lib/Makefile |  1 +
>   xen/lib/ctype.c  | 38 ++++++++++++++++++++++++++++++++++++++
>   5 files changed, 42 insertions(+), 31 deletions(-)
>   create mode 100644 xen/lib/ctype.c
> 
> diff --git a/xen/Makefile b/xen/Makefile
> index bf0c804d4352..73bdc326c549 100644
> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -331,6 +331,7 @@ _clean: delete-unfresh-files
>   	$(MAKE) $(clean) include
>   	$(MAKE) $(clean) common
>   	$(MAKE) $(clean) drivers
> +	$(MAKE) $(clean) lib
>   	$(MAKE) $(clean) xsm
>   	$(MAKE) $(clean) crypto
>   	$(MAKE) $(clean) arch/arm
> @@ -414,7 +415,7 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
>   	  echo ""; \
>   	  echo "#endif") <$< >$@
>   
> -SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers test
> +SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
>   define all_sources
>       ( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \
>         find include -name 'asm-*' -prune -o -name '*.h' -print; \
> diff --git a/xen/Rules.mk b/xen/Rules.mk
> index 891c94e6ad00..333e19bec343 100644
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -36,7 +36,7 @@ TARGET := $(BASEDIR)/xen
>   # Note that link order matters!
>   ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
>   ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
> -ALL_OBJS-$(CONFIG_X86)   += $(BASEDIR)/lib/built_in.o
> +ALL_OBJS-y               += $(BASEDIR)/lib/built_in.o
>   ALL_OBJS-y               += $(BASEDIR)/xsm/built_in.o
>   ALL_OBJS-y               += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
>   ALL_OBJS-$(CONFIG_CRYPTO)   += $(BASEDIR)/crypto/built_in.o
> diff --git a/xen/common/lib.c b/xen/common/lib.c
> index b2b799da44c5..a224efa8f6e8 100644
> --- a/xen/common/lib.c
> +++ b/xen/common/lib.c
> @@ -1,37 +1,8 @@
> -
> -#include <xen/ctype.h>
>   #include <xen/lib.h>
>   #include <xen/types.h>
>   #include <xen/init.h>
>   #include <asm/byteorder.h>
>   
> -/* for ctype.h */
> -const unsigned char _ctype[] = {
> -    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
> -    _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
> -    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
> -    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
> -    _S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
> -    _P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
> -    _D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
> -    _D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
> -    _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
> -    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
> -    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
> -    _U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
> -    _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
> -    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
> -    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
> -    _L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
> -    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
> -    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
> -    _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
> -    _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
> -    _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
> -    _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
> -    _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
> -    _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
> -
>   /*
>    * A couple of 64 bit operations ported from FreeBSD.
>    * The code within the '#if BITS_PER_LONG == 32' block below, and no other
> diff --git a/xen/lib/Makefile b/xen/lib/Makefile
> index 7019ca00e8fd..53b1da025e0d 100644
> --- a/xen/lib/Makefile
> +++ b/xen/lib/Makefile
> @@ -1 +1,2 @@
> +obj-y += ctype.o
>   obj-$(CONFIG_X86) += x86/
> diff --git a/xen/lib/ctype.c b/xen/lib/ctype.c
> new file mode 100644
> index 000000000000..7b233a335fdf
> --- /dev/null
> +++ b/xen/lib/ctype.c
> @@ -0,0 +1,38 @@
> +#include <xen/ctype.h>
> +
> +/* for ctype.h */
> +const unsigned char _ctype[] = {
> +    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
> +    _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
> +    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
> +    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
> +    _S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
> +    _P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
> +    _D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
> +    _D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
> +    _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
> +    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
> +    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
> +    _U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
> +    _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
> +    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
> +    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
> +    _L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
> +    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
> +    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
> +    _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
> +    _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
> +    _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
> +    _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
> +    _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
> +    _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * tab-width: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
>
diff mbox series

Patch

diff --git a/xen/Makefile b/xen/Makefile
index bf0c804d4352..73bdc326c549 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -331,6 +331,7 @@  _clean: delete-unfresh-files
 	$(MAKE) $(clean) include
 	$(MAKE) $(clean) common
 	$(MAKE) $(clean) drivers
+	$(MAKE) $(clean) lib
 	$(MAKE) $(clean) xsm
 	$(MAKE) $(clean) crypto
 	$(MAKE) $(clean) arch/arm
@@ -414,7 +415,7 @@  include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
 	  echo ""; \
 	  echo "#endif") <$< >$@
 
-SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers test
+SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
     ( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \
       find include -name 'asm-*' -prune -o -name '*.h' -print; \
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 891c94e6ad00..333e19bec343 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -36,7 +36,7 @@  TARGET := $(BASEDIR)/xen
 # Note that link order matters!
 ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
-ALL_OBJS-$(CONFIG_X86)   += $(BASEDIR)/lib/built_in.o
+ALL_OBJS-y               += $(BASEDIR)/lib/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/xsm/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
 ALL_OBJS-$(CONFIG_CRYPTO)   += $(BASEDIR)/crypto/built_in.o
diff --git a/xen/common/lib.c b/xen/common/lib.c
index b2b799da44c5..a224efa8f6e8 100644
--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -1,37 +1,8 @@ 
-
-#include <xen/ctype.h>
 #include <xen/lib.h>
 #include <xen/types.h>
 #include <xen/init.h>
 #include <asm/byteorder.h>
 
-/* for ctype.h */
-const unsigned char _ctype[] = {
-    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
-    _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
-    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
-    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
-    _S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
-    _P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
-    _D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
-    _D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
-    _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
-    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
-    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
-    _U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
-    _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
-    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
-    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
-    _L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
-    _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
-    _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
-    _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
-    _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
-    _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
-    _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
-
 /*
  * A couple of 64 bit operations ported from FreeBSD.
  * The code within the '#if BITS_PER_LONG == 32' block below, and no other
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 7019ca00e8fd..53b1da025e0d 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -1 +1,2 @@ 
+obj-y += ctype.o
 obj-$(CONFIG_X86) += x86/
diff --git a/xen/lib/ctype.c b/xen/lib/ctype.c
new file mode 100644
index 000000000000..7b233a335fdf
--- /dev/null
+++ b/xen/lib/ctype.c
@@ -0,0 +1,38 @@ 
+#include <xen/ctype.h>
+
+/* for ctype.h */
+const unsigned char _ctype[] = {
+    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
+    _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
+    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
+    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
+    _S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
+    _P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
+    _D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
+    _D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
+    _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
+    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
+    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
+    _U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
+    _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
+    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
+    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
+    _L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
+    _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
+    _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
+    _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
+    _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
+    _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
+    _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */