Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 735C1C6FA83 for ; Tue, 27 Sep 2022 16:41:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A872C84DA0; Tue, 27 Sep 2022 18:41:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="t1/SKLev"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F38B984DBF; Tue, 27 Sep 2022 18:41:20 +0200 (CEST) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 854F584A93 for ; Tue, 27 Sep 2022 18:41:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x836.google.com with SMTP id y2so6384752qtv.5 for ; Tue, 27 Sep 2022 09:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=kWhuZw3JOBrZEK7184W/7V1oSrQokYbC+AFPZLrLiTA=; b=t1/SKLevPSsRDZfFeTfBYpA6EtnO2vws6JhzKAH9Yr6vJagOhhs+nCixSaEOJ/pbwM fKubB6a64Y+r01F9Qq6dlt1ViTPymO2b3z9UiXDLFgXdBA5ijorcYd7uiZ6e+OSW8qe/ VeyHCtrlLeW9OzIw7i4ZdYC4UO1Wjfai6Bv5U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=kWhuZw3JOBrZEK7184W/7V1oSrQokYbC+AFPZLrLiTA=; b=GBNm6lJlU7J97DYa+8duccq4cnJO7DTmhI8Ww1CWgTcvggrgQ7BCTeh8S3dyiQAh4C eRB2cvo1CuUjNVG7FSzysoyDbF+qFxTY9mXJKLDmGAR7nuYFLmvhj5/EZcHDaw1v0is9 Mk3qt0MEhw+wanR8MSEQCTz/0NDbvUrUwPZgNZeLtCpUr4fE081RpCfakrfql6WXZNUZ 7TCnaRyRDYJX6ptytmCd94KZY+cH2WGfuW1++UaUw9ocU3ZAmj3FDEt+AhHUo5Bq3BLb zmR/eK40dj3aFud+kikyjQQYGNpC8Calajf0XEv+cW3Nz4Una/nFHoy1TXo/krcZUvvT 1H2A== X-Gm-Message-State: ACrzQf1uHttm28B3Zupoarheuhc2TbPT5qJ85Iv2AJPyS7xSnvKInNYH dOO9GL39htpLV2q07wCx0cDuDQ== X-Google-Smtp-Source: AMsMyM5WXx2XHRSRQM+OzQcTKK/G1sK0FM6yknkIn8p07Nu/j981W9JXqa+iNzTiyHsh8gg6VrrPmw== X-Received: by 2002:a05:622a:d6:b0:35d:49f3:1f6f with SMTP id p22-20020a05622a00d600b0035d49f31f6fmr5074858qtw.408.1664296877356; Tue, 27 Sep 2022 09:41:17 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-5d3f-011a-6fb8-fe6c.res6.spectrum.com. [2603:6081:7b00:6400:5d3f:11a:6fb8:fe6c]) by smtp.gmail.com with ESMTPSA id bc4-20020a05622a1cc400b0035bbc29b3c9sm1018060qtb.60.2022.09.27.09.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 09:41:17 -0700 (PDT) Date: Tue, 27 Sep 2022 12:41:15 -0400 From: Tom Rini To: Alistair Delva Cc: u-boot@lists.denx.de, Simon Glass , Nick Desaulniers Subject: Re: [PATCH] Makefile: Disable PLATFORM_LIBGCC for LLVM toolchain Message-ID: <20220927164115.GR3044094@bill-the-cat> References: <20220926204747.862654-1-adelva@google.com> <20220927155730.GQ3044094@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qCGCnlPZoKZX9mDP" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean --qCGCnlPZoKZX9mDP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 27, 2022 at 09:29:51AM -0700, Alistair Delva wrote: > Hi Tom, >=20 > On Tue, Sep 27, 2022 at 8:57 AM Tom Rini wrote: > > > > On Mon, Sep 26, 2022 at 08:47:47PM +0000, Alistair Delva wrote: > > > > > The LLVM toolchain does not have or need libgcc, so do not require > > > it to exist on the library path. Even if "-print-libgcc-file-name" > > > returned the empty string, -lgcc would be specified. > > > > > > This leaves CONFIG_USE_PRIVATE_LIBGCC alone because I did not have > > > a target/toolchain combination available for testing. > > > > > > Signed-off-by: Alistair Delva > > > Cc: Simon Glass > > > Cc: Tom Rini > > > Cc: Nick Desaulniers > > > --- > > > Makefile | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/Makefile b/Makefile > > > index 8af67ebd63..af06b7aa19 100644 > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -874,8 +874,10 @@ u-boot-main :=3D $(libs-y) > > > ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) > > > PLATFORM_LIBGCC =3D arch/$(ARCH)/lib/lib.a > > > else > > > +ifneq ($(cc-name),clang) > > > PLATFORM_LIBGCC :=3D -L $(shell dirname `$(CC) $(c_flags) -print-lib= gcc-file-name`) -lgcc > > > endif > > > +endif > > > PLATFORM_LIBS +=3D $(PLATFORM_LIBGCC) > > > > > > ifdef CONFIG_CC_COVERAGE > > > > So this one isn't quite right, and will result in some platforms / > > architectures just failing to build as the handful of functions we get > > provided by CONFIG_USE_PRIVATE_LIBGCC end up being missing. > > > > It's also the case that this is a badly named option, and something we > > really should figure out how to remove and then always provide the > > required functions for. What configuration did you end up having this > > problem on exactly? >=20 > We have CI set up for qemu_arm64_defconfig, qemu-x86_64_defconfig, > am57xx_evm_defconfig and rock-pi-4-rk3399_defconfig. I think all were > affected, since they don't use CONFIG_USE_PRIVATE_LIBGCC, so they all > hit this fallback. >=20 > AFAIK, for a long time, Android used an LLVM toolchain built with some > workarounds such as knowledge of a corresponding GCC-based toolchain, > so -print-libgcc-file-name could provide a path to libgcc.a. However, > our newer toolchains no longer do this and the symbols are either > automatically provided or provided by compiler-rt. In U-Boot's case, I > don't think our targets ever required libgcc but because the > fall-through expands to "-L . -lgcc" when -print-libgcc-file-name > returns the empty string, the link will fail because it will look for > libgcc but not find it. OK, that sounds familiar now that you say it, and part of why rpi_arm64 + LLVM isn't part of my local testing loop. I believe I had been thinking the best path forward was to port ashldi3.S and friends from arch/arm64 in the Linux kernel over, so that USE_PRIVATE_LIBGCC (which is a bad name!) could also be select'd on CONFIG_ARM64. That would just leave x86, which just needs a div64 implementation for 64bit? I'm not entirely sure. All of that said, it might also be the case we don't need the fallback to using libgcc at all, in most cases? If you're able to build and test those platforms with it disabled, it might well be the case that we just don't need the fallback anymore, and a world build with that just removed would help figure out if that's true. --=20 Tom --qCGCnlPZoKZX9mDP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmMzJ6YACgkQFHw5/5Y0 tyy4rQwAjZT9eU1IanwfJk9t4GAFjvYwy5fbszGGfu32vqbowSLsSdtK5/pLTsP0 sM0+BNn5yBV/ifHekrbRRhloSy3CDO4JwuD/mHQ5Rt8UGtZ9QCXMdumRYijwrEL4 YRTsRvM7q5VqkSqDL0+HuW0ZhJHZJBkt6N041OQCNfHp8aY+KnxZ1QuuMYIugaoI 2kCEYn1+0tKp7ImDxd46lnRNhU/JLnE/4ii9QtcCdcvWVALjjFMQlW3Yt3R+X8c7 YDiwMvxyABXWIaVbtHBweLhurQiHyRucf8YnxgTitN3W8ZfAjwkvsGK7p8yQawQZ D9Ugwk80Idfmzs4C+Af645g0PjTAzhhXrW/T8XJMDdAUr+woDf6Ls2/mUFoSmuQT 0Np/emgASmd5CVdtZkWFa0TjxGbMEv/IhZsqS9sSPp/7pl8+HcaCZ5wWZV3V9iKo Pn6UVSzolLp+GexeIpM3jOvgZR0noPtjqigQfFVcnOZMEK9IeDexorG6sGT+ylef aKdHGG/r =tzr7 -----END PGP SIGNATURE----- --qCGCnlPZoKZX9mDP--