From 8421997dbbacc487ddf192af6fac0004ebd4c44d Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Tue, 30 Aug 2022 16:31:41 +0200 Subject: Revert "imx-atf: fix build error with binutils 2.39" This reverts commit bac8c6af8471addb7add0d1b1ddfbbbd36bed16e. Revert this in favour of a binutils version agnostic patch. Signed-off-by: Max Krummenacher --- recipes-bsp/imx-atf/imx-atf_2.6.bb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes-bsp/imx-atf/imx-atf_2.6.bb b/recipes-bsp/imx-atf/imx-atf_2.6.bb index 1df61cab8..b0426f0b2 100644 --- a/recipes-bsp/imx-atf/imx-atf_2.6.bb +++ b/recipes-bsp/imx-atf/imx-atf_2.6.bb @@ -29,9 +29,7 @@ EXTRA_OEMAKE += " \ # Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application CFLAGS[unexport] = "1" -# Needed for binutils >= 2.39 to prevent build failure. -# imx-atf links with ld, thus no '-Wl,' prefix -LDFLAGS = "--no-warn-rwx-segments" +LDFLAGS[unexport] = "1" AS[unexport] = "1" LD[unexport] = "1" @@ -58,6 +56,7 @@ EXTRA_OEMAKE += 'IMX_BOOT_UART_BASE=${ATF_BOOT_UART_BASE}' do_configure[noexec] = "1" do_compile() { + # Clear LDFLAGS to avoid the option -Wl recognize issue oe_runmake bl31 if ${BUILD_OPTEE}; then oe_runmake clean BUILD_BASE=build-optee -- cgit v1.2.3-54-g00ecf From ff4ee796e67ec3f8de3fa2bd591874dd9fe61999 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Tue, 30 Aug 2022 16:59:13 +0200 Subject: arm/trusted-firmware-a: work around RWX permission error on segment Binutils 2.39 now warns when a segment has RXW permissions[1]: aarch64-none-elf-ld.bfd: warning: bl31.elf has a LOAD segment with RWX permissions However, TF-A passes --fatal-warnings to LD, so this is a build failure. There is a ticket filed upstream[2], so until that is resolved we can disable this warning. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 [2] https://developer.trustedfirmware.org/T996 Signed-off-by: Ross Burton Signed-off-by: Jon Mason Original commit: https://github.com/jonmason/meta-arm/commit/977c5222d8c2f6f6c7e522e480a6e4cd40ba32d7 Reworked commit for imx-atf. Signed-off-by: Max Krummenacher --- recipes-bsp/imx-atf/imx-atf/rwx-segments.patch | 38 ++++++++++++++++++++++++++ recipes-bsp/imx-atf/imx-atf_2.6.bb | 7 +++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 recipes-bsp/imx-atf/imx-atf/rwx-segments.patch diff --git a/recipes-bsp/imx-atf/imx-atf/rwx-segments.patch b/recipes-bsp/imx-atf/imx-atf/rwx-segments.patch new file mode 100644 index 000000000..a4518ec6b --- /dev/null +++ b/recipes-bsp/imx-atf/imx-atf/rwx-segments.patch @@ -0,0 +1,38 @@ +Binutils 2.39 now warns when a segment has RXW permissions[1]: + +aarch64-none-elf-ld.bfd: warning: bl31.elf has a LOAD segment with RWX +permissions + +However, TF-A passes --fatal-warnings to LD, so this is a build failure. + +There is a ticket filed upstream[2], so until that is resolved just +remove --fatal-warnings. + +[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: Ross Burton + +diff --git a/Makefile b/Makefile +index 3941f8698..13bbac348 100644 +--- a/Makefile ++++ b/Makefile +@@ -418,7 +418,7 @@ TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) + # LD = gcc (used when GCC LTO is enabled) + else ifneq ($(findstring gcc,$(notdir $(LD))),) + # Pass ld options with Wl or Xlinker switches +-TF_LDFLAGS += -Wl,--fatal-warnings -O1 ++TF_LDFLAGS += -O1 + TF_LDFLAGS += -Wl,--gc-sections + ifeq ($(ENABLE_LTO),1) + ifeq (${ARCH},aarch64) +@@ -435,7 +435,7 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) + + # LD = gcc-ld (ld) or llvm-ld (ld.lld) or other + else +-TF_LDFLAGS += --fatal-warnings -O1 ++TF_LDFLAGS += -O1 + TF_LDFLAGS += --gc-sections + # ld.lld doesn't recognize the errata flags, + # therefore don't add those in that case diff --git a/recipes-bsp/imx-atf/imx-atf_2.6.bb b/recipes-bsp/imx-atf/imx-atf_2.6.bb index b0426f0b2..3f627150b 100644 --- a/recipes-bsp/imx-atf/imx-atf_2.6.bb +++ b/recipes-bsp/imx-atf/imx-atf_2.6.bb @@ -7,8 +7,11 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-3-Clause;m PV .= "+git${SRCPV}" -SRC_URI = "git://source.codeaurora.org/external/imx/imx-atf.git;protocol=https;branch=${SRCBRANCH} \ - file://0001-Makefile-Suppress-array-bounds-error.patch" +SRC_URI = " \ + git://source.codeaurora.org/external/imx/imx-atf.git;protocol=https;branch=${SRCBRANCH} \ + file://0001-Makefile-Suppress-array-bounds-error.patch \ + file://rwx-segments.patch \ +" SRCBRANCH = "lf_v2.6" SRCREV = "c6a19b1a351308cc73443283f6aa56b2eff791b8" -- cgit v1.2.3-54-g00ecf