Skip to contentSkip to conversation

zephyr-core/zephyr-kernel: Fix arm32 binutils 2.40 incompatibility

PATCH In review Peter Hoyes 2 participants 2 messages Apr 19, 2023 – Apr 20, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zephyr-core/zephyr-kernel: Fix arm32 binutils 2.40 incompatibility

From: Peter Hoyes <[email protected]>

Armv7 boards are currently failing with binutils 2.40 if certain statements are combined on the same line without a semicolon. Introduce a patch to fix this by inserting a semicolon.

---
 ...x-separator-between-directives-on-sa.patch | 44 +++++++++++++++++++
 .../zephyr-kernel/zephyr-kernel-src-3.3.0.inc |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta-zephyr-core/recipes-kernel/zephyr-kernel/files/0002-3.3-toolchain-gcc-Fix-separator-between-directives-on-sa.patch
meta-zephyr-core/recipes-kernel/zephyr-kernel/files/0002-3.3-toolchain-gcc-Fix-separator-between-directives-on-sa.patch new file +44 -0
new file mode 100644
index 0000000..84750b8
@@ -0,0 +1,44 @@
+From e709258cd766a7b4a3b02e6910f980d501ef1493 Mon Sep 17 00:00:00 2001
+From: Peter Hoyes <[email protected]>
+Date: Sun, 26 Feb 2023 21:18:04 +0000
+Subject: [PATCH] toolchain: gcc: Fix separator between directives on same
+ line
+
+The Arm assembler in binutils 2.40 contains a change [1] which affects
+how multiple directives on the same line are parsed.
+
+Previously, the following combination of directives parsed successfully:
+
+    .code 32 .balign 4
+
+With binutils 2.40, the following error is now seen:
+
+    Error: junk at end of line, first unrecognised character is `.'
+
+To fix, insert a semicolon after '.code 32', as there already is after
+'.thumb'.
+
+[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a37854f9162fac592b669eda53f465fc190c9341
+
+Upstream-Status: Backport [https://github.com/zephyrproject-rtos/zephyr/commit/2f2f3edacdf13bb9bc0be1ce3b80726dce6fb1c0]
+Signed-off-by: Peter Hoyes <[email protected]>
+---
+ include/zephyr/toolchain/gcc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/zephyr/toolchain/gcc.h b/include/zephyr/toolchain/gcc.h
+index ede21a47fe..f81cb0a309 100644
+--- a/include/zephyr/toolchain/gcc.h
++++ b/include/zephyr/toolchain/gcc.h
+@@ -312,7 +312,7 @@ do {                                                                    \
+ 
+ #else
+ 
+-#define FUNC_CODE() .code 32
++#define FUNC_CODE() .code 32;
+ #define FUNC_INSTR(a)
+ 
+ #endif /* CONFIG_ASSEMBLER_ISA_THUMB2 */
+-- 
+2.34.1
+
meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-3.3.0.inc +1 -0
index 245ba81..035c8fa 100644
@@ -116,6 +116,7 @@ SRC_URI_ZEPHYR_THRIFT ?= "git://github.com/zephyrproject-rtos/thrift;protocol=ht
 
 SRC_URI_PATCHES ?= "\
     file://0001-3.3-x86-fix-efi-binary-generation-issue-in-cross-compila.patch;patchdir=zephyr \
+    file://0002-3.3-toolchain-gcc-Fix-separator-between-directives-on-sa.patch;patchdir=zephyr \
 "
 
 SRC_URI = "\
Signature · 1 line
2.34.1
Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · Peter Hoyes

From: Peter Hoyes <[email protected]>

Armv7 boards are currently failing with binutils 2.40 if certain statements are combined on the same line without a semicolon. Introduce a patch to fix this by inserting a semicolon.

CI run against this patch (and the prior series)
https://gitlab.com/jonmason00/meta-zephyr/-/pipelines/843637362

There is still the outstanding issue with qemu-cortex-a9 with the yocto toolchain failing the poll test, but the issues being seen other than that are now fixed.

Quoted 72 lines
---
 ...x-separator-between-directives-on-sa.patch | 44 +++++++++++++++++++
 .../zephyr-kernel/zephyr-kernel-src-3.3.0.inc |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta-zephyr-core/recipes-kernel/zephyr-kernel/files/0002-3.3-toolchain-gcc-Fix-separator-between-directives-on-sa.patch
meta-zephyr-core/recipes-kernel/zephyr-kernel/files/0002-3.3-toolchain-gcc-Fix-separator-between-directives-on-sa.patch new file +44 -0
new file mode 100644
index 0000000..84750b8
@@ -0,0 +1,44 @@
+From e709258cd766a7b4a3b02e6910f980d501ef1493 Mon Sep 17 00:00:00 2001
+From: Peter Hoyes <[email protected]>
+Date: Sun, 26 Feb 2023 21:18:04 +0000
+Subject: [PATCH] toolchain: gcc: Fix separator between directives on same
+ line
+
+The Arm assembler in binutils 2.40 contains a change [1] which affects
+how multiple directives on the same line are parsed.
+
+Previously, the following combination of directives parsed successfully:
+
+    .code 32 .balign 4
+
+With binutils 2.40, the following error is now seen:
+
+    Error: junk at end of line, first unrecognised character is `.'
+
+To fix, insert a semicolon after '.code 32', as there already is after
+'.thumb'.
+
+[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a37854f9162fac592b669eda53f465fc190c9341
+
+Upstream-Status: Backport [https://github.com/zephyrproject-rtos/zephyr/commit/2f2f3edacdf13bb9bc0be1ce3b80726dce6fb1c0]
+Signed-off-by: Peter Hoyes <[email protected]>
+---
+ include/zephyr/toolchain/gcc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/zephyr/toolchain/gcc.h b/include/zephyr/toolchain/gcc.h
+index ede21a47fe..f81cb0a309 100644
+--- a/include/zephyr/toolchain/gcc.h
++++ b/include/zephyr/toolchain/gcc.h
+@@ -312,7 +312,7 @@ do {                                                                    \
+ 
+ #else
+ 
+-#define FUNC_CODE() .code 32
++#define FUNC_CODE() .code 32;
+ #define FUNC_INSTR(a)
+ 
+ #endif /* CONFIG_ASSEMBLER_ISA_THUMB2 */
+-- 
+2.34.1
+
meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src-3.3.0.inc +1 -0
index 245ba81..035c8fa 100644
@@ -116,6 +116,7 @@ SRC_URI_ZEPHYR_THRIFT ?= "git://github.com/zephyrproject-rtos/thrift;protocol=ht
 
 SRC_URI_PATCHES ?= "\
     file://0001-3.3-x86-fix-efi-binary-generation-issue-in-cross-compila.patch;patchdir=zephyr \
+    file://0002-3.3-toolchain-gcc-Fix-separator-between-directives-on-sa.patch;patchdir=zephyr \
 "
 
 SRC_URI = "\
Signature · 1 line
2.34.1