Skip to contentSkip to conversation

2.6.23-rc1: i386 section mismatch warnings

DISCUSSION Jeff Garzik 4 participants 8 messages Jul 24, 2007 – Jul 25, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

make allmodconfig on i386:

WARNING: vmlinux(.text+0xc0101183): Section mismatch: reference to .init.text:start_kernel (between 'is386' and 'check_x87')
WARNING: vmlinux(.text+0xc02cfcdb): Section mismatch: reference to .init.text:kernel_init (between 'rest_init' and 'kthreadd_setup')
WARNING: vmlinux(.text+0xc02d5ed2): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02d5ede): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02d5eea): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02d5ef6): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02cfda4): Section mismatch: reference to .init.text:__alloc_bootmem_node (between 'alloc_node_mem_map' and 'zone_wait_table_init')
WARNING: vmlinux(.text+0xc02cfe4e): Section mismatch: reference to .init.text:__alloc_bootmem_node (between 'zone_wait_table_init' and 'vgacon_scrollback_startup')
WARNING: vmlinux(.text+0xc02d64c6): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02cfea7): Section mismatch: reference to .init.text:__alloc_bootmem (between 'vgacon_scrollback_startup' and 'fb_find_logo')
WARNING: vmlinux(.text+0xc02cfecb): Section mismatch: reference to .init.data:logo_linux_mono (between 'fb_find_logo' and 'schedule')
WARNING: vmlinux(.text+0xc02cfed5): Section mismatch: reference to .init.data:logo_linux_clut224 (between 'fb_find_logo' and 'schedule')
WARNING: vmlinux(.text+0xc02cfeda): Section mismatch: reference to .init.data:logo_linux_vga16 (between 'fb_find_logo' and 'schedule')
WARNING: vmlinux(.text+0xc02d6612): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')

#1 lore raw
Quoted 3 lines · Jeff Garzik

make allmodconfig on i386:

WARNING: vmlinux(.text+0xc0101183): Section mismatch: reference to

Ignore. vmlinux.o ones are interesting; so are ones in modules. vmlinux ones are either duplicates of vmlinux.o or false positives.

#7 lore raw
In reply to Jeff Garzik
Quoted 25 lines · Jeff Garzik

make allmodconfig on i386:

WARNING: vmlinux(.text+0xc0101183): Section mismatch: reference to .init.text:start_kernel (between 'is386' and 'check_x87')
WARNING: vmlinux(.text+0xc02cfcdb): Section mismatch: reference to .init.text:kernel_init (between 'rest_init' and 'kthreadd_setup')
WARNING: vmlinux(.text+0xc02d5ed2): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02d5ede): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02d5eea): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02d5ef6): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02cfda4): Section mismatch: reference to .init.text:__alloc_bootmem_node (between 'alloc_node_mem_map' and 'zone_wait_table_init')
WARNING: vmlinux(.text+0xc02cfe4e): Section mismatch: reference to .init.text:__alloc_bootmem_node (between 'zone_wait_table_init' and 'vgacon_scrollback_startup')
WARNING: vmlinux(.text+0xc02d64c6): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02cfea7): Section mismatch: reference to .init.text:__alloc_bootmem (between 'vgacon_scrollback_startup' and 'fb_find_logo')

Quoted 8 lines

WARNING: vmlinux(.text+0xc02cfecb): Section mismatch: reference to .init.data:logo_linux_mono (between 'fb_find_logo' and 'schedule')
WARNING: vmlinux(.text+0xc02cfed5): Section mismatch: reference to .init.data:logo_linux_clut224 (between 'fb_find_logo' and 'schedule')
WARNING: vmlinux(.text+0xc02cfeda): Section mismatch: reference to .init.data:logo_linux_vga16 (between 'fb_find_logo' and 'schedule')
WARNING: vmlinux(.text+0xc02d6612): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')

