Bug 2136099

Summary: Use ieeelongdouble ABI on ppc64le by default
Product: [Fedora] Fedora Reporter: Nikita Popov <npopov>
Component: clangAssignee: Nikita Popov <npopov>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: airlied, dan, fweimer, jchecahi, kkleine, npopov, sbergman, serge.guelton, siddharth.kde, tstellar, tuliom
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: clang-15.0.0-6.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-10-26 13:08:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nikita Popov 2022-10-19 10:39:05 UTC
GCC on Fedora enables -mabi=ieeelongdouble for ppc64le by default, and clang should do so as well. This is possible using the PPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON cmake option.

We've tried this a couple of times in the past and ran into various failures. After https://reviews.llvm.org/D134362 (which is backported to rawhide), it's possible to at least bootstrap clang, but there are still issues with many spurious warnings and some test failures.

Comment 1 Nikita Popov 2022-10-19 14:37:32 UTC
https://reviews.llvm.org/D136258 should fix the spurious warnings.

Comment 2 Nikita Popov 2022-10-20 14:04:47 UTC
After producing a clang build with the aforementioned patch I was able to rebuild llvm, clang and libcxx afterwards (https://copr.fedorainfracloud.org/coprs/nikic/ppc64-ieeelongdouble-test/builds/), so I think we should be able to safely enable the option, without getting into rebuild issues down the line.

Something that worries me is the fact that clang reports that -mabi=ieeelongdouble is incompatible with libcxx, so I expect that every -stdlib=libc++ build on ppc64le is going to complain about that. I'd like to know what that incompatibility is.

Comment 3 Dan HorĂ¡k 2022-10-20 14:08:58 UTC
Tulio, does the IBM toolchain team know such incompatibility (comment #2)?

Comment 4 Tulio Magno Quites Machado Filho 2022-10-21 16:22:05 UTC
(In reply to Nikita Popov from comment #2)
> Something that worries me is the fact that clang reports that
> -mabi=ieeelongdouble is incompatible with libcxx, so I expect that every
> -stdlib=libc++ build on ppc64le is going to complain about that. I'd like to
> know what that incompatibility is.

@npopov I tried to create a reproducer for this message, but I was not able to.
Would you have a reproducer or know of a package that reproduces this message?

Anyway, I had a chat with Nemanja Ivanovic.
We agreed that libcxx supports only a single long double format, i.e. in this case IEEE 128-bit floating point.
It doesn't support -mabi=ibmlongdouble if the default is -mabi=ieeelongdouble and vice versa.
If that's necessary, the recommendation is to use libstdc++ instead.
We agreed this is not mentioned in the documentation yet.

The problem is: the message from comment #2 seems to be happening when -mabi=ieeelongdouble is the default long double and that is passed in the command line.
Is this correct?

Comment 5 Nikita Popov 2022-10-24 08:50:58 UTC
I did most of my initial testing by explicitly calling "clang -mabi=ieeelongdouble" rather than setting the cmake option, and apparently that makes a difference: The warning only gets emitted if the option is explicitly specified. So after switching the default "clang -stdlib=libc++" works without warning, but "clang -stdlib=libc++ -mabi=ieeelongdouble" (which just repeats the default explicitly) does print a warning.

Based on your explanation, it sounds like the mabi check for libcxx shouldn't warn if "-mabi=ieeelongdouble" is specified, but rather when -mabi is specified with a non-default value (i.e. -mabi=ibmlongdouble if -mabi=ieeelongdouble is the default and vice versa).

But given that the warning is not emitted without a redundant -mabi=ieeelongdouble, this seems like a pretty minor issue, and we can just go ahead with making the default switch.

Comment 6 Nikita Popov 2022-10-25 07:39:30 UTC
PR: https://src.fedoraproject.org/rpms/clang/pull-request/184

Comment 7 Fedora Update System 2022-10-26 12:28:00 UTC
FEDORA-2022-833007db21 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-833007db21

Comment 8 Fedora Update System 2022-10-26 13:08:19 UTC
FEDORA-2022-833007db21 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Nikita Popov 2022-11-07 16:59:36 UTC
For the record, I've hit another glibc issue, see https://bugzilla.redhat.com/show_bug.cgi?id=2140618. This turned up during the compiler-rt rebuild, which I've switched to use gcc for ppc64le as a temporary workaround.