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 <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-8033
https://onedigi.atlassian.net/browse/DEL-8332
This commit is contained in:
Hector Palacios 2023-01-30 10:52:05 +01:00
parent 1467244b04
commit 4e361ff449
2 changed files with 34 additions and 0 deletions

View File

@ -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"

View File

@ -0,0 +1,33 @@
From fe51b132c7c07de5a63c3dfc5a16bc9fc7816f7e Mon Sep 17 00:00:00 2001
From: Hector Palacios <hector.palacios@digi.com>
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 <hector.palacios@digi.com>
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