linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: David Gow <davidgow@google.com>
To: Roberto Sassu <roberto.sassu@huaweicloud.com>
Cc: linux-um@lists.infradead.org, Richard Weinberger <richard@nod.at>,
	 Anton Ivanov <anton.ivanov@cambridgegreys.com>,
	Johannes Berg <johannes@sipsolutions.net>
Subject: Re: Cannot compile UML in Ubuntu 20.04.5 anymore
Date: Sat, 4 Mar 2023 12:35:24 +0800	[thread overview]
Message-ID: <CABVgOSm1t3_mcUUu0A8eG-zAA4q0d-dmi6Ceb3TFtoUt1i3gTQ@mail.gmail.com> (raw)
In-Reply-To: <6df2ecef9011d85654a82acd607fdcbc93ad593c.camel@huaweicloud.com>


[-- Attachment #1.1: Type: text/plain, Size: 2159 bytes --]

On Fri, 3 Mar 2023 at 16:37, Roberto Sassu
<roberto.sassu@huaweicloud.com> wrote:
>
> Hi
>
> it looks like one recent commit causes the kernel build to break.
>
>   GEN     scripts/gdb/linux/constants.py
> In file included from /usr/include/stdlib.h:1013,
>                  from arch/um/os-Linux/helper.c:6:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
>    26 | {
>       | ^
>   CC      init/noinitramfs.o
>
> It works again by reverting commit 884981867947 ("rust: arch/um:
> Disable FP/SIMD instruction to match x86").
>
> $ cat /proc/cpuinfo
>
> [...]
>
> processor       : 31
> vendor_id       : AuthenticAMD
> cpu family      : 23
> model           : 49
> model name      : AMD Ryzen Threadripper PRO 3955WX 16-Cores
>
> Thanks
>
> Roberto
>

Yup, this is definitely caused by 884981867947 ("rust: arch/um:
Disable FP/SIMD instruction to match x86").

It looks like GCC fixed this upstream in GCC 11:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99652

Equally though, not having this change breaks older versions of LLVM,
so I think it's best to not totally revert it.

Something like this should work:
---
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index d2e95d1d4db7..1aa64846e539 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -3,9 +3,14 @@ core-y += arch/x86/crypto/

#
# Disable SSE and other FP/SIMD instructions to match normal x86
+# This is required to work around issues in older LLVM versions, but breaks
+# GCC versions < 11. See:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99652
#
+ifeq ($(CONFIG_CC_IS_CLANG),y)
KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
KBUILD_RUSTFLAGS +=
-Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
+endif

ifeq ($(CONFIG_X86_32),y)
START := 0x8048000
---

Though the more correct solution would be to just check
gcc-min-version || clang. That probably requires a bit more
makefile-fu to do cleanly, though.

Cheers,
-- David

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4003 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

  reply	other threads:[~2023-03-04  4:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03  8:34 Cannot compile UML in Ubuntu 20.04.5 anymore Roberto Sassu
2023-03-04  4:35 ` David Gow [this message]
2023-03-06 17:05   ` Roberto Sassu
2023-03-17 16:58   ` SeongJae Park

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=CABVgOSm1t3_mcUUu0A8eG-zAA4q0d-dmi6Ceb3TFtoUt1i3gTQ@mail.gmail.com \
    --to=davidgow@google.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=roberto.sassu@huaweicloud.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).