From 22bdaf77674cf219e8ce899dac9263b63ea9f432 Mon Sep 17 00:00:00 2001
From: Mark Hatle <mark.hatle@kernel.crashing.org>
Date: Thu, 1 Sep 2022 18:10:45 -0500
Subject: [PATCH] arm-trusted-firmware: Workaround for latest binutils

Current binutils adds a warning:

  bl31.elf has a LOAD segment with RWX permissions

--fatal-warnings is enabled when linking, so this triggers a link failure.

Workaround this with --no-warn-rwx-segments.

Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
 .../arm-trusted-firmware/arm-trusted-firmware.inc            | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc
index ed391160b..c2d272ef1 100644
--- a/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc
+++ b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc
@@ -71,12 +71,15 @@ EXTRA_OEMAKE:append:versal = "${@' VERSAL_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.get
 ATF_PROVENCORE = "SPD=pncd SPD_PNCD_NS_IRQ=51 ZYNQMP_BL32_MEM_BASE=0x70000000 ZYNQMP_BL32_MEM_SIZE=0x0FF00000"
 EXTRA_OEMAKE:append = "${@bb.utils.contains('MACHINE_FEATURES', 'provencore', ' ${ATF_PROVENCORE}', '', d)}"
 
+# Workaround for bl31.elf has a LOAD segment with RWX permissions
+EXTRA_OEMAKE:append = ' TF_LDFLAGS="--no-warn-rwx-segments --fatal-warnings -O1 --gc-sections"'
+
 do_configure() {
 	oe_runmake clean -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM}
 }
 
 do_compile() {
-	oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31
+	oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31 V=1
 }
 
 do_install() {