All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: xen-devel@lists.xenproject.org
Cc: julien@xen.org, Julien Grall <jgrall@amazon.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Ian Jackson <iwj@xenproject.org>, Jan Beulich <jbeulich@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>
Subject: [PATCH for-4.15] xen: Bump the minimum version of GCC supported to 4.9 (5.1 on arm64)
Date: Sat,  6 Mar 2021 21:41:48 +0000	[thread overview]
Message-ID: <20210306214148.27021-1-julien@xen.org> (raw)

From: Julien Grall <jgrall@amazon.com>

Compilers older than 4.8 have known codegen issues which can lead to
silent miscompilation:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145

Furthermore, pre-4.9 GCC have known bugs (including things like
internal compiler errors on Arm) which would require workaround (I
haven't checked if we have any in Xen).

The minimum version of GCC to build the hypervisor is now raised to 4.9.

In addition to that, on arm64, GCC version >= 4.9 and < 5.1 have been
shown to emit memory references beyond the stack pointer, resulting in
memory corruption if an interrupt is taken after the stack pointer has
been adjusted but before the reference has been executed.

Therefore, the minimum for arm64 is raised to 5.1.

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

---

I don't have a strong opinion on the minimum version for GCC on x86.
So this is following Andrew's suggestion and the minimum from Linux.

This patch is candidate to 4.15 and backport.

This is only a build change and will be low-risk for anyone using newer
compiler (5.1+ for arm64 and 4.9 for everyone else). Xen will stop
building for anyone using older compiler. But it is better than fighting
with codegen issues.
---
 README                     |  9 ++++++---
 xen/include/xen/compiler.h | 13 +++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 8c99c30986c1..5c32c03f2ea1 100644
--- a/README
+++ b/README
@@ -38,12 +38,15 @@ provided by your OS distributor:
     * GNU Make v3.80 or later
     * C compiler and linker:
       - For x86:
-        - GCC 4.1.2_20070115 or later
+        - GCC 4.9 or later
         - GNU Binutils 2.16.91.0.5 or later
         or
         - Clang/LLVM 3.5 or later
-      - For ARM:
-        - GCC 4.8 or later
+      - For ARM 32-bit:
+        - GCC 4.9 or later
+        - GNU Binutils 2.24 or later
+      - For ARM 64-bit:
+        - GCC 5.1 or later
         - GNU Binutils 2.24 or later
     * Development install of zlib (e.g., zlib-dev)
     * Development install of Python 2.6 or later (e.g., python-dev)
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 0ec0b4698ea7..46779660cc8f 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -5,6 +5,19 @@
 #error Sorry, your compiler is too old/not recognized.
 #endif
 
+#if CONFIG_CC_IS_GCC
+# if CONFIG_GCC_VERSION < 40900
+/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 */
+#  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@shell.armlinux.org.uk
+ */
+#  error Sorry, your version of GCC is too old - please use 5.1 or newer.
+# endif
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
-- 
2.17.1



             reply	other threads:[~2021-03-06 21:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-06 21:41 Julien Grall [this message]
2021-03-07 10:57 ` [PATCH for-4.15] xen: Bump the minimum version of GCC supported to 4.9 (5.1 on arm64) Roger Pau Monné
2021-03-07 12:37   ` Julien Grall
2021-03-08  8:09 ` Jan Beulich
2021-03-08 10:51   ` Julien Grall
2021-03-08 11:20     ` Jan Beulich
2021-03-08 20:22       ` Julien Grall
2021-03-09 11:20         ` Jan Beulich
2021-03-10 18:05           ` Julien Grall
2021-03-11  8:17             ` Jan Beulich
2021-03-11  9:31               ` Julien Grall
2021-03-11 11:43                 ` Jan Beulich
2021-03-08  9:49 ` Ian Jackson
2021-03-10 20:48 ` Stefano Stabellini
     [not found] <161507188317.11025.6744028462008264481@c667a6b167f6>
2021-03-07 13:00 ` Julien Grall
2021-03-09  0:59   ` Stefano Stabellini
2021-03-09 10:05     ` Julien Grall
2021-03-09 10:32       ` Roger Pau Monné
2021-03-09 11:11         ` Anthony PERARD
2021-03-09 22:24         ` Stefano Stabellini
2021-03-10  7:52           ` Roger Pau Monné
2021-03-10 10:24             ` Zheng, Fam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210306214148.27021-1-julien@xen.org \
    --to=julien@xen.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=jgrall@amazon.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.