From patchwork Thu Oct 10 10:42:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3560 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5B1543F263 for ; Thu, 10 Oct 2024 12:42:35 +0200 (CEST) Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-5398863cdfesf604271e87.3 for ; Thu, 10 Oct 2024 03:42:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728556954; cv=pass; d=google.com; s=arc-20240605; b=ZGzzIBAkzAnBQg4MGHV6Z+RxvzWWVDavbaAb55ZDTLnJXNKhRXce721CqYfiNSBHr1 M0pxHX7ZNFhi12m/LNqW0+GmrBJxQSResG54SggPol3mtI0zJiIrCU0Mkx6EWUWtIbW0 ZLR8jnJiKMOPwk8yEn0XQRVQeFiQOmG+5I0CBwKKmZIKpBlCRr7AFegeB051vwFcshUA TaENGth/NMN/LF63lPjQKXVsGzjCoMcDujJD7FC7G/2lqBR5+IAUjZ6a7OtmNzT2nIw0 s5Ok/8j9GSb3UnroeYUOMkBsdyebTOXij215tWM3byo3XKAxVg3BortM8/k2FXV82rZK 8vKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=9TqcRdOUxIkm9wvhm/QSgVdGGgxU4J5O5zPj5mK0wD4=; fh=FWdqoBfkscb00rG1vZDSnQl2YkoqR2wrzEeWGxvMaHc=; b=M+I2shOfTVC9jgwJDJ/3tIstLQCW4YQfXt1FakaHKGqLtj37NlTDJwbGt0Hu2b8iC7 6x17bY50FPuBANFX60sJk1UEHhjqn71hK7kfwSNBROkTYknYSJrImer/w7VKjq5Ca8XC 6AHVAVdDc/poo4mA/P7HBonPgESDpmkSwU826GJjvTkdXDCad6I5IjjEOy4mJrl/b3EH Mt8xSMHhMdVFsKWSWlBj9Qtn9EVxtKpKelhWLZ5VARHtCtin7jzJicerqwpS4UOJRR7+ 1c8PbyRtrRE7xbzKLL7+mnSfAI+RNiHYWOMBUh+AI+0Y+iY7miW1PfyrfRt7slcf3dam EzSw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ddiZJhY0; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1728556954; x=1729161754; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:content-transfer-encoding:mime-version:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=9TqcRdOUxIkm9wvhm/QSgVdGGgxU4J5O5zPj5mK0wD4=; b=W2nyrUjktzFJfBg0BmuUd3PqCYFV9qqclw5Uk9r5jG49ujOpy8WL6TZskv6GjlwAkJ eu1bQT4i7pVQGt5gx7YfsUMrq7/DhRTlekQuMlvr+Z7545OoR4v/nJ8vjDEKtbo72ZYQ mPpOCBzpOOYmqEpYxDF+iOXBNWVDe/yxQTiXY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728556954; x=1729161754; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9TqcRdOUxIkm9wvhm/QSgVdGGgxU4J5O5zPj5mK0wD4=; b=HskkQFRX7tqOIe+nkMrxPDFVg/O/NeQ6Gqhsv+FLI0o04RvMe3ZrYiTaEY65fRRJrH Atdza5XdV/b9CaYuMEh0UREpyIrQvc7LPMc2F6d4P3EJXDhodJ1ycsDarUn4Tw3h60xu 3XrwO/IFkYXYNpSydqyM7BmjyL7y7G4ZoqnAfhm+N2KexekSGpFFNl22DzC1qZQ8EF7q 6OjPOJRQR2IhwTxAeZY08g4cS5I4jQqf4iUnxQ20R5vHUelofLhZLGq4dOoJ5x6Nos/3 k2bZi9D9CAIokI0r8bdbJd7+HtM5xq0CgeIrKCQ6Wd+/foXgRAWr2uNEMm9yeNoZtVr0 hHtQ== X-Forwarded-Encrypted: i=2; AJvYcCXiroeCuaXY3cTO/An85Vhdos/QrJzU0LFZ4c6km4B8ZAhkYnTsBCTo7wVodkOSMW8koWlc8kumnUQRfw2W@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyCw384odQXIiDPvdPfaxaP+E9cxF369/Vm8rxRk+cm/ve/Ytjd QHkTb6Jx2y6qjuyBq0Kbcjq+6aDT3baJOgRrB+SjE36W9Kf3aihL12tEu4JrcDEdoA== X-Google-Smtp-Source: AGHT+IE/37Fpf+YaXEt89ZW7oVvtLaOSePqCY1lx/I27wM39hNuwTaFibPjk+GLthT9OdybvHaqQMg== X-Received: by 2002:a05:6512:33d0:b0:535:63a9:9d8c with SMTP id 2adb3069b0e04-539c4897544mr3537597e87.17.1728556954142; Thu, 10 Oct 2024 03:42:34 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:42c8:b0:5c9:1bfe:e3ab with SMTP id 4fb4d7f45d1cf-5c9338ab5bfls502349a12.0.-pod-prod-02-eu; Thu, 10 Oct 2024 03:42:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUEvp4csJbDt/PG3ADL0AYLDfjMnxU9jUVVdQzcXgisoY/I/ngveHbmKGKsBFZLDIwZeshVW9ueMX873gVT@amarulasolutions.com X-Received: by 2002:a05:6402:2801:b0:5c2:6343:827a with SMTP id 4fb4d7f45d1cf-5c91d6a198emr4303049a12.32.1728556952517; Thu, 10 Oct 2024 03:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728556952; cv=none; d=google.com; s=arc-20240605; b=ChJtzVx8UNUTUXFVC75/39mfGBm6+6UOMPh4CriVP5G9m7cmYqDTjX4tgAzTFSvXOx 6DvjsRJ2yynIlq1STWsxGE4TVI6BfmQRvtTNWgI8pE6aztZGyM9KLRm9+pTBipIaY8RO MS76inzmy1yzL3caT9FUhy/7RnQG1ZhbCmP0vNPtc4gn8sYg/qW0GHzIlkmwQt+MNqzu hsrBLWWo+c3BA+veDQsbX6U+asp85h/eWPGYruil4LYe5rBkxhs0ZZMGqv3TGp/dUI/j IE5m/QwQiY74lzJmD9gCa2QW6Uck0ZXkpBb0sMWx/otR3fr689t7Joyl+Qg2b7mm43OY 0lfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=B0Rexgxv3Sp5KgMQIT3i03UjwBz1Zaka/SdXDBGYC/A=; fh=MWoX0gd9Rvc0F3xJyuOU2WcYB6uYAG2CE36JKAYf5Cs=; b=fSusqF47jTJlWup9x0x3m1HWrsAkzVJtBMrCGBRq6+kCu4Hkxvyj/ar0v0q1RRi1kl uUmBjNMCWuGCzIYJLakYBcFv0s4aFguXxwewop04xVoiaIWrvFu2MHr1yZdSrDtHqEXw SUDBlthNFEJJCFQQVCXbHhLHA7fWW1c7JEjAwBafH5ILZ3LS5tYAGvspPRqMs2fCvnAr AEAydyu9BEALOd4T7Yr9XGbzQTCPmIWzk6+x7VTNsS8+qpoEHEU9BIaLELoQXf3PTtjj JOfot7sd9xRj42E36dZaO6JPLmndqx1INHPKOZXQbnqFBazJ1G6VISE5QJg+KuKM5Zt5 bJsg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ddiZJhY0; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 4fb4d7f45d1cf-5c937257231sor252426a12.8.2024.10.10.03.42.32 for (Google Transport Security); Thu, 10 Oct 2024 03:42:32 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWzBOdu9HRxiRknm4xr4TycjxEa5Y6sb4kJVhDXJega1is/Quz/VHOr0sfsQlDocPTku4rePqo4ntUCteTi@amarulasolutions.com X-Received: by 2002:a05:6402:5243:b0:5c9:3ff:2526 with SMTP id 4fb4d7f45d1cf-5c91d6991b1mr4721139a12.31.1728556951996; Thu, 10 Oct 2024 03:42:31 -0700 (PDT) Received: from localhost.localdomain ([2001:b07:6474:ebbf:a293:3a9f:6dc0:1d29]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c9372940c1sm601652a12.82.2024.10.10.03.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 03:42:31 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Bartosz Bilas , Dick Olsson , Sergey Matyukevich , Thomas Petazzoni , Marleen Vos , linux-amarula@amarulasolutions.com, Dario Binacchi Subject: [PATCH v2 1/2] boot/arm-trusted-firmware: v2.11: fix the ld autodetection for gnu-gcc Date: Thu, 10 Oct 2024 12:42:20 +0200 Message-ID: <20241010104221.2756789-1-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ddiZJhY0; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Before applying this patch, the compiler was used instead of the linker as shown by the following error raised by the compilation of TF-A for the STM32MP157C-DK2 discovery board: 'buildroot/output/host/bin/arm-buildroot-linux-gnueabihf-gcc' -o buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/tf-a-stm32mp157c-dk2.elf -Wl,--hash-style=gnu -Wl,--as-needed -nostartfiles -Wl,-Map=buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/tf-a-stm32mp157c-dk2.map -Wl,-dT buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/stm32mp1.ld buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/stm32mp1-stm32mp157c-dk2.o buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/13.3.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/tf-a-stm32mp157c-dk2.elf: error: PHDR segment not covered by LOAD segment collect2: error: ld returned 1 exit status Signed-off-by: Dario Binacchi --- Added in v2 ...-build-Set-guess-gnu-gcc-ld-properly.patch | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 boot/arm-trusted-firmware/v2.11/0001-fix-build-Set-guess-gnu-gcc-ld-properly.patch diff --git a/boot/arm-trusted-firmware/v2.11/0001-fix-build-Set-guess-gnu-gcc-ld-properly.patch b/boot/arm-trusted-firmware/v2.11/0001-fix-build-Set-guess-gnu-gcc-ld-properly.patch new file mode 100644 index 000000000000..a6731aa08853 --- /dev/null +++ b/boot/arm-trusted-firmware/v2.11/0001-fix-build-Set-guess-gnu-gcc-ld-properly.patch @@ -0,0 +1,53 @@ +From 7988f1afe1324486e473874b22ed009c0d6d6806 Mon Sep 17 00:00:00 2001 +From: Dario Binacchi +Date: Wed, 9 Oct 2024 18:29:00 +0200 +Subject: [PATCH] fix(build): Set guess-gnu-gcc-ld properly + +With the commit 291e718229e7f ("build: skip toolchain detection for some +targets"), the compiler was used instead of the linker: + ++ guess-gnu-gcc-cpp = $(1) ++ guess-gnu-gcc-as = $(1) ++ guess-gnu-gcc-ld = $(1) + +This patch correctly references the linker for gnu-gcc. + +The patch was tested on the STM32MP157C-DK2 board. + +This is the error raised during the compilation of ARM Trusted Firmware +v2.11 before applying the patch + +'buildroot/output/host/bin/arm-buildroot-linux-gnueabihf-gcc' -o buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/tf-a-stm32mp157c-dk2.elf -Wl,--hash-style=gnu -Wl,--as-needed -nostartfiles -Wl,-Map=buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/tf-a-stm32mp157c-dk2.map -Wl,-dT buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/stm32mp1.ld buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/stm32mp1-stm32mp157c-dk2.o +buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/13.3.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: buildroot/output/build/arm-trusted-firmware-custom/build/stm32mp1/release/tf-a-stm32mp157c-dk2.elf: error: PHDR segment not covered by LOAD segment +collect2: error: ld returned 1 exit status + +Below, after applying the patch: + +'buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/13.3.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld' -o buildroot/output/build/arm-trusted-firmware-v2.11/build/stm32mp1/release/tf-a-stm32mp157c-dk2.elf --hash-style=gnu --as-needed -Map=buildroot/output/build/arm-trusted-firmware-v2.11/build/stm32mp1/release/tf-a-stm32mp157c-dk2.map --script buildroot/output/build/arm-trusted-firmware-v2.11/build/stm32mp1/release/stm32mp1.ld buildroot/output/build/arm-trusted-firmware-v2.11/build/stm32mp1/release/stm32mp1-stm32mp157c-dk2.o +'buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/13.3.0/../../../../arm-buildroot-linux-gnueabihf/bin/objcopy' -O binary buildroot/output/build/arm-trusted-firmware-v2.11/build/stm32mp1/release/tf-a-stm32mp157c-dk2.elf buildroot/output/build/arm-trusted-firmware-v2.11/build/stm32mp1/release/tf-a-stm32mp157c-dk2.bin + +Built /home/dario/projects/buildroot-10/output/build/arm-trusted-firmware-v2.11/build/stm32mp1/release/tf-a-stm32mp157c-dk2.bin successfully + +Fixes: 291e718229e7f ("build: skip toolchain detection for some targets") +Signed-off-by: Dario Binacchi +Upstream: backport from upstream https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/31746 +--- + make_helpers/toolchain.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/make_helpers/toolchain.mk b/make_helpers/toolchain.mk +index 96e43a8b94cb..a81be3751d86 100644 +--- a/make_helpers/toolchain.mk ++++ b/make_helpers/toolchain.mk +@@ -286,7 +286,7 @@ ifndef toolchain-mk + + guess-gnu-gcc-cpp = $(1) + guess-gnu-gcc-as = $(1) +- guess-gnu-gcc-ld = $(1) ++ guess-gnu-gcc-ld = $(shell $(1) --print-prog-name ld 2>$(nul)) + guess-gnu-gcc-oc = $(shell $(1) --print-prog-name objcopy 2>$(nul)) + guess-gnu-gcc-od = $(shell $(1) --print-prog-name objdump 2>$(nul)) + guess-gnu-gcc-ar = $(call which,$(call decompat-path,$(patsubst %$(call file-name,$(1)),%$(subst gcc,gcc-ar,$(call file-name,$(1))),$(call compat-path,$(1))))) +-- +2.43.0 +