The above warnings happens because during final link we stuff a lot of different sections down in a smaller number of sections. So modpost does not know that the references are actually OK.

The fix is simply to avoid doing section mismatch check on vmlinux when processing the modules and I have this in kbuild.git. I expect this to be merged during -rc1 (was sent in the merge window but did not get applied).

As a general rule just ignore all section mismatch warnings that originate from vmlinux. The others needs to be fixed and there seem to be enough to deal with :-(

Sam

#2 lore raw
In reply to Al Viro
Quoted 7 lines · Al Viro
Quoted 3 lines · Jeff Garzik

make allmodconfig on i386:

WARNING: vmlinux(.text+0xc0101183): Section mismatch: reference to

Ignore. vmlinux.o ones are interesting; so are ones in modules. vmlinux ones are either duplicates of vmlinux.o or false positives.

allyesconfig has a lot Section mismatch warnings , are these false positive too ?

http://lkml.org/lkml/2007/7/22/312

Regards,

Gabriel C

#3 lore raw
Quoted 6 lines · Gabriel C
Quoted 5 lines · Al Viro
Quoted 3 lines · Jeff Garzik

make allmodconfig on i386:

WARNING: vmlinux(.text+0xc0101183): Section mismatch: reference to

Quoted 7 lines
Quoted 2 lines

Ignore. vmlinux.o ones are interesting; so are ones in modules. vmlinux ones are either duplicates of vmlinux.o or false positives.

allyesconfig has a lot Section mismatch warnings , are these false positive too ?

http://lkml.org/lkml/2007/7/22/312

The first group are to be solved.
The last group can be ignored.

I have saved your original mail but not yet looked into any of them. I assume that a few hours work can bring down the list considerably but I was sidetracked by a book (HP7) ;-)

Sam

#4 lore raw
Quoted 13 lines · Sam Ravnborg
Quoted 12 lines · Gabriel C
Quoted 7 lines · Al Viro
Quoted 3 lines · Jeff Garzik

make allmodconfig on i386:

WARNING: vmlinux(.text+0xc0101183): Section mismatch: reference to

Ignore. vmlinux.o ones are interesting; so are ones in modules. vmlinux ones are either duplicates of vmlinux.o or false positives.

allyesconfig has a lot Section mismatch warnings , are these false positive too ?

Quoted 8 lines
Quoted 1 line

http://lkml.org/lkml/2007/7/22/312

The first group are to be solved.
The last group can be ignored.

I have saved your original mail but not yet looked into any of them. I assume that a few hours work can bring down the list considerably but I was sidetracked by a book (HP7) ;-)

Took a closer look at the warnings.
modpost gets confused on the weired section mames: .init.text.1, .init.text.3 etc.

See for example:

WARNING: vmlinux.o(.data+0x4b38): Section mismatch: reference to .init.text.3:powernow_cpu_init (between 'powernow_driver' and 'minimum

                                                                 ^^^^^^^^^^^^

This is easy to ignore but anyone that knows why we suddenly have a number following the section name in a few cases?

Sam

#5 lore raw
In reply to Gabriel C
Quoted 6 lines · Gabriel C
Quoted 5 lines · Al Viro
Quoted 3 lines · Jeff Garzik

make allmodconfig on i386:

WARNING: vmlinux(.text+0xc0101183): Section mismatch: reference to

Quoted 7 lines
Quoted 2 lines

Ignore. vmlinux.o ones are interesting; so are ones in modules. vmlinux ones are either duplicates of vmlinux.o or false positives.

allyesconfig has a lot Section mismatch warnings , are these false positive too ?

http://lkml.org/lkml/2007/7/22/312

Fixed in latest kbuild.git. See the following two patches.

Sam

Quoted 1 line

From 2f5ee619045d923de9137b6a263a99cc2428391a Mon Sep 17 00:00:00 2001

From: Sam Ravnborg <[email protected]>
Date: Wed, 25 Jul 2007 21:46:40 +0200
Subject: [PATCH 6/8] kbuild: rearrange a few function in modpost

This is a preparational patch that just move two functions and add one (for now unused) function.

---
 scripts/mod/modpost.c |   80 +++++++++++++++++++++++++++++-------------------
 1 files changed, 48 insertions(+), 32 deletions(-)
scripts/mod/modpost.c +48 -32
index 87e3ee5..c903a16 100644
@@ -586,6 +586,54 @@ static int strrcmp(const char *s, const char *sub)
         return memcmp(s + slen - sublen, sub, sublen);
 }
 
