From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 228243858431; Mon, 16 Oct 2023 08:46:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 228243858431 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 228243858431 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697446011; cv=none; b=AMTvmbK5EHjOvP1GsrgKeUAkkj2GSGAF8rynSkbPrDHEZ40w43oHsDhNd77aSuI1RcSrdAu1ns1fL9uBryERQVHwwIPQ0nN32mw9A70tFR3/p9i2YAxSykm9BVuEGIdSUNGT5f3l/9Q/GYeK8ZP8q+m5jn8q0snQfDVe6C4aNiQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697446011; c=relaxed/simple; bh=IAeIissx7IsdOd9yzCkLAHOOMNuh0Cnsl//VUOfoqmg=; h=DKIM-Signature:From:Message-Id:Mime-Version:Subject:Date:To; b=P83Hc15W1ztgPX+LA+t7YDESgG6o3PzQ7s89hN9W47NXKmau3Jw8dloT9CvUi3WTpBMWrSWFsDoEi9+IkQN92VnnKCivll0L0ft4lX33RGYQ2sBGW7p/MrP1mbgnatrmhFriTTwLBNwXJUBetKhFxETkL4hpC+M67IrvljO3ea4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c9ba72f6a1so8761965ad.1; Mon, 16 Oct 2023 01:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697446005; x=1698050805; darn=gcc.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=z7eQ3OAsoM93e5JswTTD3CTRa0rT9kADxTH9V47+YVo=; b=KSZ3kiQJ0UyGyKP1mEpkYwADNmNaCFERRjwG9UtFGjR/Fa54Yoj3mtgbH2xVxsFf0x +FMjGzYbh3yuty/FKI9LVd9AV55UM31OipcCmFU58YBJCKaQGH3JUQ04KTrD6r8BBGfE ajHntH+5sUX60VWB2KOtJriwFHSUn6hLAHwVLDU/X6ZYGIihg2mFZ4Y9UZqQEyr7mzVh KTDyMTk/pwvuioXq/EH2ftKG2p7e/zOA/4b64LxcGWFiq4Vtf5qOgZb5sjC+qcOB9ngp bk0bLPQjdEY0bGyiLMOUCac9KYmAFJ+G9zfO7shqUVa7+ChJjrwrslT2LMUzLNPlvvcN diJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697446005; x=1698050805; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=z7eQ3OAsoM93e5JswTTD3CTRa0rT9kADxTH9V47+YVo=; b=o4cGPGnJBjbMDvlJF5/n9dylkdyhyoTcPyevY3QmZ9rXCpjPq5NZfezr6gp41nsuBH BOa5AH6UwlWhIs6GlMLVX7GZrXF9KZs+tdiTf6q3N+gJZT0/jU4DTGxAotc97ys56ke1 UjPErrObq8Olcz7vo3JyJcOmtvrHqQrm7QUdM0f+vVBmeFk35PJJlqBqWNzD4vFRdqxG E0mvb633E9gWGrZl9pAhh+gKQZaUqComuW4NUTkk7+vVZxFxHcM2CkxlhCVdHKzLd5HP Xlp/7pobFqK82bd/pmhwCGu9XUyOM1MYue6ON/PtzGK5Z2FFxUuYmmjm3Nt40nGy0OYu hfcw== X-Gm-Message-State: AOJu0Yz+P2s4wOgoPsODHNYFL1TzuSDtsBHypv5jRaEC1LcoLu6S44y2 i3onGVwMw/ZjvCAlB/SrLq0= X-Google-Smtp-Source: AGHT+IGSMi0dSDnAfC/VC16rTUI/2OAXMySzEEZc3+Il5VLMr0oBabfpKiKSCqt51SpbCeFjBEIZgg== X-Received: by 2002:a05:6a21:a588:b0:163:ab09:196d with SMTP id gd8-20020a056a21a58800b00163ab09196dmr43218849pzc.1.1697446004918; Mon, 16 Oct 2023 01:46:44 -0700 (PDT) Received: from smtpclient.apple (zz20184013906F627101.userreverse.dion.ne.jp. [111.98.113.1]) by smtp.gmail.com with ESMTPSA id jk22-20020a170903331600b001bfd92ec592sm7978733plb.292.2023.10.16.01.46.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2023 01:46:44 -0700 (PDT) From: Tatsuyuki Ishi Message-Id: <397A5BC2-8A85-4B5D-A21D-F378DF7227EB@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_2CE350E3-1E7E-4841-B6D5-7FE4A81B119B" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.100.2.1.4\)) Subject: Re: [PATCH] Do not prepend target triple to -fuse-ld=lld,mold. Date: Mon, 16 Oct 2023 17:46:31 +0900 In-Reply-To: Cc: gcc-patches@gcc.gnu.org, Rui Ueyama , pinskia@gcc.gnu.org, redi@gcc.gnu.org, rguenth@gcc.gnu.org To: Richard Biener References: <20231016050412.9960-1-ishitatsuyuki@gmail.com> X-Mailer: Apple Mail (2.3774.100.2.1.4) X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,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: --Apple-Mail=_2CE350E3-1E7E-4841-B6D5-7FE4A81B119B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Oct 16, 2023, at 17:39, Richard Biener wrote: >=20 > On Mon, 16 Oct 2023, Tatsuyuki Ishi wrote: >=20 >> 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. >>=20 >> 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. >>=20 >> PR driver/111605 >>=20 >> gcc/Changelog: >>=20 >> * collect2.cc (main): Do not prepend target triple to >> -fuse-ld=3Dlld,mold. >> --- >> gcc/collect2.cc | 13 ++++++++----- >> 1 file changed, 8 insertions(+), 5 deletions(-) >>=20 >> 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; >>=20 >> for (i =3D 0; i < USE_LD_MAX; i++) >> - full_ld_suffixes[i] >> #ifdef CROSS_DIRECTORY_STRUCTURE >> - =3D concat (target_machine, "-", ld_suffixes[i], NULL); >> -#else >> - =3D ld_suffixes[i]; >> -#endif >> + /* lld and mold are platform-agnostic and not prefixed with target >> + triple. */ >> + if (!(i =3D=3D USE_LLD_LD || i =3D=3D USE_MOLD_LD)) >> + full_ld_suffixes[i] =3D concat (target_machine, "-", ld_suffixes[= i], >> + NULL); >> + else >> +#endif >> + full_ld_suffixes[i] =3D ld_suffixes[i]; >>=20 >> p =3D argv[0] + strlen (argv[0]); >> while (p !=3D argv[0] && !IS_DIR_SEPARATOR (p[-1])) >=20 > Since we later do >=20 > /* Search the compiler directories for `ld'. We have protection against > recursive calls in find_a_file. */ > if (ld_file_name =3D=3D 0) > ld_file_name =3D find_a_file (&cpath, ld_suffixes[selected_linker],=20 > X_OK); > /* Search the ordinary system bin directories > for `ld' (if native linking) or `TARGET-ld' (if cross). */ > if (ld_file_name =3D=3D 0) > ld_file_name =3D find_a_file (&path, full_ld_suffixes[selected_linker]= ,=20 > X_OK); >=20 > I wonder how having full_ld_suffixes[LLD|MOLD] =3D=3D ld_suffixes[LLD|MOL= D] > fixes anything? Per the linked PR, the intended use case for this is when one wants to use = their system lld/mold with a separately packaged cross toolchain, without r= equiring them to symlink their system lld/mold into the cross toolchain bin= directory. (Note that the first search is against COMPILER_PATH while the latter is ag= ainst PATH). Tatsuyuki. >=20 > Richard. --Apple-Mail=_2CE350E3-1E7E-4841-B6D5-7FE4A81B119B--