Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 914888 - sys-devel/clang-16.0.6 - fails to build with '-Os' with sys-devel/gcc:13 on ppc64
Summary: sys-devel/clang-16.0.6 - fails to build with '-Os' with sys-devel/gcc:13 on p...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: gcc-13 915000
  Show dependency tree
 
Reported: 2023-09-28 12:50 UTC by ernsteiswuerfel
Modified: 2024-03-27 06:26 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (ppc64, 16.0.6) (clang-16.0.6:20230928-105053.log,126.05 KB, text/plain)
2023-09-28 12:50 UTC, ernsteiswuerfel
Details
emerge --info (file_914888.txt,6.66 KB, text/plain)
2023-09-28 12:51 UTC, ernsteiswuerfel
Details
build.log (ppc64, 17.0.6) (clang-17.0.6_20240201-125058_Os.log,149.23 KB, text/plain)
2024-02-14 22:55 UTC, ernsteiswuerfel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel archtester 2023-09-28 12:50:27 UTC
Created attachment 871663 [details]
build.log (ppc64, 16.0.6)

Getting that with gcc:13 rebuild on my Talos II:

[...]
[229/1235] cd /var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64 && /var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/bin/clang-tblgen -gen-riscv-vector-builtins -I /var/tmp/portage/sys-devel/clang-16.0.6/work/clang/include/clang/Basic -I/var/tmp/portage/sys-devel/clang-16.0.6/work/clang/include -I/var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/include -I/usr/lib/llvm/16/include /var/tmp/portage/sys-devel/clang-16.0.6/work/clang/include/clang/Basic/riscv_vector.td --write-if-changed -o include/clang/Basic/riscv_vector_builtins.inc -d include/clang/Basic/riscv_vector_builtins.inc.d
FAILED: include/clang/Basic/riscv_vector_builtins.inc /var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/include/clang/Basic/riscv_vector_builtins.inc 
cd /var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64 && /var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/bin/clang-tblgen -gen-riscv-vector-builtins -I /var/tmp/portage/sys-devel/clang-16.0.6/work/clang/include/clang/Basic -I/var/tmp/portage/sys-devel/clang-16.0.6/work/clang/include -I/var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/include -I/usr/lib/llvm/16/include /var/tmp/portage/sys-devel/clang-16.0.6/work/clang/include/clang/Basic/riscv_vector.td --write-if-changed -o include/clang/Basic/riscv_vector_builtins.inc -d include/clang/Basic/riscv_vector_builtins.inc.d
 #0 0x000000012f6cdcb4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/bin/clang-tblgen+0x12dcb4)
 #1 0x000000012f6cb32c llvm::sys::RunSignalHandlers() (/var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/bin/clang-tblgen+0x12b32c)
 #2 0x000000012f6cb54c SignalHandler(int) Signals.cpp.o:0:0
 #3 0x00003fff88fb2424 (linux-vdso64.so.1+0x424)
 #4 0x000000012f5f1454 clang::RISCV::RVVIntrinsic::RVVIntrinsic(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, bool, bool, clang::RISCV::PolicyScheme, bool, bool, llvm::StringRef, std::vector<clang::RISCV::RVVType*, std::allocator<clang::RISCV::RVVType*>> const&, std::vector<long, std::allocator<long>> const&, std::vector<llvm::StringRef, std::allocator<llvm::StringRef>> const&, unsigned int, clang::RISCV::Policy) (/var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/bin/clang-tblgen+0x51454)
 #5 0x000000012f666e2c (anonymous namespace)::RVVEmitter::createRVVIntrinsics(std::vector<std::unique_ptr<clang::RISCV::RVVIntrinsic, std::default_delete<clang::RISCV::RVVIntrinsic>>, std::allocator<std::unique_ptr<clang::RISCV::RVVIntrinsic, std::default_delete<clang::RISCV::RVVIntrinsic>>>>&, std::vector<(anonymous namespace)::SemaRecord, std::allocator<(anonymous namespace)::SemaRecord>>*) (.constprop.0) RISCVVEmitter.cpp:0:0
 #6 0x000000012f6677e4 clang::EmitRVVBuiltins(llvm::RecordKeeper&, llvm::raw_ostream&) (/var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/bin/clang-tblgen+0xc77e4)
 #7 0x000000012f672a34 (anonymous namespace)::ClangTableGenMain(llvm::raw_ostream&, llvm::RecordKeeper&) TableGen.cpp:0:0
 #8 0x000000012f6dace0 llvm::TableGenMain(char const*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&)) (/var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/bin/clang-tblgen+0x13ace0)
 #9 0x000000012f5e952c main (/var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/bin/clang-tblgen+0x4952c)
