diff mbox series

[v1,1/1] board/zynqmp: fix atf build failure

Message ID 20230731061113.193556-1-neal.frager@amd.com
State Changes Requested
Headers show
Series [v1,1/1] board/zynqmp: fix atf build failure | expand

Commit Message

Neal Frager July 31, 2023, 6:11 a.m. UTC
Binutils 2.39 now warns when a segment has RXW permissions[1]:

aarch64-buildroot-linux-gnu-ld: bl31.elf has a LOAD segment with RWX
permissions

There is a ticket filed upstream[2], so until that is resolved just
disable the warning

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
[2] https://developer.trustedfirmware.org/T996

Fixes: https://developer.trustedfirmware.org/T996
Signed-off-by: Neal Frager <neal.frager@amd.com>
---
 .../0001-Makefile-no-warn-rwx-segments.patch  | 46 +++++++++++++++++++
 configs/zynqmp_kria_kv260_defconfig           |  2 +-
 configs/zynqmp_zcu102_defconfig               |  1 +
 configs/zynqmp_zcu106_defconfig               |  1 +
 4 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 board/zynqmp/patches/arm-trusted-firmware/0001-Makefile-no-warn-rwx-segments.patch

Comments

Luca Ceresoli July 31, 2023, 12:11 p.m. UTC | #1
Hi Neal,

On Mon, 31 Jul 2023 07:11:13 +0100
Neal Frager <neal.frager@amd.com> wrote:

