https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91602
Bug ID: 91602
Summary: GCC fails to build for riscv in a combined tree due to
misconfigured leb128 support
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: build, easyhack
Severity: normal
Priority: P3
Component: bootstrap
Assignee: unassigned at gcc dot gnu.org
Reporter: belyshev at depni dot sinp.msu.ru
Target Milestone: ---
Target: riscv*-*-*
gcc_GAS_CHECK_FEATURE enables leb128 support unconditionally for recent enough
gas when using combined tree. As riscv* does not support leb128, it causes
build to fail during libgcc compilation with: "Error: non-constant .uleb128 is
not supported".
A hack to configure.ac like this is needed:
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2798,6 +2798,15 @@ AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
gcc_AC_INITFINI_ARRAY
+# riscv* allows only constant expressions in leb128 pseudos, see comment in
+# gas/config/tc-riscv.c (s_riscv_leb128).
+# ??? when using combined tree, gcc_GAS_CHECK_FEATURE unconditionally checks
+# only version number without trying test input.
+case $target in
+ riscv*)
+ gcc_cv_as_leb128=no
+ ;;
+esac
# Check if we have .[us]leb128, and support symbol arithmetic with it.
gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
[elf,2,11,0],,
(or a better fix reworking gcc_GAS_CHECK_FEATURE and its users.)
This problem was also referenced in bug 87690#c0