Skip to contentSkip to conversation

compiler.h: define CONFIG_GCC_VERSION

PATCH In review Olaf Hering 3 participants 6 messages Jun 18, 2021 – Jul 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compiler.h: define CONFIG_GCC_VERSION

Fixes commit fa5afbbc20ef3577c5338f9d0b24dad45cef59cd, due to lack of commit 534519f0514f52007d504e0f2eeb714de7b2468d.

---
 xen/include/xen/compiler.h | 7 +++++++
 1 file changed, 7 insertions(+)
xen/include/xen/compiler.h +7 -0
index 85cbd1ab00..e2b7193042 100644
@@ -99,6 +99,13 @@
     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
     (typeof(ptr)) (__ptr + (off)); })
 
+#ifndef CONFIG_GCC_VERSION
+# ifdef __GNUC__
+#  define CONFIG_GCC_VERSION (__GNUC__ * 10000           \
+                              + __GNUC_MINOR__ * 100     \
+                              + __GNUC_PATCHLEVEL__)
+# endif
+#endif
 #if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */
 # define gcc11_wrap(x) RELOC_HIDE(x, 0)
 #else
#1 lore raw
Quoted 4 lines · Olaf Hering

Fixes commit fa5afbbc20ef3577c5338f9d0b24dad45cef59cd, due to lack of commit 534519f0514f52007d504e0f2eeb714de7b2468d.

Presumably you're intending this for Xen 4.13 and older?

~Andrew

#2 lore raw

Am Fri, 18 Jun 2021 17:46:47 +0100
schrieb Andrew Cooper <[email protected]>:

Quoted 5 lines · Olaf Hering
Quoted 2 lines

Fixes commit fa5afbbc20ef3577c5338f9d0b24dad45cef59cd, due to lack of commit 534519f0514f52007d504e0f2eeb714de7b2468d.

Presumably you're intending this for Xen 4.13 and older?

722f59d38c710a940ab05e542a83020eb5546dea without the required changes exists only in staging-4.13 at this point.

Olaf

#3 lore raw
Quoted 10 lines · Olaf Hering

Am Fri, 18 Jun 2021 17:46:47 +0100
schrieb Andrew Cooper <[email protected]>:

Quoted 5 lines · Olaf Hering
Quoted 2 lines

Fixes commit fa5afbbc20ef3577c5338f9d0b24dad45cef59cd, due to lack of commit 534519f0514f52007d504e0f2eeb714de7b2468d.

Presumably you're intending this for Xen 4.13 and older?

722f59d38c710a940ab05e542a83020eb5546dea without the required changes exists only in staging-4.13 at this point.

But please could you help readers by making this obvious without needing to check what branch(es) said commit is part of, e.g. by tagging the subject with [PATCH for-4.13] or some such?

Jan

Reviewed-by on v1 1/1
#4 lore raw
In reply to Olaf Hering
Quoted 4 lines · Olaf Hering

Fixes commit fa5afbbc20ef3577c5338f9d0b24dad45cef59cd, due to lack of commit 534519f0514f52007d504e0f2eeb714de7b2468d.

albeit ...

xen/include/xen/compiler.h line 108

Quoted 13 lines
xen/include/xen/compiler.h +7 -0
@@ -99,6 +99,13 @@
     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
     (typeof(ptr)) (__ptr + (off)); })
 
+#ifndef CONFIG_GCC_VERSION
+# ifdef __GNUC__
+#  define CONFIG_GCC_VERSION (__GNUC__ * 10000           \
+                              + __GNUC_MINOR__ * 100     \
+                              + __GNUC_PATCHLEVEL__)
+# endif
+#endif

... I question the need for the surrounding #ifdef, and I may also move this higher up in the file while committing.

Jan

#5 lore raw
In reply to Olaf Hering
Quoted 6 lines · Olaf Hering
xen/include/xen/compiler.h +0 -0
@@ -99,6 +99,13 @@
     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
     (typeof(ptr)) (__ptr + (off)); })
 

xen/include/xen/compiler.h line 111

Quoted 10 lines
xen/include/xen/compiler.h +7 -0
+#ifndef CONFIG_GCC_VERSION
+# ifdef __GNUC__
+#  define CONFIG_GCC_VERSION (__GNUC__ * 10000           \
+                              + __GNUC_MINOR__ * 100     \
+                              + __GNUC_PATCHLEVEL__)
+# endif
+#endif
 #if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */
 # define gcc11_wrap(x) RELOC_HIDE(x, 0)
 #else

Having thought about it, this feels like the wrong solution to
me: I'd rather not see us introduce further CONFIG_* which don't really come from Kconfig. The more when we have an even simpler alternative:

there's no CONFIG_GCC_VERSION

This was introduced in 4.14 only.

xen/include/xen/compiler.h +1 -1
@@ -99,7 +99,7 @@
     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
     (typeof(ptr)) (__ptr + (off)); })
 
-#if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */
+#if __GNUC__ >= 11 /* See gcc bug 100680. */
 # define gcc11_wrap(x) RELOC_HIDE(x, 0)
 #else
 # define gcc11_wrap(x) (x)

I'll also adjust the original backport itself before putting it on the 4.12 branch (where I think we want both this and the other gcc 11 fixes).

Jan