Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

openrisc: place exception table at the head of vmlinux

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>

authored by

Masahiro Yamada and committed by
Stafford Horne
a412f040 fac04efc

+7 -5
+2
arch/openrisc/kernel/entry.S
··· 239 239 240 240 /* =====================================================[ exceptions] === */ 241 241 242 + __REF 243 + 242 244 /* ---[ 0x100: RESET exception ]----------------------------------------- */ 243 245 244 246 EXCEPTION_ENTRY(_tng_kernel_start)
+4 -2
arch/openrisc/kernel/head.S
··· 357 357 358 358 /* =====================================================[ exceptions] === */ 359 359 360 + __HEAD 361 + 360 362 /* ---[ 0x100: RESET exception ]----------------------------------------- */ 361 363 .org 0x100 362 364 /* Jump to .init code at _start which lives in the .head section ··· 508 506 509 507 /* .text*/ 510 508 511 - /* This early stuff belongs in HEAD, but some of the functions below definitely 509 + /* This early stuff belongs in the .init.text section, but some of the functions below definitely 512 510 * don't... */ 513 511 514 - __HEAD 512 + __INIT 515 513 .global _start 516 514 _start: 517 515 /* Init r0 to zero as per spec */
+1 -2
arch/openrisc/kernel/vmlinux.lds.S
··· 50 50 .text : AT(ADDR(.text) - LOAD_OFFSET) 51 51 { 52 52 _stext = .; 53 + HEAD_TEXT 53 54 TEXT_TEXT 54 55 SCHED_TEXT 55 56 LOCK_TEXT ··· 83 82 /* Init code and data */ 84 83 . = ALIGN(PAGE_SIZE); 85 84 __init_begin = .; 86 - 87 - HEAD_TEXT_SECTION 88 85 89 86 /* Page aligned */ 90 87 INIT_TEXT_SECTION(PAGE_SIZE)
-1
scripts/head-object-list.txt
··· 24 24 arch/m68k/kernel/sun3-head.o 25 25 arch/microblaze/kernel/head.o 26 26 arch/nios2/kernel/head.o 27 - arch/openrisc/kernel/head.o 28 27 arch/parisc/kernel/head.o 29 28 arch/powerpc/kernel/head_44x.o 30 29 arch/powerpc/kernel/head_64.o