Skip to contentSkip to conversation

cris: debugport: Fix section mismatches

PATCH In review Guenter Roeck 1 participant 4 messages Nov 10, 2015 – Dec 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cris: debugport: Fix section mismatches

Section mismatches can now cause build failures, such as for cris:allnoconfig. Rename affected variables to end with _console to make section mismatch checks happy.

---
 arch/cris/arch-v10/kernel/debugport.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/cris/arch-v10/kernel/debugport.c +11 -11
index 7d307cce8bd8..b6549e54be29 100644
@@ -468,7 +468,7 @@ etrax_console_device(struct console* co, int *index)
 #endif
 }
 
-static struct console sercons = {
+static struct console ser_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -480,7 +480,7 @@ static struct console sercons = {
 	cflag : 0,
 	next : NULL
 };
-static struct console sercons0 = {
+static struct console ser0_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -493,7 +493,7 @@ static struct console sercons0 = {
 	next : NULL
 };
 
-static struct console sercons1 = {
+static struct console ser1_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -505,7 +505,7 @@ static struct console sercons1 = {
 	cflag : 0,
 	next : NULL
 };
-static struct console sercons2 = {
+static struct console ser2_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -517,7 +517,7 @@ static struct console sercons2 = {
 	cflag : 0,
 	next : NULL
 };
-static struct console sercons3 = {
+static struct console ser3_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -539,17 +539,17 @@ init_etrax_debug(void)
 	static int first = 1;
 
 	if (!first) {
-		unregister_console(&sercons);
-		register_console(&sercons0);
-		register_console(&sercons1);
-		register_console(&sercons2);
-		register_console(&sercons3);
+		unregister_console(&ser_console);
+		register_console(&ser0_console);
+		register_console(&ser1_console);
+		register_console(&ser2_console);
+		register_console(&ser3_console);
                 init_dummy_console();
 		return 0;
 	}
 
 	first = 0;
-	register_console(&sercons);
+	register_console(&ser_console);
 	start_port(port);
 #ifdef CONFIG_ETRAX_KGDB
 	start_port(kgdb_port);
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 cris: Fix section mismatches in architecture startup code

Section mismatches can now result in build failures. As result, cris:allnoconfig fails to build as follows.

WARNING: modpost: Found 7 section mismatch(es). To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
FATAL: modpost: Section mismatches detected. Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.

Part of the problem is that references from .text to .init.text are not permitted, and such references are used in cris startup code. Since references from .head.text to .init.text are permitted, move cris startup code to a new section .head.text.

---
Tested with qemu for crisv32.

 arch/cris/arch-v10/kernel/head.S | 6 ++++--
 arch/cris/arch-v32/kernel/head.S | 6 ++++--
 arch/cris/kernel/vmlinux.lds.S   | 1 +
 3 files changed, 9 insertions(+), 4 deletions(-)
arch/cris/arch-v10/kernel/head.S +4 -2
index a4877a421756..a74aa233b84e 100644
@@ -5,6 +5,8 @@
  *
  */
 
+#include <linux/init.h>
+
 #define ASSEMBLER_MACROS_ONLY
 /* The IO_* macros use the ## token concatenation operator, so
    -traditional must not be used when assembling this file.  */
@@ -25,7 +27,7 @@
 	.globl	romfs_in_flash
 	.globl  swapper_pg_dir
 
-	.text
+	__HEAD
 
 	;; This is the entry point of the kernel. We are in supervisor mode.
 	;; 0x00000000 if Flash, 0x40004000 if DRAM
@@ -159,7 +161,7 @@ _inflash0:
 
 	;; Put this in a suitable section where we can reclaim storage
 	;; after init.
-	.section ".init.text", "ax"
+	__INIT
 _inflash:
 #ifdef CONFIG_ETRAX_ETHERNET
 	;; Start MII clock to make sure it is running when tranceiver is reset
arch/cris/arch-v32/kernel/head.S +4 -2
index ea6366800df7..5ce83eb54f58 100644
@@ -4,6 +4,8 @@
  * Copyright (C) 2003, Axis Communications AB
  */
 
+#include <linux/init.h>
+
 #define ASSEMBLER_MACROS_ONLY
 
 /*
@@ -36,7 +38,7 @@
 	.global nand_boot
 	.global swapper_pg_dir
 
-	.text
+	__HEAD
 tstart:
 	;; This is the entry point of the kernel. The CPU is currently in
 	;; supervisor mode.
@@ -177,7 +179,7 @@ _inflash0:
 
 	;; Put the following in a section so that storage for it can be
 	;; reclaimed after init is finished.
-	.section ".init.text", "ax"
+	__INIT
 
 _inflash:
 
arch/cris/kernel/vmlinux.lds.S +1 -0
index a68b983dcea1..7552c2557506 100644
@@ -40,6 +40,7 @@ SECTIONS
 	_stext = .;
 	__stext = .;
 	.text : {
+		HEAD_TEXT
 		TEXT_TEXT
 		SCHED_TEXT
 		LOCK_TEXT
Signature · 1 line
2.1.4
#2 lore raw
In reply to Guenter Roeck
Quoted 5 lines · Guenter Roeck

Section mismatches can now cause build failures, such as for cris:allnoconfig. Rename affected variables to end with _console to make section mismatch checks happy.

Folks,

is there any interest picking up those patches or fixing the problems by some other means ? If not, please let me know, and I'll drop cris:allnoconfig from my list of build tests.

Thanks,
Guenter

Quoted 87 lines
---
 arch/cris/arch-v10/kernel/debugport.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/cris/arch-v10/kernel/debugport.c +11 -11
index 7d307cce8bd8..b6549e54be29 100644
@@ -468,7 +468,7 @@ etrax_console_device(struct console* co, int *index)
 #endif
 }
 
-static struct console sercons = {
+static struct console ser_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -480,7 +480,7 @@ static struct console sercons = {
 	cflag : 0,
 	next : NULL
 };
-static struct console sercons0 = {
+static struct console ser0_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -493,7 +493,7 @@ static struct console sercons0 = {
 	next : NULL
 };
 
-static struct console sercons1 = {
+static struct console ser1_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -505,7 +505,7 @@ static struct console sercons1 = {
 	cflag : 0,
 	next : NULL
 };
-static struct console sercons2 = {
+static struct console ser2_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -517,7 +517,7 @@ static struct console sercons2 = {
 	cflag : 0,
 	next : NULL
 };
-static struct console sercons3 = {
+static struct console ser3_console = {
 	name : "ttyS",
 	write: console_write,
 	read : NULL,
@@ -539,17 +539,17 @@ init_etrax_debug(void)
 	static int first = 1;
 
 	if (!first) {
-		unregister_console(&sercons);
-		register_console(&sercons0);
-		register_console(&sercons1);
-		register_console(&sercons2);
-		register_console(&sercons3);
+		unregister_console(&ser_console);
+		register_console(&ser0_console);
+		register_console(&ser1_console);
+		register_console(&ser2_console);
+		register_console(&ser3_console);
                 init_dummy_console();
 		return 0;
 	}
 
 	first = 0;
-	register_console(&sercons);
+	register_console(&ser_console);
 	start_port(port);
 #ifdef CONFIG_ETRAX_KGDB
 	start_port(kgdb_port);
Signature · 7 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#3 lore raw
In reply to Guenter Roeck
Quoted 5 lines · Guenter Roeck

Section mismatches can now cause build failures, such as for cris:allnoconfig. Rename affected variables to end with _console to make section mismatch checks happy.

ping ...

cris:allnoconfig still fails to build in mainline.

Should I drop the build from my tests ?

Thanks,
Guenter

Quoted 78 lines
---
  arch/cris/arch-v10/kernel/debugport.c | 22 +++++++++++-----------
  1 file changed, 11 insertions(+), 11 deletions(-)
arch/cris/arch-v10/kernel/debugport.c +11 -11
index 7d307cce8bd8..b6549e54be29 100644
@@ -468,7 +468,7 @@ etrax_console_device(struct console* co, int *index)
  #endif
  }
 
-static struct console sercons = {
+static struct console ser_console = {
  	name : "ttyS",
  	write: console_write,
  	read : NULL,
@@ -480,7 +480,7 @@ static struct console sercons = {
  	cflag : 0,
  	next : NULL
  };
-static struct console sercons0 = {
+static struct console ser0_console = {
  	name : "ttyS",
  	write: console_write,
  	read : NULL,
@@ -493,7 +493,7 @@ static struct console sercons0 = {
  	next : NULL
  };
 
-static struct console sercons1 = {
+static struct console ser1_console = {
  	name : "ttyS",
  	write: console_write,
  	read : NULL,
@@ -505,7 +505,7 @@ static struct console sercons1 = {
  	cflag : 0,
  	next : NULL
  };
-static struct console sercons2 = {
+static struct console ser2_console = {
  	name : "ttyS",
  	write: console_write,
  	read : NULL,
@@ -517,7 +517,7 @@ static struct console sercons2 = {
  	cflag : 0,
  	next : NULL
  };
-static struct console sercons3 = {
+static struct console ser3_console = {
  	name : "ttyS",
  	write: console_write,
  	read : NULL,
@@ -539,17 +539,17 @@ init_etrax_debug(void)
  	static int first = 1;
 
  	if (!first) {
-		unregister_console(&sercons);
-		register_console(&sercons0);
-		register_console(&sercons1);
-		register_console(&sercons2);
-		register_console(&sercons3);
+		unregister_console(&ser_console);
+		register_console(&ser0_console);
+		register_console(&ser1_console);
+		register_console(&ser2_console);
+		register_console(&ser3_console);
                  init_dummy_console();
  		return 0;
  	}
 
  	first = 0;
-	register_console(&sercons);
+	register_console(&ser_console);
  	start_port(port);
  #ifdef CONFIG_ETRAX_KGDB
  	start_port(kgdb_port);