The RISC-V toolchain doesn't support leb128 because of linker relaxation to reduce code size. This prevents us from computing the leb128 size of a value at compile time. So do a configure time gas feature check regardless of gas version.
The libiconv configure change comes from the recent config/lib-link.m4 patch. The gcc configure wasn't rebuilt after this change as this was intended for library configure files. Tested with riscv32-elf and arm-eabi combined tree builds. The riscv build fails without the patch and works with the patch where HAVE_AS_LEB128 is now false. The arm build still works and still has HAVE_AS_LEB128 true. OK? Jim gcc/ PR target/91602 * configure.ac (HAVE_AS_LEB128): Delete gas version number in gcc_GAS_CHECK_FEATURE call. * configure: Regenerated. --- gcc/configure | 39 +++++++++++++++++++++++++++------------ gcc/configure.ac | 5 ++++- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/gcc/configure b/gcc/configure index e2c8fc71772..2f57fbf3223 100755 --- a/gcc/configure +++ b/gcc/configure @@ -974,6 +974,7 @@ with_zstd_include with_zstd_lib enable_rpath with_libiconv_prefix +with_libiconv_type enable_sjlj_exceptions with_gcc_major_version_only enable_secureplt @@ -1811,6 +1812,7 @@ Optional Packages: --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libiconv-type=TYPE type of library to search for (auto/static/shared) --with-gcc-major-version-only use only GCC major number in filesystem paths --with-pic try to use only PIC/non-PIC objects [default=use @@ -10730,6 +10732,16 @@ if test "${with_libiconv_prefix+set}" = set; then : fi + +# Check whether --with-libiconv-type was given. +if test "${with_libiconv_type+set}" = set; then : + withval=$with_libiconv_type; with_libiconv_type=$withval +else + with_libiconv_type=auto +fi + + lib_type=`eval echo \$with_libiconv_type` + LIBICONV= LTLIBICONV= INCICONV= @@ -10767,13 +10779,13 @@ fi found_so= found_a= if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext" && test x$lib_type != xstatic; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi - else + elif test x$lib_type != xshared; then if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" @@ -10797,13 +10809,13 @@ fi case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext" && test x$lib_type != xstatic; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi - else + elif test x$lib_type != xshared; then if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" @@ -11031,8 +11043,13 @@ fi done fi else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + if x$lib_type = xauto || x$lib_type = xshared; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l:lib$name.$libext" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l:lib$name.$libext" + fi fi fi fi @@ -23695,18 +23712,16 @@ _ACEOF # Check if we have .[us]leb128, and support symbol arithmetic with it. +# Targets with aggressive linker relaxation to reduce code size may not be +# able to support this regardless of gas version, so we don't pass a gas +# version to force a configure time gas feature check. RISC-V is an example. { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .sleb128 and .uleb128" >&5 $as_echo_n "checking assembler for .sleb128 and .uleb128... " >&6; } if ${gcc_cv_as_leb128+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_leb128=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` - then gcc_cv_as_leb128=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .data .uleb128 L2 - L1 L1: diff --git a/gcc/configure.ac b/gcc/configure.ac index a7521ee9943..a8e7ad91732 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2945,8 +2945,11 @@ AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix) gcc_AC_INITFINI_ARRAY # Check if we have .[us]leb128, and support symbol arithmetic with it. +# Targets with aggressive linker relaxation to reduce code size may not be +# able to support this regardless of gas version, so we don't pass a gas +# version to force a configure time gas feature check. RISC-V is an example. gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128, - [elf,2,11,0],, + ,, [ .data .uleb128 L2 - L1 L1: -- 2.17.1