Skip to contentSkip to conversation

fix sparc32 modpost warnings

PATCH In review Martin Habets 2 participants 5 messages Oct 10, 2006 – Oct 11, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 fix sparc32 modpost warnings

Subject: [PATCH 1/4] fix sparc32 modpost warnings

Fix these 2.6.19-rc1 build warnings from modpost:

WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'core_kernel_text' (at offset 0x3e060) and '__kernel_text_address'
WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'core_kernel_text' (at offset 0x3e064) and '__kernel_text_address'
WARNING: vmlinux - Section mismatch: reference to .init.text:_einittext from .text between 'core_kernel_text' (at offset 0x3e07c) and '__kernel_text_address'
WARNING: vmlinux - Section mismatch: reference to .init.text:_einittext from .text between 'core_kernel_text' (at offset 0x3e080) and '__kernel_text_address'
WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'is_ksym_addr' (at offset 0x4b3a4) and 'kallsyms_expand_symbol'
WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'is_ksym_addr' (at offset 0x4b3a8) and 'kallsyms_expand_symbol'
WARNING: vmlinux - Section mismatch: reference to .init.text:_einittext from .text between 'is_ksym_addr' (at offset 0x4b3b4) and 'kallsyms_expand_symbol'
WARNING: vmlinux - Section mismatch: reference to .init.text:_einittext from .text between 'is_ksym_addr' (at offset 0x4b3e4) and 'kallsyms_expand_symbol'
WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'get_symbol_pos' (at offset 0x4b640) and 'kallsyms_lookup_size_offset'
WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'get_symbol_pos' (at offset 0x4b644) and 'kallsyms_lookup_size_offset'
WARNING: vmlinux - Section mismatch: reference to .init.text:_einittext from .text between 'get_symbol_pos' (at offset 0x4b654) and 'kallsyms_lookup_size_offset'
WARNING: vmlinux - Section mismatch: reference to .init.text:_einittext from .text between 'get_symbol_pos' (at offset 0x4b658) and 'kallsyms_lookup_size_offset'
WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'get_symbol_pos' (at offset 0x4b68c) and 'kallsyms_lookup_size_offset'

Martin

---
Index: linux/arch/sparc/kernel/vmlinux.lds.S
=================================--- linux.orig/arch/sparc/kernel/vmlinux.lds.S 2006-10-07 04:55:15.000000000 +0100
+++ linux/arch/sparc/kernel/vmlinux.lds.S 2006-10-07 05:00:40.000000000 +0100
@@ -36,11 +36,11 @@

. = ALIGN(4096);
__init_begin = .;
+ _sinittext = .;
.init.text : {
- _sinittext = .;
*(.init.text)
- _einittext = .;
}
+ _einittext = .;
__init_text_end = .;
.init.data : { *(.init.data) }
. = ALIGN(16);

#1 lore raw

From: Martin Habets <[email protected]>
Date: Tue, 10 Oct 2006 16:44:16 +0100

Quoted 5 lines

Subject: [PATCH 1/4] fix sparc32 modpost warnings

Fix these 2.6.19-rc1 build warnings from modpost:

WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'core_kernel_text' (at offset 0x3e060) and '__kernel_text_address'

...

Quoted 4 lines
(quoted diff) +0 -0
@@ -36,11 +36,11 @@
 
   . = ALIGN(4096);
   __init_begin = .;

Review line 46

Quoted 10 lines
(quoted diff) +2 -2
+  _sinittext = .;
   .init.text : { 
-	_sinittext = .;
 	*(.init.text)
-	_einittext = .;
   }
+  _einittext = .;
   __init_text_end = .;
   .init.data : { *(.init.data) }
   . = ALIGN(16);

This doesn't make any sense. No other architecture specifies the init sections in this way in their vmlinux.lds.S file. Why is this change correct?

Can you try to track down the real problem that causes this and then explain it clearly in the patch that you end up posting?

I have trouble applying patches that are of the form "get rid of this warning" with zero explanation for the reasoning behind the fix being proposed :-)

#2 lore raw
In reply to Martin Habets
Quoted 11 lines · David Miller

From: Martin Habets <[email protected]>
Date: Tue, 10 Oct 2006 16:44:16 +0100

Quoted 5 lines

Subject: [PATCH 1/4] fix sparc32 modpost warnings

Fix these 2.6.19-rc1 build warnings from modpost:

WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'core_kernel_text' (at offset 0x3e060) and '__kernel_text_address'

...

Quoted 2 lines
(quoted diff) +0 -0
@@ -36,11 +36,11 @@
 
