]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
openrisc: place exception table at the head of vmlinux
authorMasahiro Yamada <masahiroy@kernel.org>
Mon, 2 Dec 2024 06:28:22 +0000 (15:28 +0900)
committerStafford Horne <shorne@gmail.com>
Tue, 10 Dec 2024 12:04:19 +0000 (12:04 +0000)
Since commit 0043ecea2399 ("vmlinux.lds.h: Adjust symbol ordering in
text output section"), the exception table in arch/openrisc/kernel/head.S
is no longer positioned at the very beginning of the kernel image, which
causes a boot failure.

Currently, the exception table resides in the regular .text section.
Previously, it was placed at the head by relying on the linker receiving
arch/openrisc/kernel/head.o as the first object. However, this behavior
has changed because sections like .text.{asan,unknown,unlikely,hot} now
precede the regular .text section.

The .head.text section is intended for entry points requiring special
placement. However, in OpenRISC, this section has been misused: instead
of the entry points, it contains boot code meant to be discarded after
booting. This feature is typically handled by the .init.text section.

This commit addresses the issue by replacing the current __HEAD marker
with __INIT and re-annotating the entry points with __HEAD. Additionally,
it adds __REF to entry.S to suppress the following modpost warning:

  WARNING: modpost: vmlinux: section mismatch in reference: _tng_kernel_start+0x70 (section: .text) -> _start (section: .init.text)

Fixes: 0043ecea2399 ("vmlinux.lds.h: Adjust symbol ordering in text output section")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/all/5e032233-5b65-4ad5-ac50-d2eb6c00171c@roeck-us.net/#t
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Rong Xu <xur@google.com>
Signed-off-by: Stafford Horne <shorne@gmail.com>
arch/openrisc/kernel/entry.S
arch/openrisc/kernel/head.S
arch/openrisc/kernel/vmlinux.lds.S
scripts/head-object-list.txt

index 440711d7bf40e3538dcaf9a64c2451079253b9d7..ce6f2b08a35edc6cccd03937344db736031ee9ec 100644 (file)
@@ -239,6 +239,8 @@ handler:                                                    ;\
 
 /* =====================================================[ exceptions] === */
 
+       __REF
+
 /* ---[ 0x100: RESET exception ]----------------------------------------- */
 
 EXCEPTION_ENTRY(_tng_kernel_start)
index 439e00f81e5dde182244d7e90756157c8fc02b7f..ec6d2a7d5b92803f81c5d3da6ac9d8ed77431a7b 100644 (file)
 
 /* =====================================================[ exceptions] === */
 
+       __HEAD
+
 /* ---[ 0x100: RESET exception ]----------------------------------------- */
     .org 0x100
        /* Jump to .init code at _start which lives in the .head section
@@ -506,10 +508,10 @@ _dispatch_do_ipage_fault:
 
 /*    .text*/
 
-/* This early stuff belongs in HEAD, but some of the functions below definitely
+/* This early stuff belongs in the .init.text section, but some of the functions below definitely
  * don't... */
 
-       __HEAD
+       __INIT
        .global _start
 _start:
        /* Init r0 to zero as per spec */
index bc13060478373d785f07305adc2b321e9ffb1ac3..049bff45f612658c3e5658b0ee1a9a86561fda2a 100644 (file)
@@ -50,6 +50,7 @@ SECTIONS
         .text                   : AT(ADDR(.text) - LOAD_OFFSET)
        {
           _stext = .;
+         HEAD_TEXT
          TEXT_TEXT
          SCHED_TEXT
          LOCK_TEXT
@@ -83,8 +84,6 @@ SECTIONS
        . = ALIGN(PAGE_SIZE);
        __init_begin = .;
 
-       HEAD_TEXT_SECTION
-
        /* Page aligned */
        INIT_TEXT_SECTION(PAGE_SIZE)
 
index f12b4a7b8406beef69dc24f14c9c448c319b3806..7274dfc65af6065ff9c13d29d99f2211c3ef9075 100644 (file)
@@ -24,7 +24,6 @@ arch/m68k/kernel/head.o
 arch/m68k/kernel/sun3-head.o
 arch/microblaze/kernel/head.o
 arch/nios2/kernel/head.o
-arch/openrisc/kernel/head.o
 arch/parisc/kernel/head.o
 arch/powerpc/kernel/head_44x.o
 arch/powerpc/kernel/head_64.o