From patchwork Sat May 20 20:55:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Edwards X-Patchwork-Id: 1784175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=XHGLwyA0; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QPKkV089Nz20PS for ; Sun, 21 May 2023 22:33:38 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0B22384675; Sun, 21 May 2023 14:33:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XHGLwyA0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C026F846D8; Sat, 20 May 2023 22:56:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (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 156EF846E2 for ; Sat, 20 May 2023 22:55:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=cfsworks@gmail.com Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-64d30ab1ef2so1464791b3a.2 for ; Sat, 20 May 2023 13:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684616157; x=1687208157; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=r/kki8vn4HJqY5nI0fCCLIES5ExP0J3Ss+ns+JOqrVg=; b=XHGLwyA0eoIYtScJ3UFxH/UbfHeaxbwqjeMqOah5uAJeBktThc4AKGzFeVKYLxZNRd xAoLzvBMdFkzlKtWFo2nLFI/rB7ZbaeVWZ9HY8aATRrLEMtMYuPn471l18hpG50pS1Lk Dj7AvXz3f3vFsDZZVHTmM8Sz7neBwZs991cmE4dI5ex51LQrFZ1qaDLbpkBI85fIEvnZ 9YXKJpreF2FRBroIa2h8N4QO4YUFtCA+wl1hQ9sUJsyjPCxeV+fvfrdf21DbNXNou2tP 5U5/5Nhyvy/LmhH/if9du7b0KF8KLMV/SJ6r+d7KSOq1svXYD6w3K8hqD93h/lxnZAsh IWxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684616157; x=1687208157; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=r/kki8vn4HJqY5nI0fCCLIES5ExP0J3Ss+ns+JOqrVg=; b=HcavX+MWvpvSOsVYr7tcHO8gR2Xm1X4brlUHQdvcDXHbVsIRVVgXxfhpnu6FUFoawS OjcwISLS3C+FJI1jGK3xZwFrhGrB94GSDJR4NZbHV6A/N4133fW54BHFm8e2g5s8W8cq dMvR9Jo5xcZ2hDbgi+8KtPZ7ztCWRYBEuBJYqp9l51YzS47WmjTbOuDMHS3KOUXJW83p yCo1hZ/HLGtO0vyrwmBxXtX3a+dgBmA8CuOrduEFHosfQdO2xpNpkcfiJZHZAN0Jjgxx ldLXXMm7YxkXshtwmOYOw5+6nS82apVgKPaDiWYG9LtkA2SOMMXy1jHb6jEfIJjXBxJX 8gPQ== X-Gm-Message-State: AC+VfDzOtxU6d4wgL2FbMwbiNMzBbfsAzX3svXpoqdjNvSxirGJuleYS MB33ovly1LCdNVadd846lc/p1JyzxDRThncX X-Google-Smtp-Source: ACHHUZ5VZsJoA4q89p7jlgirS4jCdteBoBTMdEarhNhTllFKgfqFbrBOJQYaV3++RnYD0jZgf32qLQ== X-Received: by 2002:a05:6a00:18a3:b0:640:e12a:3a20 with SMTP id x35-20020a056a0018a300b00640e12a3a20mr9236482pfh.1.1684616156752; Sat, 20 May 2023 13:55:56 -0700 (PDT) Received: from celestia.nettie.lan (static-198-54-134-172.cust.tzulo.com. [198.54.134.172]) by smtp.gmail.com with ESMTPSA id j17-20020a62e911000000b0064d413caea6sm1651045pfh.179.2023.05.20.13.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 May 2023 13:55:56 -0700 (PDT) From: Sam Edwards X-Google-Original-From: Sam Edwards To: u-boot@lists.denx.de Cc: Sam Edwards , Alper Nebi Yasak , Andrew Scull , Heinrich Schuchardt , Ilias Apalodimas , Kever Yang , =?utf-8?q?Marek_Beh=C3=BAn?= , Michal Simek , Nathan Barrett-Morrison , =?utf-8?q?Pali_Roh?= =?utf-8?q?=C3=A1r?= , Peng Fan , Philip Oberfichtner , Philipp Tomsich , Quentin Schulz , Simon Glass , Tom Rini Subject: [RFC PATCH 00/10] Improve ARM target's support for LLVM toolchain Date: Sat, 20 May 2023 14:55:37 -0600 Message-Id: <20230520205547.1009254-1-CFSworks@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 21 May 2023 14:33:27 +0200 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.8 at phobos.denx.de X-Virus-Status: Clean Here is a series of patches aimed at improving support for the LLVM toolchain (clang, lld, and to a lesser extent, llvm-objcopy) when targeting ARM. This toolchain is a cross-compiler "by default" -- a user generally should not need to install anything more to target their board of choice if they already have Clang installed. Additionally, Clang has a few nice diagnostics that should help appreciably with code quality, if Clang starts to be used regularly by a few more U-Boot developers. ;) Most of these patches are trivial and as such they should be pretty easy to review, but the later patches in the patchset start making some pretty big changes to the linker scripts. There are no behavioral changes with those (U-Boot should still function the same) but there is always the risk of compatibility with some third-party tool or loader being broken. Fortunately, I foresee any problems making themselves immediately apparent upon testing. I have tested booting on sunxi/T113, and building for Raspberry Pi (32-bit and 64-bit). The remaining testing efforts should be focused on: - Exynos - EFI loader (esp. on Lenovo X13s, which Heinrich Schuchardt had mentioned in a previous commit as being fickle) - Zynq - Rockchip TPL - AArch64 SPL I'm submitting this as an RFC since this doesn't completely guarantee LLVM toolchain compatibility yet; my focus here is mostly on ensuring that I haven't caused any regressions in GNU-land. Also, I haven't discussed most of these changes before doing them. Perhaps alternate approaches to some of these things can be proposed - I'm all ears. Outstanding problems are: - LLD sometimes puts .hash outside of the image binary area, though this is flagged by binary_size_check - The main makefile uses --gap-fill=0xff, which is not supported in llvm-objcopy - llvm-objcopy also doesn't appear to speak S-Record; the u-boot.srec target has to be deleted manually - llvm-objcopy gets upset at some of the EFI code, since the EFI linker scripts preserve dynamic sections that llvm-objcopy doesn't want to strip off Cheers, Sam Sam Edwards (10): makefile: Fix symbol typo in binary_size_check arm: set alignment properly for asm funcs arm: exclude eabi_compat from LTO arm: add __aeabi_memclr in eabi_compat arm: add aligned-memory aliases to eabi_compat arm: discard .gnu.version* sections arm: efi_loader: discard hash, unwind information arm: efi_loader: move .dynamic out of .text in EFI arm: discard all .dyn* sections arm: migrate away from sections.c Makefile | 2 +- arch/arm/cpu/armv8/spl_data.c | 4 +- arch/arm/cpu/armv8/u-boot-spl.lds | 26 ++---- arch/arm/cpu/armv8/u-boot.lds | 48 +++-------- arch/arm/cpu/u-boot.lds | 103 +++++++---------------- arch/arm/include/asm/linkage.h | 4 +- arch/arm/lib/Makefile | 3 +- arch/arm/lib/eabi_compat.c | 17 ++++ arch/arm/lib/elf_aarch64_efi.lds | 3 +- arch/arm/lib/elf_arm_efi.lds | 3 + arch/arm/lib/sections.c | 36 -------- arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 26 ++---- arch/arm/mach-zynq/u-boot.lds | 73 +++------------- 13 files changed, 96 insertions(+), 252 deletions(-) delete mode 100644 arch/arm/lib/sections.c