Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTBFS on ppc64le with ieee-long-double toolchain #14308

Closed
gyakovlev opened this issue Dec 21, 2022 · 3 comments
Closed

FTBFS on ppc64le with ieee-long-double toolchain #14308

gyakovlev opened this issue Dec 21, 2022 · 3 comments
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@gyakovlev
Copy link
Contributor

gyakovlev commented Dec 21, 2022

System information

Type Version/Name
Distribution Name gentoo
Distribution Version rolling
Kernel Version 5.15.80
Architecture ppc64le
OpenZFS Version 2.1.7 and today's master

Describe the problem you're observing

compiler/libc (both clang and gcc) are configured with 128bit long double.

(gcc built with --with-long-double-format=ieee ./configure switch)

zfs fails to build with that toolchain:

gcc error is not very helpful:

../../module/zfs/vdev_raidz_math_powerpc_altivec_common.h:30:23: error: expected '(' before '__volatile__'
   30 | #define __asm __asm__ __volatile__

clang produces much more helpful output:

./../module/zfs/vdev_raidz_math_powerpc_altivec_common.h:30:23: note: expanded from macro '__asm'                                                                                                                                                             
#define __asm __asm__ __volatile__                                                                                              
                      ^                                         
In file included from ../../module/zfs/vdev_raidz_math_powerpc_altivec.c:203:
In file included from ../../include/sys/vdev_raidz_impl.h:29:                                                                   
In file included from ../../lib/libspl/include/sys/debug.h:30:
In file included from ../../lib/libspl/include/assert.h:32:   
In file included from ../../lib/libspl/include/stdio.h:27: 
In file included from /usr/include/stdio.h:896:           
/usr/include/bits/stdio-ldbl.h:78:1: error: meaningless 'volatile' on asm outside function
__LDBL_REDIR_DECL (vasprintf)                                                                                                   
^                                                               
/usr/include/sys/cdefs.h:569:31: note: expanded from macro '__LDBL_REDIR_DECL'
  extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));       
                              ^                                                                                                 
../../module/zfs/vdev_raidz_math_powerpc_altivec_common.h:30:23: note: expanded from macro '__asm'

Describe how to reproduce the problem

ppc64le system, pass -mabi=ieeelongdouble to compiler, or have it configured to implicitly do it by default.

removing that __volatile__ on single line allows build to complete.

@gyakovlev gyakovlev added the Type: Defect Incorrect behavior (e.g. crash, hang) label Dec 21, 2022
@gyakovlev
Copy link
Contributor Author

fedora recently switched to 128bit float long double for ppc64le
https://fedoraproject.org/wiki/Changes/PPC64LE_Float128_Transition

gentoo is in the process of switching too, this will become more visible soon.

@gyakovlev
Copy link
Contributor Author

I'm still investigating on my side, this might be glibc bug.

kernel part of zfs builds fine, it's failure in userspace build.

similar to:

https://patchwork.sourceware.org/project/glibc/patch/20221116150803.1990947-1-tuliom@ascii.art.br/

or

bminor/glibc@d0fa09a770

ryao added a commit to ryao/zfs that referenced this issue Jan 12, 2023
There is an external assembly declaration extension in GNU C that glibc
uses when building with ieee128 floating point support on ppc64le.
Marking that as volatile makes no sense, so the build breaks.

It does not make sense to only mark this as volatile on Linux, since if
do not want the compiler reordering things on Linux, we do not want the
compiler reordering things on any other platform, so we stop treating
Linux specially and just manually inline the CPP macro so that we can
eliminate it. This should fix the build on ppc64le.

Closes openzfs#14308
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
@ryao
Copy link
Contributor

ryao commented Jan 12, 2023

I'm still investigating on my side, this might be glibc bug.

It is not a glibc bug. The issue is that the author did a hack to avoid explicitly marking inline assembly as volatile and it ended up affecting an external assembly declaration.

I find it weird to even have external assembly declarations. Usually, you could implement that just by pretending the assembly is compiled C code and following the appropriate calling convention.

That said, I have opened #14384 with a fix for this.

tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Jan 17, 2023
There is an external assembly declaration extension in GNU C that glibc
uses when building with ieee128 floating point support on ppc64le.
Marking that as volatile makes no sense, so the build breaks.

It does not make sense to only mark this as volatile on Linux, since if
do not want the compiler reordering things on Linux, we do not want the
compiler reordering things on any other platform, so we stop treating
Linux specially and just manually inline the CPP macro so that we can
eliminate it. This should fix the build on ppc64le.

Tested-by: @gyakovlev
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#14308
Closes openzfs#14384
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Jan 18, 2023
There is an external assembly declaration extension in GNU C that glibc
uses when building with ieee128 floating point support on ppc64le.
Marking that as volatile makes no sense, so the build breaks.

It does not make sense to only mark this as volatile on Linux, since if
do not want the compiler reordering things on Linux, we do not want the
compiler reordering things on any other platform, so we stop treating
Linux specially and just manually inline the CPP macro so that we can
eliminate it. This should fix the build on ppc64le.

Tested-by: @gyakovlev
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#14308
Closes openzfs#14384
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Jan 19, 2023
There is an external assembly declaration extension in GNU C that glibc
uses when building with ieee128 floating point support on ppc64le.
Marking that as volatile makes no sense, so the build breaks.

It does not make sense to only mark this as volatile on Linux, since if
do not want the compiler reordering things on Linux, we do not want the
compiler reordering things on any other platform, so we stop treating
Linux specially and just manually inline the CPP macro so that we can
eliminate it. This should fix the build on ppc64le.

Tested-by: @gyakovlev
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#14308
Closes openzfs#14384
lundman pushed a commit to openzfsonwindows/openzfs that referenced this issue Mar 3, 2023
There is an external assembly declaration extension in GNU C that glibc
uses when building with ieee128 floating point support on ppc64le.
Marking that as volatile makes no sense, so the build breaks.

It does not make sense to only mark this as volatile on Linux, since if
do not want the compiler reordering things on Linux, we do not want the
compiler reordering things on any other platform, so we stop treating
Linux specially and just manually inline the CPP macro so that we can
eliminate it. This should fix the build on ppc64le.

Tested-by: @gyakovlev 
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#14308
Closes openzfs#14384
Wenri pushed a commit to Wenri/zfs that referenced this issue Sep 13, 2023
There is an external assembly declaration extension in GNU C that glibc
uses when building with ieee128 floating point support on ppc64le.
Marking that as volatile makes no sense, so the build breaks.

It does not make sense to only mark this as volatile on Linux, since if
do not want the compiler reordering things on Linux, we do not want the
compiler reordering things on any other platform, so we stop treating
Linux specially and just manually inline the CPP macro so that we can
eliminate it. This should fix the build on ppc64le.

Tested-by: @gyakovlev
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#14308
Closes openzfs#14384
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

2 participants