https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110812
Bug ID: 110812 Summary: Missing TARGET_OPTION_SAVE/RESTORE on riscv Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: sch...@linux-m68k.org CC: jeffreyalaw at gmail dot com, kito.cheng at gmail dot com, palmer at dabbelt dot com Target Milestone: --- Target: riscv*-*-* The highway package fails to build with LTO: [ 5%] Linking CXX shared library libhwy.so /usr/bin/cmake -E cmake_link_script CMakeFiles/hwy.dir/link.txt --verbose=1 /usr/bin/c++ -fPIC -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -DHWY_COMPILE_ALL_ATTAINABLE -O2 -g -DNDEBUG -Wl,--version-script=/home/abuild/rpmbuild/BUILD/highway-1.0.5/hwy/hwy.version -flto=auto -Wl,--as-needed -Wl,-z,now -shared -Wl,-soname,libhwy.so.1 -o libhwy.so.1.0.5 CMakeFiles/hwy.dir/hwy/aligned_allocator.cc.o CMakeFiles/hwy.dir/hwy/nanobenchmark.cc.o CMakeFiles/hwy.dir/hwy/per_target.cc.o CMakeFiles/hwy.dir/hwy/print.cc.o CMakeFiles/hwy.dir/hwy/targets.cc.o CMakeFiles/hwy.dir/hwy/timer.cc.o lto1: fatal error: target specific builtin not available compilation terminated. lto-wrapper: fatal error: /usr/bin/c++ returned 1 exit status compilation terminated. /usr/lib64/gcc/riscv64-suse-linux/13/../../../../riscv64-suse-linux/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/hwy.dir/build.make:181: libhwy.so.1.0.5] Error 1 Workaround is to add -march=rv64gcv1p0, but the correct fix is to implement TARGET_OPTION_SAVE/RESTORE.