#10 0x00003fff887e4ba4 (/lib64/libc.so.6+0x24ba4)
#11 0x00003fff887e4e08 __libc_start_main (/lib64/libc.so.6+0x24e08)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/bin/clang-tblgen -gen-riscv-vector-builtins -I /var/tmp/portage/sys-devel/clang-16.0.6/work/clang/include/clang/Basic -I/var/tmp/portage/sys-devel/clang-16.0.6/work/clang/include -I/var/tmp/portage/sys-devel/clang-16.0.6/work/x/y/clang-.ppc64/include -I/usr/lib/llvm/16/include /var/tmp/portage/sys-devel/clang-16.0.6/work/clang/include/clang/Basic/riscv_vector.td --write-if-changed -o include/clang/Basic/riscv_vector_builtins.inc -d include/clang/Basic/riscv_vector_builtins.inc.d
ninja: build stopped: subcommand failed.
 * ERROR: sys-devel/clang-16.0.6::gentoo failed (compile phase):
 *   ninja -v -j1 -l0 distribution failed


I found out it build ok with '-O2', so I checked out a few other options. Seems gcc:13 is the only compiler failing at building sys-devel/clang-16.0.6 with '-Os'.

COMMON_FLAGS="-Os -mcpu=power9 -mtune=power9 -pipe"
gcc-13.2.1_p20230826  ...  FAIL
gcc-12.3.1_p20230526  ...  builds OK
clang-16.0.6          ...  builds OK

COMMON_FLAGS="-O2 -mcpu=power9 -mtune=power9 -pipe"
gcc-13.2.1_p20230826  ...  builds OK
gcc-12.3.1_p20230526  ...  builds OK
clang-16.0.6          ...  builds OK
Comment 1 ernsteiswuerfel archtester 2023-09-28 12:51:58 UTC
Created attachment 871664 [details]
emerge --info
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-09-28 13:04:45 UTC
If you have access to ppc64le: does it happen there?
Comment 3 ernsteiswuerfel archtester 2023-09-28 13:18:38 UTC
(In reply to Sam James from comment #2)
> If you have access to ppc64le: does it happen there?
Nope, sorry. Still no ppc64le partition on my Talos yet. :(
Comment 4 ernsteiswuerfel archtester 2024-02-14 22:55:40 UTC
Created attachment 885000 [details]
build.log (ppc64, 17.0.6)

Same with 17.0.6 on ppc64.

On amd64 clang-17.0.6 builds fine with -Os.
Comment 5 Larry the Git Cow gentoo-dev 2024-03-27 06:26:25 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2af06d2df0b0d41594490a46fb239b1ed587a76d

commit 2af06d2df0b0d41594490a46fb239b1ed587a76d
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-03-27 06:21:13 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-27 06:24:42 +0000

    sys-devel/llvm: add workaround for ppc with < GCC 14
    
    Pass -fno-ipa-sra -fno-ipa-modref -fno-ipa-icf on ppc with < GCC 14. We know
    the problem is related to IPA and these 3 together help. Someone is welcome
    to spend the time trying to narrow it down more, but applying this as a bandaid
    which is better than nothing.
    
    GCC 14 seems fine without this, but the "fix" bisects to something odd
    just like the original "break" commit, so...
    
    Bug: https://gcc.gnu.org/PR108250
    Bug: https://bugs.gentoo.org/914888
    Closes: https://bugs.gentoo.org/880677
    Closes: https://bugs.gentoo.org/875776
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/llvm/llvm-15.0.7-r3.ebuild          | 7 ++++++-
 sys-devel/llvm/llvm-16.0.6.ebuild             | 5 +++++
 sys-devel/llvm/llvm-17.0.6.ebuild             | 5 +++++
 sys-devel/llvm/llvm-18.1.2.ebuild             | 5 +++++
 sys-devel/llvm/llvm-19.0.0.9999.ebuild        | 5 +++++
 sys-devel/llvm/llvm-19.0.0_pre20240316.ebuild | 5 +++++
 sys-devel/llvm/llvm-19.0.0_pre20240322.ebuild | 5 +++++
 7 files changed, 36 insertions(+), 1 deletion(-)
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-27 06:26:50 UTC
The above commit won't fix it on PPC64, but it might be inspiration for a fix/workaround if this is still a problem...