> Binutils 2.39 now warns when a segment has RXW permissions[1]:
> 
> aarch64-buildroot-linux-gnu-ld: bl31.elf has a LOAD segment with RWX
> permissions
> 
> There is a ticket filed upstream[2], so until that is resolved just
> disable the warning
> 
> [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
> [2] https://developer.trustedfirmware.org/T996
> 
> Fixes: https://developer.trustedfirmware.org/T996
> Signed-off-by: Neal Frager <neal.frager@amd.com>

Despite being a warning, it does actually break the build.

[Build-tested on zynqmp_kria_kv260_defconfig]
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Thomas Petazzoni July 31, 2023, 12:21 p.m. UTC | #2
Hello Neal,

On Mon, 31 Jul 2023 07:11:13 +0100
Neal Frager via buildroot <buildroot@buildroot.org> wrote:

> Binutils 2.39 now warns when a segment has RXW permissions[1]:
> 
> aarch64-buildroot-linux-gnu-ld: bl31.elf has a LOAD segment with RWX
> permissions
> 
> There is a ticket filed upstream[2], so until that is resolved just
> disable the warning
> 
> [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
> [2] https://developer.trustedfirmware.org/T996
> 
> Fixes: https://developer.trustedfirmware.org/T996
> Signed-off-by: Neal Frager <neal.frager@amd.com>

Thanks for this patch. However, could you use upstream's fix instead,
which is
https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c.
We have already integrated it in Buildroot for upstream TF-A versions
2.2 to 2.8 in commit
https://gitlab.com/buildroot.org/buildroot/-/commit/7b774048be6292bb61f90759ad3b7b58a33a1650,
but your defconfigs are using custom versions of TF-A, so our patch is
not applied.

Of course, same suggestion for "[PATCH v1 1/1] board/versal: fix atf
build failure".

Thanks!

Thomas
yegorslists--- via buildroot July 31, 2023, 4:01 p.m. UTC | #3
Hello Thomas,

> Binutils 2.39 now warns when a segment has RXW permissions[1]:
> 
> aarch64-buildroot-linux-gnu-ld: bl31.elf has a LOAD segment with RWX 
> permissions
> 
> There is a ticket filed upstream[2], so until that is resolved just 
> disable the warning
> 
> [1] 
> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb9991
> 2da01a6e8434126b8fac7aa75107 [2] 
> https://developer.trustedfirmware.org/T996
> 
> Fixes: https://developer.trustedfirmware.org/T996
> Signed-off-by: Neal Frager <neal.frager@amd.com>

> Thanks for this patch. However, could you use upstream's fix instead, which is https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c.
> We have already integrated it in Buildroot for upstream TF-A versions
> 2.2 to 2.8 in commit
> https://gitlab.com/buildroot.org/buildroot/-/commit/7b774048be6292bb61f90759ad3b7b58a33a1650,
> but your defconfigs are using custom versions of TF-A, so our patch is not applied.

Thank you for pointing this out.  Are you ok with my just creating a link to the arm-trusted-firmware patch for v2.6 already included in buildroot?

> Of course, same suggestion for "[PATCH v1 1/1] board/versal: fix atf build failure".

Understood.

> Thanks!

> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com

Best regards,
Neal Frager
AMD
Thomas Petazzoni July 31, 2023, 4:07 p.m. UTC | #4
On Mon, 31 Jul 2023 16:01:45 +0000
"Frager, Neal" <neal.frager@amd.com> wrote:

> Thank you for pointing this out.  Are you ok with my just creating a
> link to the arm-trusted-firmware patch for v2.6 already included in
> buildroot?

I saw your patch that use a symbolic link. I don't have a strong
opinion here. On one side, using a symbolic link obviously avoids
duplicating the patch. However, I'm wondering if we will remember to
adjust the symlink in board/zynqmp and board/versal when we
change/remove the patches in boot/arm-trusted/firmware/. Or maybe
AMD/Xilinx will update to a newer TF-A soon, which will no longer
require the bug fix?

Thomas
yegorslists--- via buildroot July 31, 2023, 4:17 p.m. UTC | #5
Hi Thomas,

> Thank you for pointing this out.  Are you ok with my just creating a 
> link to the arm-trusted-firmware patch for v2.6 already included in 
> buildroot?

> I saw your patch that use a symbolic link. I don't have a strong opinion here. On one side, using a symbolic link obviously avoids duplicating the patch. However, I'm wondering if we will remember to adjust the symlink in board/zynqmp and board/versal when we change/remove the patches in boot/arm-trusted/firmware/. Or maybe AMD/Xilinx will update to a newer TF-A soon, which will no longer require the bug fix?

I already have a patch set ready to bump the zynqmp and versal boards to our 2023.1 release which bumps to TF-A v2.8.
I will make sure to update the symbolic links when I submit these patches.

Our 2024.1 release will be based on TF-A v2.10 (or whatever it gets called).  As far as I understand, the patch will no longer be needed when we bump to this version.

At the moment, I am committed to maintaining the zynq, zynqmp and versal defconfigs to follow the AMD/Xilinx release schedule, so I will make sure to handle this.

> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com

Best regards,
Neal Frager
AMD
diff mbox series

Patch

diff --git a/board/zynqmp/patches/arm-trusted-firmware/0001-Makefile-no-warn-rwx-segments.patch b/board/zynqmp/patches/arm-trusted-firmware/0001-Makefile-no-warn-rwx-segments.patch
new file mode 100644
index 0000000000..1a3014ca37
--- /dev/null
+++ b/board/zynqmp/patches/arm-trusted-firmware/0001-Makefile-no-warn-rwx-segments.patch
@@ -0,0 +1,46 @@ 
+From 9e495d1fffd2c7ae18191fe76702eca6a54c0192 Mon Sep 17 00:00:00 2001
+From: Neal Frager <neal.frager@amd.com>
+Date: Mon, 31 Jul 2023 06:39:41 +0100
+Subject: [PATCH v1 1/1] Makefile: no warn rwx segments
+
+Binutils 2.39 now warns when a segment has RXW permissions[1]:
+
+aarch64-buildroot-linux-gnu-ld: bl31.elf has a LOAD segment with RWX
+permissions.
+
+There is a ticket filed upstream[2], so until that is resolved just
+disable the warning.
+
+[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
+[2] https://developer.trustedfirmware.org/T996
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Neal Frager <neal.frager@amd.com>
+---
+ Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index 1ddb7b844..77483eec1 100644
+--- a/Makefile
++++ b/Makefile
+@@ -427,6 +427,7 @@ else ifneq ($(findstring gcc,$(notdir $(LD))),)
+ # Pass ld options with Wl or Xlinker switches
+ TF_LDFLAGS		+=	-Wl,--fatal-warnings -O1
+ TF_LDFLAGS		+=	-Wl,--gc-sections
++TF_LDFLAGS		+=	-Wl,--no-warn-rwx-segment
+ ifeq ($(ENABLE_LTO),1)
+ 	ifeq (${ARCH},aarch64)
+ 		TF_LDFLAGS	+=	-flto -fuse-linker-plugin
+@@ -444,6 +445,7 @@ TF_LDFLAGS		+=	$(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
+ else
+ TF_LDFLAGS		+=	--fatal-warnings -O1
+ TF_LDFLAGS		+=	--gc-sections
++TF_LDFLAGS		+=	--no-warn-rwx-segment
+ # ld.lld doesn't recognize the errata flags,
+ # therefore don't add those in that case
+ ifeq ($(findstring ld.lld,$(notdir $(LD))),)
+-- 
+2.25.1
+
diff --git a/configs/zynqmp_kria_kv260_defconfig b/configs/zynqmp_kria_kv260_defconfig
index e180d5e7e7..8ceaa6983d 100644
--- a/configs/zynqmp_kria_kv260_defconfig
+++ b/configs/zynqmp_kria_kv260_defconfig
@@ -38,4 +38,4 @@  BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
-BR2_GLOBAL_PATCH_DIR="board/zynqmp/kria/patches"
+BR2_GLOBAL_PATCH_DIR="board/zynqmp/kria/patches board/zynqmp/patches"
diff --git a/configs/zynqmp_zcu102_defconfig b/configs/zynqmp_zcu102_defconfig
index 00b33261b6..f4789b9d88 100644
--- a/configs/zynqmp_zcu102_defconfig
+++ b/configs/zynqmp_zcu102_defconfig
@@ -36,3 +36,4 @@  BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
+BR2_GLOBAL_PATCH_DIR="board/zynqmp/patches"
diff --git a/configs/zynqmp_zcu106_defconfig b/configs/zynqmp_zcu106_defconfig
index 88295571af..516f1143ce 100644
--- a/configs/zynqmp_zcu106_defconfig
+++ b/configs/zynqmp_zcu106_defconfig
@@ -36,3 +36,4 @@  BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
+BR2_GLOBAL_PATCH_DIR="board/zynqmp/patches"