Skip to content

Commit a412f04

Browse files
masahir0ystffrdhrn
authored andcommitted
openrisc: place exception table at the head of vmlinux
Since commit 0043ece ("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: 0043ece ("vmlinux.lds.h: Adjust symbol ordering in text output section") Reported-by: Guenter Roeck <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/#t Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Guenter Roeck <[email protected]> Reviewed-by: Rong Xu <[email protected]> Signed-off-by: Stafford Horne <[email protected]>
1 parent fac04ef commit a412f04

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

arch/openrisc/kernel/entry.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ handler: ;\
239239

240240
/* =====================================================[ exceptions] === */
241241

242+
__REF
243+
242244
/* ---[ 0x100: RESET exception ]----------------------------------------- */
243245

244246
EXCEPTION_ENTRY(_tng_kernel_start)

arch/openrisc/kernel/head.S

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@
357357

358358
/* =====================================================[ exceptions] === */
359359

360+
__HEAD
361+
360362
/* ---[ 0x100: RESET exception ]----------------------------------------- */
361363
.org 0x100
362364
/* Jump to .init code at _start which lives in the .head section
@@ -506,10 +508,10 @@ _dispatch_do_ipage_fault:
506508

507509
/* .text*/
508510

509-
/* This early stuff belongs in HEAD, but some of the functions below definitely
511+
/* This early stuff belongs in the .init.text section, but some of the functions below definitely
510512
* don't... */
511513

512-
__HEAD
514+
__INIT
513515
.global _start
514516
_start:
515517
/* Init r0 to zero as per spec */

arch/openrisc/kernel/vmlinux.lds.S

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ SECTIONS
5050
.text : AT(ADDR(.text) - LOAD_OFFSET)
5151
{
5252
_stext = .;
53+
HEAD_TEXT
5354
TEXT_TEXT
5455
SCHED_TEXT
5556
LOCK_TEXT
@@ -83,8 +84,6 @@ SECTIONS
8384
. = ALIGN(PAGE_SIZE);
8485
__init_begin = .;
8586

86-
HEAD_TEXT_SECTION
87-
8887
/* Page aligned */
8988
INIT_TEXT_SECTION(PAGE_SIZE)
9089

scripts/head-object-list.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ arch/m68k/kernel/head.o
2424
arch/m68k/kernel/sun3-head.o
2525
arch/microblaze/kernel/head.o
2626
arch/nios2/kernel/head.o
27-
arch/openrisc/kernel/head.o
2827
arch/parisc/kernel/head.o
2928
arch/powerpc/kernel/head_44x.o
3029
arch/powerpc/kernel/head_64.o

0 commit comments

Comments
 (0)