From nobody Fri Feb 27 17:27:44 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fMwJL0nsKz6SnFD; Fri, 27 Feb 2026 17:27:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fMwJL0DHkz45bc; Fri, 27 Feb 2026 17:27:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772213266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c5/E9LrUYy1kLVkdI7YZG4Um67LBCFZsEQ5XiRopeTA=; b=Oc6XSQoZ9Lidbn6p/XmF8ORpFH5kpq+5+hx8QPj+lH61DuoBU5wQGtD88zlFz9zGZImuUD RaSnO57EB2/BbPHMOnqPNduFcvYoFmAqB/Qe17VdQo9QXid+z/Q8oA9YkcuYSN9K17q0Tg Vueuy0eI6UVl2YcZZs/UEdXqtRiGrCmVxGjXahOMZhnuWUeRwG6i5D6XUQ9sqqtlwwrM0s qPsPXckUj7c/x5r7SjKdqYesSbrgEF0Zmu5FruNo1zGpbwqvq4+JscntOdYfjGfU0+B6Kp cuL0TMN6nPsbzbLxY3Z/eY9DL3KHlKDvNJ43Zr4TCtphHSuy75GlTC6AOT8rDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772213266; a=rsa-sha256; cv=none; b=ebrNDjnhIRN/nTrzUPJvK4Iq7Mp1nyiIo3qg6N+VPlIuGjWNOmiS4mdM+IhZGYLfPIGFX4 w/gVNVNHHwbIUyr/tIt9qchLwE4cUWRI3j8EKUz9xKJZLpzfNiroAcycAGn67ct76DdqoS 0Xp/HIeFDFkqKt0uqesWueXROCppNmGP7fu/pAIeWOoz150oOR52DBaVnDO/y+hadxFmGa yXtG0IBY+gPLggW//kowVPk+detCvVjDrLnF4v8G2/Y5A9QKEQdTwUOKmDZkMZJIOaC/qc B0r0OcU+BumKOjFX9wKu+geMv79NbaMsAdHX8z9tt36T+nNDNXzNrjkEuqdDvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772213266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c5/E9LrUYy1kLVkdI7YZG4Um67LBCFZsEQ5XiRopeTA=; b=RXDfy3KpRpvv+MRdpfPHOpFaIg6a+Cn+tCOeUOvI8TD2DIv6aFRD42wBwM0xhKWnKjcT+t ImkTmbDWK5mlGE5LCjbyWcyRWQs4ZddTMtZR0miRAGVVXd6RyMpDs/h3vRK7ckBALtDz4v nGY6O4PQj2Y7YNN7cd2w0XVJlPh0HQKR9gc6w8HbHugiMqY36mnI8NLKUWq76p0MaMqCyl 404ufyHzTvxzd5pAcFErNUI1s3Lv01dBPIQZFKBUs0O1Jc1sP0MzPMS/bM59Cs5S1OJZK8 /4tKRxQ4TxxDY23cySD+C90GJ96qMYmmjcVhHKPboXX5HsPCvPgajGjCuZeVWA== Received: from [IPV6:2601:5c0:4202:5670:f561:a422:8150:b740] (unknown [IPv6:2601:5c0:4202:5670:f561:a422:8150:b740]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4fMwJK4LgpzGcC; Fri, 27 Feb 2026 17:27:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <23acebb1-f71c-46e6-9eea-3fa44316335d@FreeBSD.org> Date: Fri, 27 Feb 2026 12:27:44 -0500 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: ee73475119ff - main - llvm: Link private LLVM libraries against compiler_rt for aarch64 Content-Language: en-US From: John Baldwin To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , Andrew Turner References: <698a0b1e.1d294.40e36519@gitrepo.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/9/26 11:47, John Baldwin wrote: > On 2/9/26 11:40, Jessica Clarke wrote: >> On 9 Feb 2026, at 16:28, John Baldwin wrote: >>> >>> The branch main has been updated by jhb: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=ee73475119ff7aa98bd11828625d524f6ab87f06 >>> >>> commit ee73475119ff7aa98bd11828625d524f6ab87f06 >>> Author: John Baldwin >>> AuthorDate: 2026-02-09 16:26:52 +0000 >>> Commit: John Baldwin >>> CommitDate: 2026-02-09 16:26:52 +0000 >>> >>> llvm: Link private LLVM libraries against compiler_rt for aarch64 >>> >>> This is required for GCC which uses libcalls for outlined atomics. >> >> This doesn’t seem right, they’re provided by libgcc.a, so why aren’t >> they being pulled in? libcompiler_rt.a doesn’t even have the symbols. > > My guess is that we don't link libraries against libgcc by default, only > binaries (maybe this is a GCC feature/bug vs clang)? I have another review > open for a couple of google test libraries which similarly fail to link. So after some more digging (along with Jessica), it seems that GCC only uses -lgcc_s (and not -lgcc) for C++ (but not C) on both Linux and FreeBSD. clang's FreeBSD toolchain driver is supposed to mimic GCC but doesn't, it applies the C rules even for C++ linking, so clang is implicitly adding both -lgcc and -lgcc_s for C++. On Linux, libgcc.so is a linker script that includes both the dynamic library and -lgcc which is how the static libgcc (including outline atomics for aarch64) is effectively linked into C++ shared libraries on Linux. (Note: libgcc.so is a linker script on seemingly all arches on Linux, not just aarch64) So I think we have a couple of choices here. I can patch the devel/freebsd-gccN ports to stop passing -shared-libgcc to cc1plus which will cause GCC to follow the same rules as clang on FreeBSD (passing -lgcc -as-needed -lgcc_s -no-as-needed instead of -lgcc_s), or we could change libgcc.so to be a linker script to match Linux (and then eventually fix the FreeBSD driver in clang to only pass -lgcc_s for C++ linking) (I think Andrew already has a review to make libgcc.so a linker script). I can see arguments both ways. Using a linker script seems kind of dumb given all the hoops GCC goes to internally to decide whether or not to link only shared or static or both. (Esp given libgcc is in theory part of the compiler, so the compiler should know that libgcc_s should depend on libgcc and be able to encode that in the default drivers.) OTOH, the linker script approach would mean we would more closely align with Linux. I think Jess favors patching GCC. Does anyone else have any strong opinions? -- John Baldwin