[PATCH v1] compiler.h: define CONFIG_GCC_VERSION

Olaf Hering posted 1 patch 2 years, 10 months ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20210618164207.5111-1-olaf@aepfle.de
xen/include/xen/compiler.h | 7 +++++++
1 file changed, 7 insertions(+)
[PATCH v1] compiler.h: define CONFIG_GCC_VERSION
Posted by Olaf Hering 2 years, 10 months ago
Fixes commit fa5afbbc20ef3577c5338f9d0b24dad45cef59cd,
due to lack of commit 534519f0514f52007d504e0f2eeb714de7b2468d.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 xen/include/xen/compiler.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 85cbd1ab00..e2b7193042 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -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

Re: [PATCH v1] compiler.h: define CONFIG_GCC_VERSION
Posted by Andrew Cooper 2 years, 10 months ago
On 18/06/2021 17:42, Olaf Hering wrote:
> Fixes commit fa5afbbc20ef3577c5338f9d0b24dad45cef59cd,
> due to lack of commit 534519f0514f52007d504e0f2eeb714de7b2468d.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>

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

~Andrew

Re: [PATCH v1] compiler.h: define CONFIG_GCC_VERSION
Posted by Olaf Hering 2 years, 10 months ago
Am Fri, 18 Jun 2021 17:46:47 +0100
schrieb Andrew Cooper <andrew.cooper3@citrix.com>:

> On 18/06/2021 17:42, Olaf Hering wrote:
> > 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
Re: [PATCH v1] compiler.h: define CONFIG_GCC_VERSION
Posted by Jan Beulich 2 years, 10 months ago
On 18.06.2021 18:55, Olaf Hering wrote:
> Am Fri, 18 Jun 2021 17:46:47 +0100
> schrieb Andrew Cooper <andrew.cooper3@citrix.com>:
> 
>> On 18/06/2021 17:42, Olaf Hering wrote:
>>> 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


Re: [PATCH for-4.13] compiler.h: define CONFIG_GCC_VERSION
Posted by Jan Beulich 2 years, 10 months ago
On 18.06.2021 18:42, Olaf Hering wrote:
> Fixes commit fa5afbbc20ef3577c5338f9d0b24dad45cef59cd,
> due to lack of commit 534519f0514f52007d504e0f2eeb714de7b2468d.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
albeit ...

> --- a/xen/include/xen/compiler.h
> +++ b/xen/include/xen/compiler.h
> @@ -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


Re: [PATCH v1] compiler.h: define CONFIG_GCC_VERSION
Posted by Jan Beulich 2 years, 9 months ago
On 18.06.2021 18:42, Olaf Hering wrote:
> --- a/xen/include/xen/compiler.h
> +++ b/xen/include/xen/compiler.h
> @@ -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

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.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -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