+/*
+ * Functions used only during module init is marked __init and is stored in
+ * a .init.text section. Likewise data is marked __initdata and stored in
+ * a .init.data section.
+ * If this section is one of these sections return 1
+ * See include/linux/init.h for the details
+ */
+static int init_section(const char *name)
+{
+	if (strcmp(name, ".init") == 0)
+		return 1;
+	if (strncmp(name, ".init.", strlen(".init.")) == 0)
+		return 1;
+	return 0;
+}
+
+/*
+ * Functions used only during module exit is marked __exit and is stored in
+ * a .exit.text section. Likewise data is marked __exitdata and stored in
+ * a .exit.data section.
+ * If this section is one of these sections return 1
+ * See include/linux/init.h for the details
+ **/
+static int exit_section(const char *name)
+{
+	if (strcmp(name, ".exit.text") == 0)
+		return 1;
+	if (strcmp(name, ".exit.data") == 0)
+		return 1;
+	return 0;
+
+}
+
+/*
+ * Data sections are named like this:
+ * .data | .data.rel | .data.rel.*
+ * Return 1 if the specified section is a data section
+ */
+static int data_section(const char *name)
+{
+	if ((strcmp(name, ".data") == 0) ||
+	    (strcmp(name, ".data.rel") == 0) ||
+	    (strncmp(name, ".data.rel.", strlen(".data.rel.")) == 0))
+		return 1;
+	else
+		return 0;
+}
+
 /**
  * Whitelist to allow certain references to pass with no warning.
  *
@@ -1108,21 +1156,6 @@ static int initexit_section_ref_ok(const char *name)
 	return 0;
 }
 
-/**
- * Functions used only during module init is marked __init and is stored in
- * a .init.text section. Likewise data is marked __initdata and stored in
- * a .init.data section.
- * If this section is one of these sections return 1
- * See include/linux/init.h for the details
- **/
-static int init_section(const char *name)
-{
-	if (strcmp(name, ".init") == 0)
-		return 1;
-	if (strncmp(name, ".init.", strlen(".init.")) == 0)
-		return 1;
-	return 0;
-}
 
 /*
  * Identify sections from which references to a .init section is OK.
@@ -1180,23 +1213,6 @@ static int init_section_ref_ok(const char *name)
 }
 
 /*
- * Functions used only during module exit is marked __exit and is stored in
- * a .exit.text section. Likewise data is marked __exitdata and stored in
- * a .exit.data section.
- * If this section is one of these sections return 1
- * See include/linux/init.h for the details
- **/
-static int exit_section(const char *name)
-{
-	if (strcmp(name, ".exit.text") == 0)
-		return 1;
-	if (strcmp(name, ".exit.data") == 0)
-		return 1;
-	return 0;
-
-}
-
-/*
  * Identify sections from which references to a .exit section is OK.
  */
 static int exit_section_ref_ok(const char *name)
Signature · 1 line
1.5.1.rc3.g84b7-dirty
Quoted 1 line

From 83cda2bb37cb8476cd84659d9698ab48553be974 Mon Sep 17 00:00:00 2001

From: Sam Ravnborg <[email protected]>
Date: Wed, 25 Jul 2007 21:52:31 +0200
Subject: [PATCH 7/8] kbuild: be more foregiving on init section naming

