ltp: Remove -mfpmath=sse on x86

Message ID 20220707035911.2153302-1-raj.khem@gmail.com
State Accepted, archived
Commit 643e40ceaf520f995f6f38449a072e98e26da3b5
Headers show
Series ltp: Remove -mfpmath=sse on x86 | expand

Commit Message

Khem Raj July 7, 2022, 3:59 a.m. UTC
Fixes build errors seen with clang
error: the 'sse' unit is not supported with this instruction set

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-extended/ltp/ltp_20220527.bb | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Purdie July 7, 2022, 8:38 a.m. UTC | #1
On Wed, 2022-07-06 at 20:59 -0700, Khem Raj wrote:
> Fixes build errors seen with clang
> error: the 'sse' unit is not supported with this instruction set
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-extended/ltp/ltp_20220527.bb | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meta/recipes-extended/ltp/ltp_20220527.bb b/meta/recipes-extended/ltp/ltp_20220527.bb
> index b3ef8f59105..034b62b321e 100644
> --- a/meta/recipes-extended/ltp/ltp_20220527.bb
> +++ b/meta/recipes-extended/ltp/ltp_20220527.bb
> @@ -19,6 +19,7 @@ EXTRA_OECONF:append:libc-musl = " LIBS=-lfts "
>  # is set to -O0 or frame pointers have been enabled by -fno-omit-frame-pointer
>  # earlier in CFLAGS, etc.
>  CFLAGS:append:x86-64 = " -fomit-frame-pointer"
> +TUNE_CCARGS:remove:x86 = "-mfpmath=sse"
>  
>  CFLAGS:append:powerpc64 = " -D__SANE_USERSPACE_TYPES__"
>  CFLAGS:append:mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"

I really don't like remove operations in OE-Core. If it is
incompatible, why is it there in the first place? Does that need to be
clang only?

Cheers,

Richard
Khem Raj July 7, 2022, 3:10 p.m. UTC | #2
There are some tests in ltp where it conflicts especially for tunes
used in qemux86, the test adds -mno-sse which does nullify -msse3 but
does not nullify -mfpmath=sse and clang is pedantic about it whereas
gcc just warns

here is ltp cmd

cd tmp/work/core2-32-yoe-linux/ltp/20220527-r0/git/testcases/kernel/kvm

% ../../../../recipe-sysroot-native/usr/bin/i686-yoe-linux/i686-yoe-linux-clang
-target i686-yoe-linux -m32 -march=core2 -mtune=core2 -msse3
-mfpmath=sse -mlittle-endian --dyld-prefix=/usr -Qunused-arguments
-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
-fmacro-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0=/usr/src/debug/ltp/20220527-r0
-fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0=/usr/src/debug/ltp/20220527-r0
-fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0/recipe-sysroot=
-fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0/recipe-sysroot-native=
-Wl,-z,relro,-z,now -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
-Werror=format-security
--sysroot=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0/recipe-sysroot
-I/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0/git/testcases/kernel/kvm/include
-DCOMPILE_PAYLOAD -ffreestanding -O2 -Wall
-fno-asynchronous-unwind-tables -mno-mmx -mno-sse -fno-pie -c -o
lib_guest.o lib_guest.c


here is a reduced case

% gcc -m32 -msse3 -mfpmath=sse -xc /dev/null -c -mno-sse
cc1: warning: SSE instruction set disabled, using 387 arithmetics
[kraj@apollo /tmp]
% clang -m32 -msse3 -mfpmath=sse -xc /dev/null -c -mno-sse
error: the 'sse' unit is not supported with this instruction set

