From patchwork Tue Jan 24 16:36:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianmiao Qu X-Patchwork-Id: 1731283 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=mcjk4MXk; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P1Xg768Kyz23gM for ; Wed, 25 Jan 2023 03:36:49 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 34E603858C83 for ; Tue, 24 Jan 2023 16:36:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34E603858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674578206; bh=cbcc7Qn9DTLtbauUDFx85O+dupv1YEPywZiHo2N5O3k=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=mcjk4MXkX2bZf/L0ahIEjUdNXVd2h3uJpIfDAc23WXpJ6c5jDNOP5N0F9X6wm8vzm SCWOqHPhMN9sIlP9+JlVJKlA1CGvZBM4iNBlMFkf3wBzmAoNxMEjE4M+QmMX2HS5ym d3MDtrFEft9J+822wK74lhCOg2IH3RQOUpILlGug= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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 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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xianmiao Qu via Gcc-patches From: Xianmiao Qu Reply-To: Xianmiao Qu Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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} \