From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id D30CE3858C54; Mon, 16 Oct 2023 08:39:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D30CE3858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D30CE3858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.220.28 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697445556; cv=none; b=TvLM6JcbneQGRWw3zbBC/2/bJQJaLwy10ad7Pz1UBOV960pZQ8bT4L66zdBkhd9kEOURwGGAajpfe2JawjznqS3TiBRcmHWeJwhsWYsF1HMhVEKMZVsdabuOI8/NTi9jkgezr9QIRRIIwVahPspyPA7show5jS+sT12R6vTCqQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697445556; c=relaxed/simple; bh=/mC5YWoPIrTUFEcrjkF2ywZheSO/m5v3AjkwhwREuwA=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=W10TGcoDGsuB8tpC6l975BwTG5KAX1mqbm/cFAXoyd44Rlza7AvvklqrcNWc9E98ruGSZRngHhQn1noBNXZLmNC74ahdVI6uJrCuCRi+TDfE7pwyB3vxBdGBok8Sr60lhPQ8UhOFyvmSSuribbcREsVqauJXw4JQlHHIX83Ff1A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E125121BD8; Mon, 16 Oct 2023 08:39:11 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A95B52C294; Mon, 16 Oct 2023 08:39:11 +0000 (UTC) Date: Mon, 16 Oct 2023 08:39:11 +0000 (UTC) From: Richard Biener To: Tatsuyuki Ishi cc: gcc-patches@gcc.gnu.org, rui314@gmail.com, pinskia@gcc.gnu.org, redi@gcc.gnu.org, rguenth@gcc.gnu.org Subject: Re: [PATCH] Do not prepend target triple to -fuse-ld=lld,mold. In-Reply-To: <20231016050412.9960-1-ishitatsuyuki@gmail.com> Message-ID: References: <20231016050412.9960-1-ishitatsuyuki@gmail.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Level: Authentication-Results: smtp-out1.suse.de; none X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: E125121BD8 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP 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: On Mon, 16 Oct 2023, Tatsuyuki Ishi wrote: > lld and mold are platform-agnostic and not prefixed with target triple. > Prepending the target triple makes it less likely to find the intended > linker executable. > > A potential breaking change is that we no longer try to search for > triple-prefixed lld/mold binaries anymore. However, since there doesn't > seem to be support to build LLVM or mold with triple-prefixed executable > names, it seems better to just not bother with that case. > > PR driver/111605 > > gcc/Changelog: > > * collect2.cc (main): Do not prepend target triple to > -fuse-ld=lld,mold. > --- > gcc/collect2.cc | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/gcc/collect2.cc b/gcc/collect2.cc > index 63b9a0c233a..c943f9f577c 100644 > --- a/gcc/collect2.cc > +++ b/gcc/collect2.cc > @@ -865,12 +865,15 @@ main (int argc, char **argv) > int i; > > for (i = 0; i < USE_LD_MAX; i++) > - full_ld_suffixes[i] > #ifdef CROSS_DIRECTORY_STRUCTURE > - = concat (target_machine, "-", ld_suffixes[i], NULL); > -#else > - = ld_suffixes[i]; > -#endif > + /* lld and mold are platform-agnostic and not prefixed with target > + triple. */ > + if (!(i == USE_LLD_LD || i == USE_MOLD_LD)) > + full_ld_suffixes[i] = concat (target_machine, "-", ld_suffixes[i], > + NULL); > + else > +#endif > + full_ld_suffixes[i] = ld_suffixes[i]; > > p = argv[0] + strlen (argv[0]); > while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1])) Since we later do /* Search the compiler directories for `ld'. We have protection against recursive calls in find_a_file. */ if (ld_file_name == 0) ld_file_name = find_a_file (&cpath, ld_suffixes[selected_linker], X_OK); /* Search the ordinary system bin directories for `ld' (if native linking) or `TARGET-ld' (if cross). */ if (ld_file_name == 0) ld_file_name = find_a_file (&path, full_ld_suffixes[selected_linker], X_OK); I wonder how having full_ld_suffixes[LLD|MOLD] == ld_suffixes[LLD|MOLD] fixes anything? Richard.