From fbc92e45b3d19ca0313f80245a1d5574eb69ff3a Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Mon, 30 Jan 2023 10:52:05 +0100 Subject: [PATCH] trustfence-cst: fix issue with binutils 2.38 objcopy There is an issue in binutils 2.38 objcopy when called with '--weaken' flag: https://sourceware.org/bugzilla/show_bug.cgi?id=27493 To circumvent it, patch the trustfence-cst config.mk to call specifically with 'weaken-symbol err_msg' which is apparently the only symbol that's overriden by the code. Signed-off-by: Hector Palacios https://onedigi.atlassian.net/browse/DEL-8033 https://onedigi.atlassian.net/browse/DEL-8332 (cherry picked from commit 4e361ff4498fa7eec0bcabb321d99cc3c3364da7) --- .../trustfence-cst/trustfence-cst-3.3.1.inc | 1 + ....mk-weaken-specific-function-err_msg.patch | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0007-rules.mk-weaken-specific-function-err_msg.patch diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-3.3.1.inc b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-3.3.1.inc index 87c050ef7..a9319dfc0 100644 --- a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-3.3.1.inc +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-3.3.1.inc @@ -20,6 +20,7 @@ SRC_URI = " \ file://0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch \ file://0005-ahab_pki_tree.sh-automate-script.patch \ file://0006-ahab_pki_tree.sh-use-a-random-password-for-the-defau.patch \ + file://0007-rules.mk-weaken-specific-function-err_msg.patch \ " SRC_URI[cst.md5sum] = "27ba9c8bc0b8a7f14d23185775c53794" diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0007-rules.mk-weaken-specific-function-err_msg.patch b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0007-rules.mk-weaken-specific-function-err_msg.patch new file mode 100644 index 000000000..03049e35b --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0007-rules.mk-weaken-specific-function-err_msg.patch @@ -0,0 +1,33 @@ +From fe51b132c7c07de5a63c3dfc5a16bc9fc7816f7e Mon Sep 17 00:00:00 2001 +From: Hector Palacios +Date: Mon, 30 Jan 2023 10:38:22 +0100 +Subject: [PATCH] rules.mk: weaken specific function err_msg() + +A bug in binutils 2.38 objcopy '--weaken' produces malformed +binaries. +For the cst, it looks like it's enough to weaken function err_msg() +which is otherwise redefined. +Change the global '--weaken' flag with '--weaken-symbol err_msg' +to have the build process generate a valid 'cst' binary. + +Signed-off-by: Hector Palacios + +https://onedigi.atlassian.net/browse/DEL-8332 +https://onedigi.atlassian.net/browse/DEL-8033 +--- + code/cst/code/build/make/rules.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/code/cst/code/build/make/rules.mk b/code/cst/code/build/make/rules.mk +index 1c0842bd070e..032e18bc5134 100755 +--- a/code/cst/code/build/make/rules.mk ++++ b/code/cst/code/build/make/rules.mk +@@ -27,7 +27,7 @@ LFLAGS := -t + $(AR) $(ARFLAGS) $@ $^ + ifneq ($(OSTYPE),mingw32) + ifneq ($(OSTYPE),osx) +- $(OBJCOPY) --weaken $@ ++ $(OBJCOPY) --weaken-symbol err_msg $@ + endif + endif +