linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Cannot compile UML in Ubuntu 20.04.5 anymore
@ 2023-03-03  8:34 Roberto Sassu
  2023-03-04  4:35 ` David Gow
  0 siblings, 1 reply; 4+ messages in thread
From: Roberto Sassu @ 2023-03-03  8:34 UTC (permalink / raw)
  To: linux-um; +Cc: Richard Weinberger, Anton Ivanov, Johannes Berg

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


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cannot compile UML in Ubuntu 20.04.5 anymore
  2023-03-03  8:34 Cannot compile UML in Ubuntu 20.04.5 anymore Roberto Sassu
@ 2023-03-04  4:35 ` David Gow
  2023-03-06 17:05   ` Roberto Sassu
  2023-03-17 16:58   ` SeongJae Park
  0 siblings, 2 replies; 4+ messages in thread
From: David Gow @ 2023-03-04  4:35 UTC (permalink / raw)
  To: Roberto Sassu; +Cc: linux-um, Richard Weinberger, Anton Ivanov, Johannes Berg


[-- 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Cannot compile UML in Ubuntu 20.04.5 anymore
  2023-03-04  4:35 ` David Gow
@ 2023-03-06 17:05   ` Roberto Sassu
  2023-03-17 16:58   ` SeongJae Park
  1 sibling, 0 replies; 4+ messages in thread
From: Roberto Sassu @ 2023-03-06 17:05 UTC (permalink / raw)
  To: David Gow; +Cc: linux-um, Richard Weinberger, Anton Ivanov, Johannes Berg

On Sat, 2023-03-04 at 12:35 +0800, David Gow wrote:
> 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.

Thanks, works for me.

Roberto


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cannot compile UML in Ubuntu 20.04.5 anymore
  2023-03-04  4:35 ` David Gow
  2023-03-06 17:05   ` Roberto Sassu
@ 2023-03-17 16:58   ` SeongJae Park
  1 sibling, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2023-03-17 16:58 UTC (permalink / raw)
  To: David Gow
  Cc: Roberto Sassu, linux-um, Richard Weinberger, Anton Ivanov,
	Johannes Berg, SeongJae Park

On Sat, 4 Mar 2023 12:35:24 +0800 David Gow <davidgow@google.com> wrote:

> 
> [-- 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
> ---

I also encountered the same issue, and confirmed this fixes the issue on my
machine.

Tested-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

> 
> 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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-17 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03  8:34 Cannot compile UML in Ubuntu 20.04.5 anymore Roberto Sassu
2023-03-04  4:35 ` David Gow
2023-03-06 17:05   ` Roberto Sassu
2023-03-17 16:58   ` SeongJae Park

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).