From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by sourceware.org (Postfix) with ESMTPS id 20F1F3858D28 for ; Tue, 24 Jan 2023 16:36:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 20F1F3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=cooper.qu@linux.alibaba.com;NM=1;PH=DS;RN=2;SR=0;TI=SMTPD_---0Va8102y_1674578179; Received: from localhost(mailfrom:cooper.qu@linux.alibaba.com fp:SMTPD_---0Va8102y_1674578179) by smtp.aliyun-inc.com; Wed, 25 Jan 2023 00:36:20 +0800 From: Xianmiao Qu To: gcc-patches@gcc.gnu.org Cc: Xianmiao Qu Subject: [COMMITTED] C-SKY: Fix wrong sysroot suffix when disable multilib. Date: Wed, 25 Jan 2023 00:36:07 +0800 Message-Id: <20230124163607.47793-1-cooper.qu@linux.alibaba.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-21.0 required=5.0 tests=BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The SYSROOT_SUFFIX_SPEC works even when multilib is disabled. So when build no-multilib glibc toolchain and the options are not same as MULTILIB_DEFAULTS, the sysroot will specify wrong because the libc will not be installed as such. This bug causes glibc regression test error: https://sourceware.org/pipermail/libc-testresults/2023q1/010706.html The error is: /scratch/jmyers/glibc-bot/install/compilers/csky-linux-gnuabiv2/csky-glibc-linux-gnuabiv2/bin/ld: cannot find -lc: No such file or directory gcc/ * config.gcc(csky-*-linux*): Define CSKY_ENABLE_MULTILIB and only include 'csky/t-csky-linux' when enable multilib. * config/csky/csky-linux-elf.h(SYSROOT_SUFFIX_SPEC): Don't define it when disable multilib. --- gcc/config.gcc | 7 ++++++- gcc/config/csky/csky-linux-elf.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index d828223c16d..89f56047cfe 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1642,7 +1642,12 @@ csky-*-*) ;; csky-*-linux*) tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} csky/csky-linux-elf.h" - tmake_file="${tmake_file} csky/t-csky csky/t-csky-linux" + tmake_file="${tmake_file} csky/t-csky" + + if test "x${enable_multilib}" = xyes ; then + tm_defines="$tm_defines CSKY_ENABLE_MULTILIB" + tmake_file="${tmake_file} csky/t-csky-linux" + fi case ${target} in csky-*-linux-gnu*) diff --git a/gcc/config/csky/csky-linux-elf.h b/gcc/config/csky/csky-linux-elf.h index 3f67af64c15..117c2a12c74 100644 --- a/gcc/config/csky/csky-linux-elf.h +++ b/gcc/config/csky/csky-linux-elf.h @@ -65,6 +65,8 @@ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-cskyv2%{mfloat-abi=hard:-hf}%{mbig-endian:-be}.so.1" +#ifdef CSKY_ENABLE_MULTILIB +#undef SYSROOT_SUFFIX_SPEC #define SYSROOT_SUFFIX_SPEC \ "%{mbig-endian:/big}" \ "%{mcpu=ck807*:/ck807}" \ @@ -72,6 +74,7 @@ "%{mcpu=ck800*:/ck800}" \ "%{mfloat-abi=softfp:/soft-fp}" \ "%{mfloat-abi=hard:/hard-fp}" +#endif #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \ %{b} \ -- 2.32.1 (Apple Git-133)