Quoted 15 lines

Review line 46

Quoted 12 lines
(quoted diff) +2 -2
   . = ALIGN(4096);
   __init_begin = .;
+  _sinittext = .;
   .init.text : { 
-	_sinittext = .;
 	*(.init.text)
-	_einittext = .;
   }
+  _einittext = .;
   __init_text_end = .;
   .init.data : { *(.init.data) }
   . = ALIGN(16);

This doesn't make any sense. No other architecture specifies the init sections in this way in their vmlinux.lds.S file.

The frv is the only architecture that has it this way.
I just build 2.6.19-rc1 for i386, expecting to see the same build warning. It did not appear, which puzzles me at the moment. Do you get this warning for sparc64?

Quoted 1 line

Why is this change correct?

The symbols are used from functions that realy should be .text (like core_kernel_text() in kernel/extable.c). They are not referenced from anything in an .init.text sections. So moving them seemed like the right solution.

Quoted 3 lines

Can you try to track down the real problem that causes this and then explain it clearly in the patch that you end up posting?

My guess is all architectures except sparc and frv have some code to prevent the warning. I'll see what I can find.

Thanks,

Signature · 1 line
Martin
#3 lore raw
In reply to Martin Habets
Quoted 28 lines · Martin Habets
Quoted 11 lines · David Miller

From: Martin Habets <[email protected]>
Date: Tue, 10 Oct 2006 16:44:16 +0100

Quoted 5 lines

Subject: [PATCH 1/4] fix sparc32 modpost warnings

Fix these 2.6.19-rc1 build warnings from modpost:

WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'core_kernel_text' (at offset 0x3e060) and '__kernel_text_address'

...

Quoted 2 lines
(quoted diff) +0 -0
@@ -36,11 +36,11 @@
 
Quoted 15 lines

Review line 46

Quoted 12 lines
(quoted diff) +2 -2
   . = ALIGN(4096);
   __init_begin = .;
+  _sinittext = .;
   .init.text : { 
-	_sinittext = .;
 	*(.init.text)
-	_einittext = .;
   }
+  _einittext = .;
   __init_text_end = .;
   .init.data : { *(.init.data) }
   . = ALIGN(16);

This doesn't make any sense. No other architecture specifies the init sections in this way in their vmlinux.lds.S file.

Quoted 4 lines

The frv is the only architecture that has it this way.
I just build 2.6.19-rc1 for i386, expecting to see the same build warning. It did not appear, which puzzles me at the moment. Do you get this warning for sparc64?

OK, I am less confused now: the crux of the matter is that modpost only checks the relocatable sections. i386 vmlinux has none, so modpost does no checking on it (it does on the modules).
However, sparc vmlinux has plenty of relocatable sections because it is being built with 'ld -r' (to allow for btfixup processing). So for sparc, modpost does do a lot of checking. Sure enough, running modpost on arch/sparc/boot/image yields no output (i.e. all is well).

modpost.c check_sec_ref() has:

                /* We want to process only relocation sections and not .init */
                if (sechdrs[i].sh_type = SHT_RELA) {
			// check here
                } else if (sechdrs[i].sh_type = SHT_REL) {
			// check here
		}
Quoted 6 lines
Quoted 1 line

Why is this change correct?

The symbols are used from functions that realy should be .text (like core_kernel_text() in kernel/extable.c). They are not referenced from anything in an .init.text sections. So moving them seemed like the right solution.

In essence this issue exists for most architectures. They just don't know it yet. I do not know if modpost will be enhanced/fixed to check all code sections, but that would seem necessary to find all potential problem cases.

Given the current build process for sparc32, my patch is the right one to fix the warning messages. The only other option I can see is to reorder the build process so that vmlinux is once again the end-product and no longer an intermediate relocatable. That would be a better yet much more complicated patch.

I have attached relevant objdump output from sparc32 and i386.

Signature · 1 line
Martin
#4 lore raw
In reply to Martin Habets

From: Martin Habets <[email protected]>
Date: Wed, 11 Oct 2006 22:02:29 +0100

Quoted 7 lines

OK, I am less confused now: the crux of the matter is that modpost only checks the relocatable sections. i386 vmlinux has none, so modpost does no checking on it (it does on the modules).
However, sparc vmlinux has plenty of relocatable sections because it is being built with 'ld -r' (to allow for btfixup processing). So for sparc, modpost does do a lot of checking. Sure enough, running modpost on arch/sparc/boot/image yields no output (i.e. all is well).

Thanks for figuring this out, I'll apply your original patch now that I understand what's going on :-)