diff options
author | Robert Schwebel <r.schwebel@pengutronix.de> | 2022-11-23 09:21:16 +0100 |
---|---|---|
committer | Robert Schwebel <r.schwebel@pengutronix.de> | 2022-11-25 21:40:36 +0100 |
commit | 0518f19a28175548825feac8f7e75aca17b0548a (patch) | |
tree | 5f1deb6cc9d25f6e1055cce404b64069750535dd | |
parent | 2e619c77106b615d3eb73b1ed6e05f13837d3b36 (diff) | |
download | DistroKit-0518f19a28175548825feac8f7e75aca17b0548a.tar.gz DistroKit-0518f19a28175548825feac8f7e75aca17b0548a.tar.xz |
tf-a: move patches out of platform
With new binutils, we need a non-platform specific patch for tf-a
that handles executable stacks correctly. As platform specific
patches in ptxdist should only be used for patches that break other
platforms anyway, move the patches to the normal patches directory.
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
-rw-r--r-- | configs/platform-v7a/patches/tf-a-v2.7/series | 1 | ||||
-rw-r--r-- | patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch (renamed from configs/platform-v7a/patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch) | 6 | ||||
-rw-r--r-- | patches/tf-a-v2.7/0002-build-makefile-add-helper-to-detect-linker-options.patch | 39 | ||||
-rw-r--r-- | patches/tf-a-v2.7/0003-feat-build-add-support-for-new-binutils-versions.patch | 38 | ||||
-rw-r--r-- | patches/tf-a-v2.7/0004-makefile-link-with-z-noexecstack.patch | 39 | ||||
-rw-r--r-- | patches/tf-a-v2.7/series | 4 |
6 files changed, 123 insertions, 4 deletions
diff --git a/configs/platform-v7a/patches/tf-a-v2.7/series b/configs/platform-v7a/patches/tf-a-v2.7/series deleted file mode 100644 index 79c39b0..0000000 --- a/configs/platform-v7a/patches/tf-a-v2.7/series +++ /dev/null @@ -1 +0,0 @@ -0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch diff --git a/configs/platform-v7a/patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch b/patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch index 4377783..3ee7268 100644 --- a/configs/platform-v7a/patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch +++ b/patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch @@ -1,8 +1,8 @@ -From 9746daccb7611411a38169f20413ea8445310431 Mon Sep 17 00:00:00 2001 +From 02e0e6ae14a747031c6ba67517c9eee744f4d51d Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum <a.fatoum@pengutronix.de> Date: Thu, 2 Jun 2022 06:28:31 +0200 -Subject: [PATCH] fix(stm32mp1): fdts: stm32mp1: align DDR regulators with new - driver +Subject: [PATCH 1/4] fix(stm32mp1): fdts: stm32mp1: align DDR regulators with + new driver With recent changes, TF-A now panics on LXA MC1, Avernger96 and Odyssey: diff --git a/patches/tf-a-v2.7/0002-build-makefile-add-helper-to-detect-linker-options.patch b/patches/tf-a-v2.7/0002-build-makefile-add-helper-to-detect-linker-options.patch new file mode 100644 index 0000000..d391112 --- /dev/null +++ b/patches/tf-a-v2.7/0002-build-makefile-add-helper-to-detect-linker-options.patch @@ -0,0 +1,39 @@ +From e4e456405177add4df5e21528caa3d873847056a Mon Sep 17 00:00:00 2001 +From: Marco Felsch <m.felsch@pengutronix.de> +Date: Thu, 24 Nov 2022 11:02:05 +0100 +Subject: [PATCH 2/4] build(makefile): add helper to detect linker options + +This is a small helper to check for possible linker options. If the +linker supports the requested option it is returned and if not nothing +will be returned, e.g.: + + TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) + +can be called unconditional. + +Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> +Change-Id: I236800852ece49948ff53a0b91fddba53c8f0f95 +--- + make_helpers/build_macros.mk | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk +index a58caf565163..06caeea19787 100644 +--- a/make_helpers/build_macros.mk ++++ b/make_helpers/build_macros.mk +@@ -86,6 +86,12 @@ define assert_numerics + $(foreach num,$1,$(eval $(call assert_numeric,$(num)))) + endef + ++# Convenience function to check for a given linker option. An call to ++# $(call ld_option, --no-XYZ) will return --no-XYZ if supported by the linker ++define ld_option ++ $(shell if $(LD) $(1) -v >/dev/null 2>&1; then echo $(1); fi ) ++endef ++ + # CREATE_SEQ is a recursive function to create sequence of numbers from 1 to + # $(2) and assign the sequence to $(1) + define CREATE_SEQ +-- +2.30.2 + diff --git a/patches/tf-a-v2.7/0003-feat-build-add-support-for-new-binutils-versions.patch b/patches/tf-a-v2.7/0003-feat-build-add-support-for-new-binutils-versions.patch new file mode 100644 index 0000000..35b2be9 --- /dev/null +++ b/patches/tf-a-v2.7/0003-feat-build-add-support-for-new-binutils-versions.patch @@ -0,0 +1,38 @@ +From b102865225c8db6a4ef60f346aded5959acc4d1c Mon Sep 17 00:00:00 2001 +From: Marco Felsch <m.felsch@pengutronix.de> +Date: Wed, 9 Nov 2022 12:59:09 +0100 +Subject: [PATCH 3/4] feat(build): add support for new binutils versions + +The new ld.bfd linker version has added new warnings which are enabled by +default to secure elf binaries: + - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 + - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774 + +Since the tf-a handles every warning as error we need to tell the linker +to not warn about this. This is required to make the bl31 target +buildable with newer toolchain versions. + +Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> +Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617 +--- + Makefile | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Makefile b/Makefile +index 3941f869800a..af7fd1535694 100644 +--- a/Makefile ++++ b/Makefile +@@ -444,6 +444,10 @@ TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) + endif + endif + ++# With ld.bfd version 2.29 and newer new warnings are added. Skip those since we ++# are not loaded by a elf loader. ++TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) ++ + DTC_FLAGS += -I dts -O dtb + DTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ + -x assembler-with-cpp $(DEFINES) +-- +2.30.2 + diff --git a/patches/tf-a-v2.7/0004-makefile-link-with-z-noexecstack.patch b/patches/tf-a-v2.7/0004-makefile-link-with-z-noexecstack.patch new file mode 100644 index 0000000..5c66e97 --- /dev/null +++ b/patches/tf-a-v2.7/0004-makefile-link-with-z-noexecstack.patch @@ -0,0 +1,39 @@ +From 943df16d58ec8e31cb3e1726998ac6e4cd195284 Mon Sep 17 00:00:00 2001 +From: Robert Schwebel <r.schwebel@pengutronix.de> +Date: Wed, 23 Nov 2022 09:02:59 +0100 +Subject: [PATCH 4/4] makefile: link with -z noexecstack + +Starting with binutils 2.39+, there is a new warning: + + ld: warning: vmlinux: missing .note.GNU-stack section implies executable stack + ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker + ld: warning: vmlinux has a LOAD segment with RWX permissions + +Fix it in a similar way to what the Linux kernel does, see: +https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/ + +Following the reasoning there, we set "-z noexecstack" for all linkers +(although LLVM's LLD defaults to it). + +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de> +--- + Makefile | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Makefile b/Makefile +index af7fd1535694..e4cc77cd41ca 100644 +--- a/Makefile ++++ b/Makefile +@@ -409,6 +409,9 @@ endif + + GCC_V_OUTPUT := $(shell $(CC) -v 2>&1) + ++ ++TF_LDFLAGS += -z noexecstack ++ + # LD = armlink + ifneq ($(findstring armlink,$(notdir $(LD))),) + TF_LDFLAGS += --diag_error=warning --lto_level=O1 +-- +2.30.2 + diff --git a/patches/tf-a-v2.7/series b/patches/tf-a-v2.7/series new file mode 100644 index 0000000..4097cf1 --- /dev/null +++ b/patches/tf-a-v2.7/series @@ -0,0 +1,4 @@ +0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch +0002-build-makefile-add-helper-to-detect-linker-options.patch +0003-feat-build-add-support-for-new-binutils-versions.patch +0004-makefile-link-with-z-noexecstack.patch |