In the whitelist function of modpost now use the same check to identify init_section as in other places of modpost. This has the effect that we now recognize sections named .init.text.19 as init sections and we no longer warn when we see these.

At the same time make surrounding code readable by dropping use of temporary flags.

---
 scripts/mod/modpost.c |   36 ++++++++++--------------------------
 1 files changed, 10 insertions(+), 26 deletions(-)
scripts/mod/modpost.c +10 -26
index c903a16..3db4edc 100644
@@ -658,8 +658,8 @@ static int data_section(const char *name)
  *   These functions may often be marked __init and we do not want to
  *   warn here.
  *   the pattern is identified by:
- *   tosec   = .init.text | .exit.text | .init.data
- *   fromsec = .data | .data.rel | .data.rel.*
+ *   tosec   = init or exit section
+ *   fromsec = data section
  *   atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer
  *
  * Pattern 3:
@@ -680,7 +680,6 @@ static int secref_whitelist(const char *modname, const char *tosec,
 			    const char *fromsec, const char *atsym,
 			    const char *refsymname)
 {
-	int f1 = 1, f2 = 1;
 	const char **s;
 	const char *pat2sym[] = {
 		"driver",
@@ -707,31 +706,16 @@ static int secref_whitelist(const char *modname, const char *tosec,
 		return 1;
 
 	/* Check for pattern 1 */
-	if (strcmp(tosec, ".init.data") != 0)
-		f1 = 0;
-	if (strncmp(fromsec, ".data", strlen(".data")) != 0)
-		f1 = 0;
-	if (strncmp(atsym, "__param", strlen("__param")) != 0)
-		f1 = 0;
-
-	if (f1)
-		return f1;
+	if ((strcmp(tosec, ".init.data") == 0) &&
+	    (strncmp(fromsec, ".data", strlen(".data")) == 0) &&
+	    (strncmp(atsym, "__param", strlen("__param")) == 0))
+		return 1;
 
 	/* Check for pattern 2 */
-	if ((strcmp(tosec, ".init.text") != 0) &&
-	    (strcmp(tosec, ".exit.text") != 0) &&
-	    (strcmp(tosec, ".init.data") != 0))
-		f2 = 0;
-	if ((strcmp(fromsec, ".data") != 0) &&
-	    (strcmp(fromsec, ".data.rel") != 0) &&
-	    (strncmp(fromsec, ".data.rel.", strlen(".data.rel.")) != 0))
-		f2 = 0;
-
-	for (s = pat2sym; *s; s++)
-		if (strrcmp(atsym, *s) == 0)
-			f1 = 1;
-	if (f1 && f2)
-		return 1;
+	if ((init_section(tosec) || exit_section(tosec)) && data_section(fromsec))
+		for (s = pat2sym; *s; s++)
+			if (strrcmp(atsym, *s) == 0)
+				return 1;
 
 	/* Check for pattern 3 */
 	if ((strcmp(fromsec, ".text.head") == 0) &&
Signature · 1 line
1.5.1.rc3.g84b7-dirty
#6 lore raw
Quoted 6 lines · Sam Ravnborg
Quoted 5 lines · Gabriel C
Quoted 4 lines · Al Viro
Quoted 3 lines · Jeff Garzik

make allmodconfig on i386:

WARNING: vmlinux(.text+0xc0101183): Section mismatch: reference to

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Ignore. vmlinux.o ones are interesting; so are ones in modules. vmlinux ones are either duplicates of vmlinux.o or false positives.

allyesconfig has a lot Section mismatch warnings , are these false positive too ?

http://lkml.org/lkml/2007/7/22/312

Fixed in latest kbuild.git. See the following two patches.

One left on vmlinux.o :) and some on vmlinux.

...

WARNING: vmlinux.o(.text+0x183): Section mismatch: reference to .init.text.1:start_kernel (between 'is386' and 'check_x87')

...

This is on current git head with the 2 patches and allyesconfig.

Quoted 2 lines

Sam

Gabriel