On Thu, Jul 7, 2022 at 11:05 AM Khem Raj <raj.khem@gmail.com> wrote:
>
>
>
> On 7/7/22 4:38 AM, Richard Purdie wrote:
> > On Wed, 2022-07-06 at 20:59 -0700, Khem Raj wrote:
> >> Fixes build errors seen with clang
> >> error: the 'sse' unit is not supported with this instruction set
> >>
> >> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >> ---
> >>   meta/recipes-extended/ltp/ltp_20220527.bb | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/meta/recipes-extended/ltp/ltp_20220527.bb b/meta/recipes-extended/ltp/ltp_20220527.bb
> >> index b3ef8f59105..034b62b321e 100644
> >> --- a/meta/recipes-extended/ltp/ltp_20220527.bb
> >> +++ b/meta/recipes-extended/ltp/ltp_20220527.bb
> >> @@ -19,6 +19,7 @@ EXTRA_OECONF:append:libc-musl = " LIBS=-lfts "
> >>   # is set to -O0 or frame pointers have been enabled by -fno-omit-frame-pointer
> >>   # earlier in CFLAGS, etc.
> >>   CFLAGS:append:x86-64 = " -fomit-frame-pointer"
> >> +TUNE_CCARGS:remove:x86 = "-mfpmath=sse"
> >>
> >>   CFLAGS:append:powerpc64 = " -D__SANE_USERSPACE_TYPES__"
> >>   CFLAGS:append:mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
> >
> > I really don't like remove operations in OE-Core. If it is
> > incompatible, why is it there in the first place? Does that need to be
> > clang only?
>
> There are some tests in ltp where it conflicts especially for tunes used
> in qemux86, the test adds -mno-sse which does nullify -msse3 not nullify
> -mfpmath=sse
>
>
> cd tmp/work/core2-32-yoe-linux/ltp/20220527-r0/git/testcases/kernel/kvm
>
> %
> ../../../../recipe-sysroot-native/usr/bin/i686-yoe-linux/i686-yoe-linux-clang
> -target i686-yoe-linux  -m32 -march=core2 -mtune=core2 -msse3
> -mfpmath=sse -mlittle-endian --dyld-prefix=/usr -Qunused-arguments
> -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
> -fmacro-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0=/usr/src/debug/ltp/20220527-r0
>
> -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0=/usr/src/debug/ltp/20220527-r0
>
> -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0/recipe-sysroot=
>
> -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0/recipe-sysroot-native=
>   -Wl,-z,relro,-z,now     -O2 -D_FORTIFY_SOURCE=2 -Wformat
> -Wformat-security -Werror=format-security
> --sysroot=/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0/recipe-sysroot
> -I/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/ltp/20220527-r0/git/testcases/kernel/kvm/include
> -DCOMPILE_PAYLOAD -ffreestanding -O2 -Wall
> -fno-asynchronous-unwind-tables -mno-mmx -mno-sse -fno-pie -c -o
> lib_guest.o lib_guest.c
>
> >
> > Cheers,
> >
> > Richard
> >
Ross Burton July 7, 2022, 3:58 p.m. UTC | #3
On 7 Jul 2022, at 16:10, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> % gcc -m32 -msse3 -mfpmath=sse -xc /dev/null -c -mno-sse
> cc1: warning: SSE instruction set disabled, using 387 arithmetics
> [kraj@apollo /tmp]
> % clang -m32 -msse3 -mfpmath=sse -xc /dev/null -c -mno-sse
> error: the 'sse' unit is not supported with this instruction set

So I just built ltp for qemux86-64 on my aarch64 host:

| cc1: warning: SSE instruction set disabled, using 387 arithmetics
| cc1: warning: SSE instruction set disabled, using 387 arithmetics
| AS testcases/kernel/kvm/bootstrap_x86_64.o
| make[5]: Nothing to be done for 'all'.
| make[5]: Nothing to be done for 'all'.
| CC testcases/kernel/kvm/lib_x86.o
| CC testcases/kernel/kvm/lib_guest.o
| cc1: warning: SSE instruction set disabled, using 387 arithmetics
| ld: target elf64-x86-64 not found

Looks like it’s also trying to use the host ld?

Ross
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Patch

diff --git a/meta/recipes-extended/ltp/ltp_20220527.bb b/meta/recipes-extended/ltp/ltp_20220527.bb
index b3ef8f59105..034b62b321e 100644
--- a/meta/recipes-extended/ltp/ltp_20220527.bb
+++ b/meta/recipes-extended/ltp/ltp_20220527.bb
@@ -19,6 +19,7 @@  EXTRA_OECONF:append:libc-musl = " LIBS=-lfts "
 # is set to -O0 or frame pointers have been enabled by -fno-omit-frame-pointer
 # earlier in CFLAGS, etc.
 CFLAGS:append:x86-64 = " -fomit-frame-pointer"
+TUNE_CCARGS:remove:x86 = "-mfpmath=sse"
 
 CFLAGS:append:powerpc64 = " -D__SANE_USERSPACE_TYPES__"
 CFLAGS:append:mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"