From: Christian Zietz via B4 Relay <devnull+czietz.gmx.net@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
Sam Creasey <sammy@sammy.net>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
Christian Zietz <czietz@gmx.net>
Subject: [PATCH] m68k: Preserve fixups during dead code elimination
Date: Sat, 14 Nov 2026 10:15:49 +0100 [thread overview]
Message-ID: <20261113-fix_deadcode_elimination_for_tt_ram-v1-1-a6aa8e7cb90c@gmx.net> (raw)
From: Christian Zietz <czietz@gmx.net>
A kernel built with CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y panics when
loaded into TT-RAM (starting at address 0x01000000) on Atari. This is
due to the .m68k_fixup section being removed by the linker's dead code
elimination. Thus, the kernel is not fixed up for the TT-RAM address.
KEEP() ensures the fixups are always kept in the kernel binary.
Tested on an Atari TT and under Hatari emulation.
Fixes: 4fbdd56edf1f ("m68k: Enable dead code elimination")
Signed-off-by: Christian Zietz <czietz@gmx.net>
---
For reference, here is the objdump output of a kernel built with
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y that shows .m68k_fixup is
missing:
m68k-linux-gnu-objdump -s -j .m68k_fixup vmlinux
vmlinux: file format elf32-m68k
m68k-linux-gnu-objdump: section '.m68k_fixup' mentioned in a -j option,
but not found in any input file
... versus after applying the patch:
m68k-linux-gnu-objdump -s -j .m68k_fixup vmlinux
vmlinux: file format elf32-m68k
Contents of section .m68k_fixup:
3c5a8c 00000000 003a8478 00000000 003aa6f8 .....:.x.....:..
3c5a9c 00000000 003aaafe 00000000 0000b5ae .....:..........
3c5aac 00000000 003aaed4 00000000 003aaefa .....:.......:..
3c5abc 00000000 0000c5f6 00000000 0000c61c ................
[...]
---
arch/m68k/kernel/vmlinux-nommu.lds | 2 +-
arch/m68k/kernel/vmlinux-std.lds | 2 +-
arch/m68k/kernel/vmlinux-sun3.lds | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/m68k/kernel/vmlinux-nommu.lds b/arch/m68k/kernel/vmlinux-nommu.lds
index 45d7f4b01..485bbc24a 100644
--- a/arch/m68k/kernel/vmlinux-nommu.lds
+++ b/arch/m68k/kernel/vmlinux-nommu.lds
@@ -72,7 +72,7 @@ SECTIONS {
PERCPU_SECTION(16)
.m68k_fixup : {
__start_fixup = .;
- *(.m68k_fixup)
+ KEEP(*(.m68k_fixup))
__stop_fixup = .;
}
.init.data : {
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 7326586af..8783df430 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -45,7 +45,7 @@ SECTIONS
INIT_DATA_SECTION(16)
.m68k_fixup : {
__start_fixup = .;
- *(.m68k_fixup)
+ KEEP(*(.m68k_fixup))
__stop_fixup = .;
}
.init_end : {
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index 1b19fef20..8be83d13d 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -40,7 +40,7 @@ __init_begin = .;
INIT_DATA_SECTION(16)
.m68k_fixup : {
__start_fixup = .;
- *(.m68k_fixup)
+ KEEP(*(.m68k_fixup))
__stop_fixup = .;
}
. = ALIGN(PAGE_SIZE);
---
base-commit: 8c9ddebb300c719362a52a2d465f44e7d055778d
change-id: 20261113-fix_deadcode_elimination_for_tt_ram-6629928148f6
Best regards,
--
Christian Zietz <czietz@gmx.net>
reply other threads:[~2026-11-14 9:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261113-fix_deadcode_elimination_for_tt_ram-v1-1-a6aa8e7cb90c@gmx.net \
--to=devnull+czietz.gmx.net@kernel.org \
--cc=czietz@gmx.net \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=sammy@sammy.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®