Skip to contentSkip to conversation

board/qemu/sh4-r2d: fix sh4 kernel bug with Binutils 2.33

PATCH New Romain Naour 2 participants 6 messages Dec 30, 2019 – Jun 24, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board/qemu/sh4-r2d: fix sh4 kernel bug with Binutils 2.33

Remove the Binutils patch reverting [1] that trigger a sh4 kernel bug with Binutils >= 2.33.
Add two kernel patch provided by Alan Modra [2] that fix alignment of rodata.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
[2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.html

---
 .../linux/0002-arch-sh-vmlinux.scr.patch      |  32 ++++
 ...03-include-asm-generic-vmlinux.lds.h.patch |  32 ++++
 .../linux/0002-arch-sh-vmlinux.scr.patch      |  32 ++++
 ...03-include-asm-generic-vmlinux.lds.h.patch |  27 ++++
 ...311-FAIL-S-records-with-constructors.patch | 148 ------------------
 5 files changed, 123 insertions(+), 148 deletions(-)
 create mode 100644 board/qemu/sh4-r2d/patches/linux/0002-arch-sh-vmlinux.scr.patch
 create mode 100644 board/qemu/sh4-r2d/patches/linux/0003-include-asm-generic-vmlinux.lds.h.patch
 create mode 100644 board/qemu/sh4eb-r2d/patches/linux/0002-arch-sh-vmlinux.scr.patch
 create mode 100644 board/qemu/sh4eb-r2d/patches/linux/0003-include-asm-generic-vmlinux.lds.h.patch
 delete mode 100644 package/binutils/2.33.1/0003-Revert-PR24311-FAIL-S-records-with-constructors.patch
board/qemu/sh4-r2d/patches/linux/0002-arch-sh-vmlinux.scr.patch new file +32 -0
new file mode 100644
index 0000000000..941052c2b2
@@ -0,0 +1,32 @@
+From fe657afd48fc67841d32207ef9eeeb5f099764cd Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Sat, 21 Dec 2019 11:52:04 +0100
+Subject: [PATCH 2/3] arch/sh: vmlinux.scr
+
+Building the kernel using a toolchain built with Binutils 2.33.1 prevent
+booting a sh4 system under Qemu.
+Apply the patch provided by Alan Modra [2] that fix alignment of rodata.
+
+[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
+[2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.html
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ arch/sh/boot/compressed/vmlinux.scr | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/sh/boot/compressed/vmlinux.scr b/arch/sh/boot/compressed/vmlinux.scr
+index 862d74808236..dd292b4b9082 100644
+--- a/arch/sh/boot/compressed/vmlinux.scr
++++ b/arch/sh/boot/compressed/vmlinux.scr
+@@ -1,6 +1,6 @@
+ SECTIONS
+ {
+-  .rodata..compressed : {
++  .rodata..compressed : ALIGN(8) {
+ 	input_len = .;
+ 	LONG(input_data_end - input_data) input_data = .;
+ 	*(.data)
+-- 
+2.24.1
+
board/qemu/sh4-r2d/patches/linux/0003-include-asm-generic-vmlinux.lds.h.patch new file +32 -0
new file mode 100644
index 0000000000..3dfa0d3824
@@ -0,0 +1,32 @@
+From 7f92adbba385a4e512abfd6633ac0f9f0cdf91f8 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Sat, 21 Dec 2019 11:54:07 +0100
+Subject: [PATCH 3/3] include/asm-generic: vmlinux.lds.h
+
+Building the kernel using a toolchain built with Binutils 2.33.1 prevent
+booting a sh4 system under Qemu.
+Apply the patch provided by Alan Modra [2] that fix alignment of rodata.
+
+[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
+[2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.html
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ include/asm-generic/vmlinux.lds.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
+index d7701d466b60..1aa33597e91e 100644
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -306,6 +306,7 @@
+  */
+ #ifndef RO_AFTER_INIT_DATA
+ #define RO_AFTER_INIT_DATA						\
++	. = ALIGN(8);							\
+ 	__start_ro_after_init = .;					\
+ 	*(.data..ro_after_init)						\
+ 	__end_ro_after_init = .;
+-- 
+2.24.1
+
board/qemu/sh4eb-r2d/patches/linux/0002-arch-sh-vmlinux.scr.patch new file +32 -0
new file mode 100644
index 0000000000..941052c2b2
@@ -0,0 +1,32 @@
+From fe657afd48fc67841d32207ef9eeeb5f099764cd Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Sat, 21 Dec 2019 11:52:04 +0100
+Subject: [PATCH 2/3] arch/sh: vmlinux.scr
+
+Building the kernel using a toolchain built with Binutils 2.33.1 prevent
+booting a sh4 system under Qemu.
+Apply the patch provided by Alan Modra [2] that fix alignment of rodata.
+
+[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
+[2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.html
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ arch/sh/boot/compressed/vmlinux.scr | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/sh/boot/compressed/vmlinux.scr b/arch/sh/boot/compressed/vmlinux.scr
+index 862d74808236..dd292b4b9082 100644
+--- a/arch/sh/boot/compressed/vmlinux.scr
++++ b/arch/sh/boot/compressed/vmlinux.scr
+@@ -1,6 +1,6 @@
+ SECTIONS
+ {
+-  .rodata..compressed : {
++  .rodata..compressed : ALIGN(8) {
+ 	input_len = .;
+ 	LONG(input_data_end - input_data) input_data = .;
+ 	*(.data)
+-- 
+2.24.1
+
board/qemu/sh4eb-r2d/patches/linux/0003-include-asm-generic-vmlinux.lds.h.patch new file +27 -0
new file mode 100644
index 0000000000..7a4543125c
@@ -0,0 +1,27 @@
+From 7f92adbba385a4e512abfd6633ac0f9f0cdf91f8 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Sat, 21 Dec 2019 11:54:07 +0100
+Subject: [PATCH 3/3] include/asm-generic: vmlinux.lds.h
+
+https://www.sourceware.org/ml/binutils/2019-12/msg00112.html
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ include/asm-generic/vmlinux.lds.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
+index d7701d466b60..1aa33597e91e 100644
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -306,6 +306,7 @@
+  */
+ #ifndef RO_AFTER_INIT_DATA
+ #define RO_AFTER_INIT_DATA						\
++	. = ALIGN(8);							\
+ 	__start_ro_after_init = .;					\
+ 	*(.data..ro_after_init)						\
+ 	__end_ro_after_init = .;
+-- 
+2.24.1
+
package/binutils/2.33.1/0003-Revert-PR24311-FAIL-S-records-with-constructors.patch deleted +0 -148

148 lines not on this page · raw message

Signature · 1 line
2.24.1
#1 lore raw

PATCH 1/1 board/qemu/sh4-r2d: fix sh4 kernel bug with Binutils 2.33

Hello Romain,

Quoted 8 lines · On Mon, 30 Dec 2019 14:36:40 +0100 Romain Naour <[email protected]> wrote:

Remove the Binutils patch reverting [1] that trigger a sh4 kernel bug with Binutils >= 2.33.
Add two kernel patch provided by Alan Modra [2] that fix alignment of rodata.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
[2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.html

Thanks a lot for those fixes. Have the kernel patches been submitted upstream, and accepted?

One issue with your change is of course that now the fix only works when building the specific qemu_sh4 defconfigs. When not using one of those defconfigs, but simply building the regular Linux kernel for SH4, will lead to a kernel that no longer boots.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 board/qemu/sh4-r2d: fix sh4 kernel bug with Binutils 2.33

Hello Thomas,

Le 30/12/2019 ? 14:53, Thomas Petazzoni a ?crit?:

Quoted 9 lines

Hello Romain,

Quoted 4 lines · On Mon, 30 Dec 2019 14:36:40 +0100 Romain Naour <[email protected]> wrote:

Remove the Binutils patch reverting [1] that trigger a sh4 kernel bug with Binutils >= 2.33.
Add two kernel patch provided by Alan Modra [2] that fix alignment of rodata.

Quoted 7 lines
Quoted 4 lines

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
[2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.html

Thanks a lot for those fixes. Have the kernel patches been submitted upstream, and accepted?

Not yet, I replied to Alan Modra to do so [1].

Quoted 5 lines

One issue with your change is of course that now the fix only works when building the specific qemu_sh4 defconfigs. When not using one of those defconfigs, but simply building the regular Linux kernel for SH4, will lead to a kernel that no longer boots.

Indeed but I don't think is great to keep the non-upstream patch I've made reverting [2] for Binutils >= 2.33 for all architectures just to workaround a sh4 kernel bug. At the time I didn't know that was a sh4 kernel bug...

The two sh4 kernel patches are probably easy to backport as soon as a sh4 toolchain using Binutils >= 2.33 is used.

[1] https://www.sourceware.org/ml/binutils/2019-12/msg00386.html
[2]
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e

Best regards,
Romain

Quoted 3 lines

Thomas

#3 lore raw

PATCH 1/1 board/qemu/sh4-r2d: fix sh4 kernel bug with Binutils 2.33

Hello Thomas,

Le 30/12/2019 ? 15:16, Romain Naour a ?crit?:

Quoted 15 lines

Hello Thomas,

Le 30/12/2019 ? 14:53, Thomas Petazzoni a ?crit?:

Quoted 12 lines

Hello Romain,

Quoted 7 lines · On Mon, 30 Dec 2019 14:36:40 +0100 Romain Naour <[email protected]> wrote:

Remove the Binutils patch reverting [1] that trigger a sh4 kernel bug with Binutils >= 2.33.
Add two kernel patch provided by Alan Modra [2] that fix alignment of rodata.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
[2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.html

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Thanks a lot for those fixes. Have the kernel patches been submitted upstream, and accepted?

Not yet, I replied to Alan Modra to do so [1].

I just posted theses two patches to the linux-sh mailing list:

https://patchwork.kernel.org/project/linux-sh/list/?series=256703

We need to move forward to add binutils 2.34.

Best regards,
Romain

Quoted 25 lines
Quoted 6 lines

One issue with your change is of course that now the fix only works when building the specific qemu_sh4 defconfigs. When not using one of those defconfigs, but simply building the regular Linux kernel for SH4, will lead to a kernel that no longer boots.

Indeed but I don't think is great to keep the non-upstream patch I've made reverting [2] for Binutils >= 2.33 for all architectures just to workaround a sh4 kernel bug. At the time I didn't know that was a sh4 kernel bug...

The two sh4 kernel patches are probably easy to backport as soon as a sh4 toolchain using Binutils >= 2.33 is used.

[1] https://www.sourceware.org/ml/binutils/2019-12/msg00386.html
[2]
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e

Best regards,
Romain

Quoted 3 lines

Thomas

#4 lore raw

PATCH 1/1 board/qemu/sh4-r2d: fix sh4 kernel bug with Binutils 2.33

Hello Thomas, All,

Le 15/03/2020 ? 21:46, Romain Naour a ?crit?:

Quoted 23 lines

Hello Thomas,

Le 30/12/2019 ? 15:16, Romain Naour a ?crit?:

Quoted 20 lines

Hello Thomas,

Le 30/12/2019 ? 14:53, Thomas Petazzoni a ?crit?:

Quoted 16 lines

Hello Romain,

Quoted 8 lines · On Mon, 30 Dec 2019 14:36:40 +0100 Romain Naour <[email protected]> wrote:

Remove the Binutils patch reverting [1] that trigger a sh4 kernel bug with Binutils >= 2.33.
Add two kernel patch provided by Alan Modra [2] that fix alignment of rodata.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
[2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.html

Thanks a lot for those fixes. Have the kernel patches been submitted upstream, and accepted?

Quoted 7 lines
Quoted 1 line

Not yet, I replied to Alan Modra to do so [1].

I just posted theses two patches to the linux-sh mailing list:

https://patchwork.kernel.org/project/linux-sh/list/?series=256703

We need to move forward to add binutils 2.34.

Those patches are going to be merged for kernel 5.8 after being acked by kernel maintainers:

https://patchwork.kernel.org/project/linux-sh/list/?series=256703

Best regards,
Romain

Quoted 30 lines

Best regards,
Romain

Quoted 25 lines
Quoted 6 lines

One issue with your change is of course that now the fix only works when building the specific qemu_sh4 defconfigs. When not using one of those defconfigs, but simply building the regular Linux kernel for SH4, will lead to a kernel that no longer boots.

Indeed but I don't think is great to keep the non-upstream patch I've made reverting [2] for Binutils >= 2.33 for all architectures just to workaround a sh4 kernel bug. At the time I didn't know that was a sh4 kernel bug...

The two sh4 kernel patches are probably easy to backport as soon as a sh4 toolchain using Binutils >= 2.33 is used.

[1] https://www.sourceware.org/ml/binutils/2019-12/msg00386.html
[2]
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e

Best regards,
Romain

Quoted 3 lines

Thomas

#5 lore raw

PATCH 1/1 board/qemu/sh4-r2d: fix sh4 kernel bug with Binutils 2.33

In reply to Romain Naour
Quoted 8 lines · On Mon, 30 Dec 2019 14:36:40 +0100 Romain Naour <[email protected]> wrote:

Remove the Binutils patch reverting [1] that trigger a sh4 kernel bug with Binutils >= 2.33.
Add two kernel patch provided by Alan Modra [2] that fix alignment of rodata.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
[2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.html

Quoted 12 lines
---
 .../linux/0002-arch-sh-vmlinux.scr.patch      |  32 ++++
 ...03-include-asm-generic-vmlinux.lds.h.patch |  32 ++++
 .../linux/0002-arch-sh-vmlinux.scr.patch      |  32 ++++
 ...03-include-asm-generic-vmlinux.lds.h.patch |  27 ++++
 ...311-FAIL-S-records-with-constructors.patch | 148 ------------------
 5 files changed, 123 insertions(+), 148 deletions(-)
 create mode 100644 board/qemu/sh4-r2d/patches/linux/0002-arch-sh-vmlinux.scr.patch
 create mode 100644 board/qemu/sh4-r2d/patches/linux/0003-include-asm-generic-vmlinux.lds.h.patch
 create mode 100644 board/qemu/sh4eb-r2d/patches/linux/0002-arch-sh-vmlinux.scr.patch
 create mode 100644 board/qemu/sh4eb-r2d/patches/linux/0003-include-asm-generic-vmlinux.lds.h.patch
 delete mode 100644 package/binutils/2.33.1/0003-Revert-PR24311-FAIL-S-records-with-constructors.patch

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com