From patchwork Thu Oct 10 14:36:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3562 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id EFC033F263 for ; Thu, 10 Oct 2024 16:37:05 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5c934ceea1fsf798013a12.2 for ; Thu, 10 Oct 2024 07:37:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728571025; cv=pass; d=google.com; s=arc-20240605; b=DcmqickfOzMhvp1jlS05VgGYYcDOz1mPmKgyutah1GekB4QCvxPv6ZRs2I6OKzr7AX uRA10XF7wgK8pFfxFkH6xtoo6DyesOOopGIj3TgTEw5yT2ZDJ+5vjsmwtr+YDrkrrg20 9svy87hcXNtYRMllS4ZTfI2ChctGsbuuapGNfCyxz8MbNuuyruG2SXM5ji4eN7wuURSU y6pX4uMyGoeZKqANojrS5ntwF/wNmyev6bVVb9MIqfTrCfqStMvy9d91nFLmdsy+O3wA 7rqzJaF93we6t19CTKdG0LhvlRZGz+J8pfSN5eTEVGcysm0ORQVEfWelzMtVzXq2Vtty 2lUQ== 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=WSDhD6QbkELLr6XY+NtWTXNOjoPJiy2qJWgpCHW6K2g=; fh=W3N41RbtIPHEggcpRv/ggbBOpQwppAeVA2xZxw/NH8c=; b=FGzLj5dGzUqKZB4UXqFc1FyNxjPKuA9sZis2hbYk3bsljKieFORCMj2bi1C70TOoxV 6IKZ/UBFkVIn1e4c6ukr6tTBFpug3II95y4s/dsSe0MS6XPcxQmRPpNSj8sVHhIzWVUG OXCnPNgTrKvM0h6IDUqY+Z3oM1BpRUcCWxzroZ12Y4+bnEmyfsc6J+xP3tt4/CCPs3KZ FzNlxuoNcNLeTYtLYu2Ov9ZlAvvBUMbNuNYjSm/cL/Lh8aXoBYQdl2mzNWpvxC92s6cx Z2C5guzTX6fNeLvUhV+S/IzqmfZYNFSW2qWgWuT+7YsJBWf7Rx3XdL4pev0mAFeKsIk/ 5mug==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ErNS2QNt; 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=1728571025; x=1729175825; 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=WSDhD6QbkELLr6XY+NtWTXNOjoPJiy2qJWgpCHW6K2g=; b=GSCv1GC5hVcwquW1pfcvnvsmtyz0Kdl/qdvAIVVYgkoUYoawQqrw3hLr1NF/k4B3Zd zVfMdhoGGnwCe2r4QzJ2idE+TKX8QRMYXMSSTT574Wm60eDi0wj0L6NCpwwZF0xYbtHr gb7lUsmakDZuzZdNDU4+OXYG7nBcOWhIdG/HU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728571025; x=1729175825; 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=WSDhD6QbkELLr6XY+NtWTXNOjoPJiy2qJWgpCHW6K2g=; b=tkc25bzebmLHr4nwoeGOtIM6ey/ruVloKwLKcDKL9hY0sKaE+++eAGcaJD35FtbSVc pQ/DWR2GZzkPxEsLo8PVhTlKJLtK8PdtX9KuErzIEh4aQ6Lx04ULlUILUnBVWrW9uWj6 YLt430xdl9nxyrZvk0dBMs6Yorg7ClYJ4CDrBxkdTuF75A7P8nXyOPBumjYkdI3APmlJ 6DshOV6i1tdiCNx0hgtRWsCrWkV+tq+RFo/vNquc5ula0NNb2kmVMO6m7B+IerPbO5mY nrrRjrHCl0XDp+VadlWZM4gPbpUsOAY7tLGsRU633mqcU3KvWRXUM7EswuibrKVf8+j5 0YiQ== X-Forwarded-Encrypted: i=2; AJvYcCUEFB/KhskX1p5FEyz8UF/1kESOTuHOA42ekSsIvLO30SI7/Z4xmwiZ80WoGC6S4vn3pOSNBjm4eRK4MnyW@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyrVW3qhROqccqlYALuU0jYUSrdteVjSJcoUXg15DSfUuYyJnu9 PQoGMCW+QuQnIGJOf/miNT8JH7gh6LKHOYavSoy7LpHzwnKODaPqZPK9WpQfRvS4qA== X-Google-Smtp-Source: AGHT+IGx02P3NGp9ExHiuvTulBVSnasAc3/neRUGuf3EgEBGED34+W4ygOwqtcGEaszGwi5VyWhPzA== X-Received: by 2002:a05:6402:2805:b0:5c8:9f3d:391b with SMTP id 4fb4d7f45d1cf-5c932553ef0mr3226528a12.28.1728571025078; Thu, 10 Oct 2024 07:37:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2683:b0:5c8:9f3e:a9e1 with SMTP id 4fb4d7f45d1cf-5c9338a8db7ls1075402a12.0.-pod-prod-01-eu; Thu, 10 Oct 2024 07:37:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWziv7WRXeGSTCkmn04CAnMIDFvZHhDMOIvgDY4iLcMuZSYQYGPAMAk52yKsfbnXhuqeQr9UFmRSgt6QqBP@amarulasolutions.com X-Received: by 2002:a17:907:7213:b0:a99:40fc:1807 with SMTP id a640c23a62f3a-a999e8cea5fmr377710666b.43.1728571023323; Thu, 10 Oct 2024 07:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728571023; cv=none; d=google.com; s=arc-20240605; b=R2FyS3dhCEutMkD2tZvg5Dv5Flq9x1P33ff7U3ALAa7hm0dMI9deDhQD/N6s57l1ID /NMqH5O6Qru0uW1Q5CTGGAE7vuX+54ugR3iaQ5dZ21eAatYKSZLNuhjbmPnvY2zfBZrJ vd+TIauf2MYagB11aMGxxtoLGgmF10A56KjecvHfHjQHvw+bFNki1JJrb5gEVi5QC/M8 r7cJPmKKn8r7zdvOyGr5D5+SlR9FXOK8EoddTLFzbr7NdyZCT0LOC3ngZtOWk4Q6YRId 1UGa9T2nY3EP+6dhOQfrPgvRou4l5daqQVjUM1HQ133Adf0WRWkFi1WLbmAwYwzBQ9n2 PACQ== 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=FeWdXv10taD45Ph4X5tP/R58qwqdQ1uqXTPuXTtjMPg=; fh=IqB/LJEsYRuGSOd82KfCgUSxVsDLCxtt9g8zmQ1x9qU=; b=cfhniNjxnb5cA7XBQ5Um70/+6MvKKt1mGQ/kCuA+R+w9DdPZzhae3pxabTwRCJLLxg m8YUiYTjEd5J0hewlIOI8F/ohvibgD9WOzxoBhvpuVmIgg4LSsH3eWS4/xKKQf7EBO94 gS7lYXJcacNFpTQLs2flBwDuy4Lu9odQqqhlnJBHsQd3YWkcnzxTIzHx/XmdxAAdHuAI 0b8R5kd5cYPtoAJnrjW//yk72aNhbAbpzIf7tb9f92V5oZHc9QA8vImQNNUr4SVucIpo Kb9H+gXXBGU07MeQWxbDsK0/tosqUP+9NquCVbLC5nr/ukCOvE2kSVhBL1/6hFJQ6uQX F2Eg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ErNS2QNt; 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 a640c23a62f3a-a99a80e056esor53242366b.19.2024.10.10.07.37.03 for (Google Transport Security); Thu, 10 Oct 2024 07:37:03 -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; AJvYcCXO2dF1WcfG9sy5+WOk1p2Sofh9MJfLHjj5lDVCl2uBdVXJMHyKCrBypadHb/kjqTKqH8NGi9bXY5tndPOR@amarulasolutions.com X-Received: by 2002:a17:906:dc8e:b0:a99:6363:8a12 with SMTP id a640c23a62f3a-a999e6280fcmr437814166b.9.1728571022715; Thu, 10 Oct 2024 07:37:02 -0700 (PDT) Received: from localhost.localdomain ([2001:b07:6474:ebbf:a293:3a9f:6dc0:1d29]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a7ec4d14sm97019666b.38.2024.10.10.07.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 07:37:02 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Marleen Vos , Dick Olsson , Thomas Petazzoni , Bartosz Bilas , Sergey Matyukevich , linux-amarula@amarulasolutions.com, Dario Binacchi Subject: [PATCH v3 1/2] boot/arm-trusted-firmware: v2.11: fix the ld autodetection for gnu-gcc Date: Thu, 10 Oct 2024 16:36:58 +0200 Message-ID: <20241010143659.2844375-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=ErNS2QNt; 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 --- - No changes since v2 - 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 +