[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1] xen/config.h: Move BITS_PER_* definitions from asm/config.h to xen/config.h




On 3/27/25 2:16 PM, Jan Beulich wrote:
On 27.03.2025 13:50, Oleksii Kurochko wrote:
On 3/27/25 1:44 AM, Andrew Cooper wrote:
On 26/03/2025 5:47 pm, Oleksii Kurochko wrote:
diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h
index d888b2314d..dbbf2fce62 100644
--- a/xen/include/xen/config.h
+++ b/xen/include/xen/config.h
@@ -98,4 +98,13 @@
  #define ZERO_BLOCK_PTR ((void *)-1L)
  #endif
  
+#define BYTES_PER_LONG  __SIZEOF_LONG__
+
+#define BITS_PER_BYTE   __CHAR_BIT__
+#define BITS_PER_INT    (__SIZEOF_INT__ << 3)
+#define BITS_PER_LONG   (BYTES_PER_LONG << 3)
+#define BITS_PER_LLONG  (__SIZEOF_LONG_LONG__ << 3)
+
+#define POINTER_ALIGN   __SIZEOF_POINTER__
See how much nicer this is.  This patch possibly wants to wait until
I've fixed the compiler checks to update to the new baseline, or we can
just say that staging is staging and corner case error messages are fine.
Do you mean this patch:https://lore.kernel.org/xen-devel/20250320153241.43809-3-andrew.cooper3@xxxxxxxxxx/?

I haven't checked clang but if to look at gcc then these builtin macros was introduced in
024a85aeb6a("c-cppbuiltin.c (builtin_define_type_sizeof): New function.") and it seems like even older then gcc5
contains this patch:
$ git tag --contains 024a85aeb6a912811d917f737eaad39140c2fb0c
   ...
   releases/gcc-4.3.0
   ...

Am I missing something?
The check yet to be adjusted is looking for 4.1, so 4.3 would already be "too new".
I guess you mean this one check:
  check-$(gcc) = $(call cc-ver-check,CC,0x040100,"Xen requires at least gcc-4.1")

Could I ask then why in the link above it is checked different version?
-#if !defined(__GNUC__) || (__GNUC__ < 4)
-#error Sorry, your compiler is too old/not recognized.
-#elif CONFIG_CC_IS_GCC
-# if defined(CONFIG_ARM_32) && CONFIG_GCC_VERSION < 40900
-#  error Sorry, your version of GCC is too old - please use 4.9 or newer.
-# elif defined(CONFIG_ARM_64) && CONFIG_GCC_VERSION < 50100
-/*
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
- * https://lore.kernel.org/r/20210107111841.GN1551@xxxxxxxxxxxxxxxxxxxxx
- */
-#  error Sorry, your version of GCC is too old - please use 5.1 or newer.
-# endif

~ Oleksii

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.