Bug 104219 - [12 regression] riscv64 compiler build fails
Summary: [12 regression] riscv64 compiler build fails
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: 12.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build, documentation
Depends on:
Blocks:
 
Reported: 2022-01-25 08:53 UTC by Martin Liška
Modified: 2022-03-09 07:49 UTC (History)
1 user (show)

See Also:
Host: x86_64-linux-gnu
Target: riscv64-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-01-25 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2022-01-25 08:53:18 UTC
[   20s] + ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/12 --enable-ssp --disable-libssp --disable-libvtv --enable-cet=auto --disable-libcc1 --disable-plugin --with-bugurl=https://bugs.opensuse.org/ '--with-pkgversion=SUSE Linux' --with-slibdir=/usr/riscv64-suse-linux/sys-root/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-12 --program-prefix=riscv64-elf- --target=riscv64-elf --disable-nls --with-sysroot=/usr/riscv64-suse-linux/sys-root --with-build-sysroot=/usr/riscv64-suse-linux/sys-root --with-build-time-tools=/usr/riscv64-suse-linux/bin --with-newlib --disable-gcov --disable-multilib --disable-libsanitizer --build=x86_64-suse-linux --host=x86_64-suse-linux

fails due to:

[  204s] checking for suffix of object files... configure: error: in `/home/abuild/rpmbuild/BUILD/gcc-12.0.1+git191254/obj-x86_64-suse-linux/riscv64-elf/libgcc':
[  204s] configure: error: cannot compute suffix of object files: cannot compile
[  204s] See `config.log' for more details

Assembler messages:
Error: cannot find default versions of the ISA extension `zicsr'
configure:3808: $? = 1
configure: failed program was:

for:

as --version
GNU assembler (GNU Binutils; openSUSE Tumbleweed) 2.37.20211112-5

Likely started with g:ca2bbb88f999f4d3cc40e89bc1aba712505dd598.
Comment 1 Andrew Pinski 2022-01-25 09:01:07 UTC
My bet is just the documentation needs ro be updated for a newer binutils version. Riscv is still too new really.
Comment 2 Kito Cheng 2022-01-25 11:56:44 UTC
That's definitely cause by the ISA spec bumping, I tested with binutils trunk but didn't test with 2.37.

Let me fix that to make sure GCC work with older binutils release.
Comment 3 Kito Cheng 2022-01-25 13:06:18 UTC
Patch posted to mailing list:
https://gcc.gnu.org/pipermail/gcc-patches/2022-January/589225.html
Comment 4 CVS Commits 2022-02-05 08:40:57 UTC
The master branch has been updated by Kito Cheng <kito@gcc.gnu.org>:

https://gcc.gnu.org/g:06e32a5ebf20c11dd31bc2677bede569fef84316

commit r12-7070-g06e32a5ebf20c11dd31bc2677bede569fef84316
Author: Kito Cheng <kito.cheng@sifive.com>
Date:   Tue Jan 25 20:44:04 2022 +0800

    RISC-V: Always pass -misa-spec to assembler [PR104219]
    
    Add -misa-spec to OPTION_DEFAULT_SPECS to make sure -misa-spec will
    always pass that into assembler, that prevent GCC and binutils using
    different way to interpret the ISA string.
    
    gcc/ChangeLog:
    
            PR target/104219
            * config.gcc (riscv*-*-*): Normalize the with_isa_spec value.
            (all_defaults): Add isa_spec.
            * config/riscv/riscv.h (OPTION_DEFAULT_SPECS): Add isa_spec.
Comment 5 Kito Cheng 2022-02-07 02:43:52 UTC
I plan back port this fix to GCC 11 branch too, and will close this bug after back port.
Comment 6 CVS Commits 2022-03-09 07:46:42 UTC
The releases/gcc-11 branch has been updated by Kito Cheng <kito@gcc.gnu.org>:

https://gcc.gnu.org/g:9871d39f752bc9c114ed694662a519d04896f491

commit r11-9644-g9871d39f752bc9c114ed694662a519d04896f491
Author: Kito Cheng <kito.cheng@sifive.com>
Date:   Tue Jan 25 20:44:04 2022 +0800

    RISC-V: Always pass -misa-spec to assembler [PR104219]
    
    Add -misa-spec to OPTION_DEFAULT_SPECS to make sure -misa-spec will
    always pass that into assembler, that prevent GCC and binutils using
    different way to interpret the ISA string.
    
    gcc/ChangeLog:
    
            PR target/104219
            * config.gcc (riscv*-*-*): Normalize the with_isa_spec value.
            (all_defaults): Add isa_spec.
            * config/riscv/riscv.h (OPTION_DEFAULT_SPECS): Add isa_spec.
    
    (cherry picked from commit 06e32a5ebf20c11dd31bc2677bede569fef84316)
Comment 7 Kito Cheng 2022-03-09 07:49:27 UTC
Committed to trunk and backported to GCC 11 branch