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 0CC7DC07E9D for ; Tue, 27 Sep 2022 19:28:03 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 694FD84B7D; Tue, 27 Sep 2022 21:28:01 +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="GXUWCeYP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F08AD84B7D; Tue, 27 Sep 2022 21:27:59 +0200 (CEST) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (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 31078811C5 for ; Tue, 27 Sep 2022 21:27:57 +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-qk1-x729.google.com with SMTP id c19so6670141qkm.7 for ; Tue, 27 Sep 2022 12:27:57 -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=Kv20S8B0zjMAvPvPAExXY4ZsndYoPf+bXDoDlpNa6ks=; b=GXUWCeYPb1Ajxwb/I4TZqMyi6BbyNb6DtqZPapW4z+uVQiVjqgG+H2WsIUHMG53/96 dUAjOMCnjNElRI1dHxZNhkUsEHjrzVLsQl3Im3DllH6Sa+8sp9mGgN1+VnY+6b6rjU6F aAfB3K1o9JtHm95aF4WTikxvct6+UZPlWXm0A= 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=Kv20S8B0zjMAvPvPAExXY4ZsndYoPf+bXDoDlpNa6ks=; b=SkQmwXQmvp41J/MJjsH+ztHcxoBk1eVE1VUerhR642RD6GC8mDQei/Z+mN0JmRnATC SuIZLSiequDk9Vpj/rH7mhqxfC1xolHEfo9u/yFLiySp5FuFseDDnxQVjMkTB3bRaZeQ EQul03X807c3Jg7RBN5Nk6hHV4goDJKG//dzF0hhkYNx66EBFZzP4xAEUyvyN9DjBzSb qnj/e06/70q3hFuWBPgsnh078rbfk+f4WGH52pMK1Q6zA4klEPdSaeNZMGpHq5kR22RO Vr00uk6sUCgwwJvIjdgvyFw873LqAivP6uSvdE5ZdcR0h639KegnGT3669zFUXwG6iBO 0x3Q== X-Gm-Message-State: ACrzQf3BlKI3BadcP2j5jtVEqbMrXhAhnDzLYzh8EYbLVTk8JsHlX1n6 P9ys/wKMfE+Bvz7w7Qt0lia6ag== X-Google-Smtp-Source: AMsMyM7ojffJyzVXRUkegUs1lndtOXDqcWyDx1qtLdYrnjj5ftb4Qb7VfJZf/r4S+y4eeljLWQ36vw== X-Received: by 2002:a05:620a:28c2:b0:6ce:be30:921 with SMTP id l2-20020a05620a28c200b006cebe300921mr18818072qkp.492.1664306875891; Tue, 27 Sep 2022 12:27:55 -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 n6-20020a05620a294600b006cbc00db595sm1581971qkp.23.2022.09.27.12.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 12:27:55 -0700 (PDT) Date: Tue, 27 Sep 2022 15:27:53 -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: <20220927192753.GT3044094@bill-the-cat> References: <20220926204747.862654-1-adelva@google.com> <20220927155730.GQ3044094@bill-the-cat> <20220927164115.GR3044094@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="n8ucneZ6gTaxrU7s" Content-Disposition: inline In-Reply-To: <20220927164115.GR3044094@bill-the-cat> 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 --n8ucneZ6gTaxrU7s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 27, 2022 at 12:41:15PM -0400, Tom Rini wrote: > 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-l= ibgcc-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. >=20 > 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. >=20 > 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. OK, another new test build, a look at the kernel, and I see a better path forward than it used to be at least. It would be best to: - Port the kernel's current GENERIC_LIB_*DI3 functions - Rename USE_PRIVATE_LIBGCC in U-Boot / drop it, depending on the location (arch/arm/lib/Makefile should just include ashldi3.o and friends on !ARM64). - Port the kernel's arch/powerpc/boot/crtsavres.S for PowerPC which is fairly straight forward looking, even if you aren't a PowerPC person This would be the way forward to drop trying to use libgcc directly, I believe. --=20 Tom --n8ucneZ6gTaxrU7s Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmMzTrUACgkQFHw5/5Y0 tywGDgv+KnQiXT5br0qgiDX5hOQYo98XQ6QjuIRe87A9PNGH/ofiw8mcVRbk/Wj5 AhUh5iZa9hOZHNGSgL/ZBdw8KtsRomJlxCqQj+xoj3Sgf++2Ly4ok9UcGO80z93e 1EAycpQbJdMbxHdEakUN0C+wbn9Trk2YTXcDVPsR+XEe3WtdSuMfG4eKW9/SqQgP vuiPG7khlufMEDWESrXdTICJxTeRL7o/ApXE2bf3ajGEc36LeZlkoszBkj3mDoac q8jUpblgErGzwXWUOgZ7yn8h9ZLTJlHe5MOztb9FMUFwsvp/yVrVoAOOvr0xxZXC zMvvMPXoDDW9l6QeBbQ3Xo40/4V1SGr8qnvxMvHe88bv7OH2BrdT/uD7UtDzrF6+ 9FAbWeQcSH5oQGUrn6vrtvItYdt3Ryv2U9YlyvfUf3kf0dQ2tu+OPcsIHZRMFSyA BY8xdcZKg42ouuYAmvUO2tvTATVgxhFlMJQ4SzRDy83dW/5ooCPitMA4VQh2cz34 R4VbLXLz =Hajp -----END PGP SIGNATURE----- --n8ucneZ6gTaxrU7s--