From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AC3743858CDB; Wed, 10 Apr 2024 10:56:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC3743858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712746577; bh=WiDjKbze3Rh1nM/ovV0rKYG3sB5xJAJGVt8XkZro+nE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WXma04L1gFRoCWOOA7SidE126Z06O61+Ew0E/ylpkcSFs01HdXydyyJTiSzMl1xvV Y6W/HWlE5ZLIILBswDxEDAJUFFKrhhD5XzlhSURw7WDKAGlqEzxQOKQhBF2Wb6ppht 2xvyWP597X9elKHNWpH9k9xLT0zvgQYtGKchdYFQ= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/97304] Boostrap failure on freebsd: ld: error: unable to find library -lc Date: Wed, 10 Apr 2024 10:56:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: build X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97304 --- Comment #14 from Andrew Pinski --- (In reply to Jonathan Wakely from comment #10) > If --with-as=3D/usr/local/bin/as --with-ld=3D/usr/local/bin/ld is require= d then > it needs to be documented at > https://gcc.gnu.org/install/specific.html#x-x-freebsd So what I think is happening is the ld (LLVM's lld) does not include /usr/l= ib by default in the library search path and gcc's driver does not pass -L/usr= /lib -L/lib on to ld because it assumes all ld normally search there by default (which most unix ld did before lld and mold come around). Here is the code inside gcc.cc (is_directory) that excludes them: /* Exclude directories that the linker is known to search. */ if (linker && IS_DIR_SEPARATOR (path[0]) && ((cp - path =3D=3D 6 && filename_ncmp (path + 1, "lib", 3) =3D=3D 0) || (cp - path =3D=3D 10 && filename_ncmp (path + 1, "usr", 3) =3D=3D 0 && IS_DIR_SEPARATOR (path[4]) && filename_ncmp (path + 5, "lib", 3) =3D=3D 0))) return 0; I am suspect we might be able to remove this and it will work but there nee= ds to be a lot of testing on many different targets and such.=