diff mbox series

[v1] compiler.h: define CONFIG_GCC_VERSION

Message ID 20210618164207.5111-1-olaf@aepfle.de (mailing list archive)
State New
Headers show
Series [v1] compiler.h: define CONFIG_GCC_VERSION | expand

Commit Message

Olaf Hering June 18, 2021, 4:42 p.m. UTC
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(+)

Comments

Andrew Cooper June 18, 2021, 4:46 p.m. UTC | #1
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
Olaf Hering June 18, 2021, 4:55 p.m. UTC | #2
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
Jan Beulich June 21, 2021, 7:07 a.m. UTC | #3
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
Jan Beulich June 21, 2021, 7:14 a.m. UTC | #4
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
Jan Beulich July 9, 2021, 6:54 a.m. UTC | #5
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
diff mbox series

Patch

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