From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117643 invoked by alias); 30 Jan 2020 22:36:19 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 117629 invoked by uid 89); 30 Jan 2020 22:36:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=sk:gcc_gas, sk:gcc_GAS, HX-Gm-Message-State:APjAAAVi X-HELO: mail-pg1-f195.google.com Received: from mail-pg1-f195.google.com (HELO mail-pg1-f195.google.com) (209.85.215.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Jan 2020 22:36:11 +0000 Received: by mail-pg1-f195.google.com with SMTP id 6so2410222pgk.0 for ; Thu, 30 Jan 2020 14:36:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id; bh=d/RXMD9VBNFMKJSE6bbJJVST2P6yBi9dyhgtfp0vbjE=; b=HjJis58zRM0/XXmYNk2+23WZW2b6J6ulhhUlpyRTuVFPPx7shiRu6SOAv7ZOAqiFvP cnSMgFeNxChbLWmyPQ2MpmryUcnYemuGVT9p0CGrQ6sMJTHf2EI+4pxw2Oixdk4BiyFf Se2vnY0/yogd1UFUIBd3V+B7fsBmleDU+R/7symc4d9Ezo1ykPGH1MbN6vKqGetoj2ne bN3ww9xn0IxnaHchuJpPxzKqLkiKCaaebHpQoMAbZvqwvXOQXu0rCHzpEw0mrWuMgDCG g7DlQFTke6ZaMAe0D3SsPdhCkK1UYbrDUu4jnYiiX5ARY23emhEQ5l48VC766jxrFltv QWrA== Return-Path: Received: from rohan.sifive.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id w4sm7510662pjt.23.2020.01.30.14.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jan 2020 14:36:08 -0800 (PST) From: Jim Wilson To: gcc-patches@gcc.gnu.org Cc: Jim Wilson Subject: [PATCH] RISC-V: Fix combined tree builds. Date: Fri, 31 Jan 2020 00:10:00 -0000 Message-Id: <20200130223606.23481-1-jimw@sifive.com> X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg02042.txt.bz2 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