modpost warning question

Subsystems: networking drivers, the rest

7 messages, 4 authors, 2007-07-25 · open the first message on its own page

modpost warning question

From: Kumar Gala <hidden>
Date: 2007-07-25 07:15:28

I'm seeing the following warning:

WARNING: vmlinux.o(.init.text+0x1acdc): Section mismatch: reference to
.exit.text:gfar_mdio_exit (between 'gfar_init' and 'gfar_mdio_init')

I don't understand why its not ok to access .exit.text from .init.text

The following addresses the issue, however I don't particularly like it:
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index ac3596f..100bf41 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -245,7 +245,7 @@ int __init gfar_mdio_init(void)
 	return driver_register(&gianfar_mdio_driver);
 }

-void __exit gfar_mdio_exit(void)
+void gfar_mdio_exit(void)
 {
 	driver_unregister(&gianfar_mdio_driver);
 }
diff --git a/drivers/net/gianfar_mii.h b/drivers/net/gianfar_mii.h
index 5d34004..b373091 100644
--- a/drivers/net/gianfar_mii.h
+++ b/drivers/net/gianfar_mii.h
@@ -42,5 +42,5 @@ struct gfar_mii {
 int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
 int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
 int __init gfar_mdio_init(void);
-void __exit gfar_mdio_exit(void);
+void gfar_mdio_exit(void);
 #endif /* GIANFAR_PHY_H */

Re: modpost warning question

From: Sam Ravnborg <hidden>
Date: 2007-07-25 07:26:29

On Wed, Jul 25, 2007 at 02:14:12AM -0500, Kumar Gala wrote:
I'm seeing the following warning:

WARNING: vmlinux.o(.init.text+0x1acdc): Section mismatch: reference to
.exit.text:gfar_mdio_exit (between 'gfar_init' and 'gfar_mdio_init')

I don't understand why its not ok to access .exit.text from .init.text
Several architectures discards .exit.text in the final linker
script (arch/$(ARCH)/kernel/vmlinux.lds.S

So any references to .exit.text will when a module is build-in result
in a linker error because ld will flag it as an error when we reference
a symbol in a discarded section.

For the popular architectures (i386,x86_64) we discard .exit.text at
runtime so here we do not see the error from ld (sadly).

	Sam

Re: modpost warning question

From: Kumar Gala <hidden>
Date: 2007-07-25 07:49:03

On Jul 25, 2007, at 2:27 AM, Sam Ravnborg wrote:
On Wed, Jul 25, 2007 at 02:14:12AM -0500, Kumar Gala wrote:
quoted
I'm seeing the following warning:

WARNING: vmlinux.o(.init.text+0x1acdc): Section mismatch:  
reference to
.exit.text:gfar_mdio_exit (between 'gfar_init' and 'gfar_mdio_init')

I don't understand why its not ok to access .exit.text  
from .init.text
Several architectures discards .exit.text in the final linker
script (arch/$(ARCH)/kernel/vmlinux.lds.S

So any references to .exit.text will when a module is build-in result
in a linker error because ld will flag it as an error when we  
reference
a symbol in a discarded section.

For the popular architectures (i386,x86_64) we discard .exit.text at
runtime so here we do not see the error from ld (sadly).
Fair point, wondering what we do with .exit on PPC, another thing for  
the list :)

- k

Re: modpost warning question

From: Sam Ravnborg <hidden>
Date: 2007-07-25 07:51:05

quoted
For the popular architectures (i386,x86_64) we discard .exit.text at
runtime so here we do not see the error from ld (sadly).
Fair point, wondering what we do with .exit on PPC, another thing for  
the list :)
from:
arch/ppc/kernel/vmlinux.lds.S:
  /* .exit.text is discarded at runtime, not link time,
     to deal with references from __bug_table */
  .exit.text : { *(.exit.text) }

	Sam

Re: modpost warning question

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2007-07-25 07:55:33

On Wed, 2007-07-25 at 02:14 -0500, Kumar Gala wrote:
I'm seeing the following warning:

WARNING: vmlinux.o(.init.text+0x1acdc): Section mismatch: reference to
.exit.text:gfar_mdio_exit (between 'gfar_init' and 'gfar_mdio_init')

I don't understand why its not ok to access .exit.text from .init.text

The following addresses the issue, however I don't particularly like it:
Because exit.text is removed when compiling built-in

Ben.

Re: modpost warning question

From: chengong <hidden>
Date: 2007-07-25 10:08:25

On Wed, 2007-07-25 at 09:27 +0200, Sam Ravnborg wrote:
On Wed, Jul 25, 2007 at 02:14:12AM -0500, Kumar Gala wrote:
quoted
I'm seeing the following warning:

WARNING: vmlinux.o(.init.text+0x1acdc): Section mismatch: reference to
.exit.text:gfar_mdio_exit (between 'gfar_init' and 'gfar_mdio_init')

I don't understand why its not ok to access .exit.text from .init.text
Several architectures discards .exit.text in the final linker
script (arch/$(ARCH)/kernel/vmlinux.lds.S

So any references to .exit.text will when a module is build-in result
in a linker error because ld will flag it as an error when we reference
a symbol in a discarded section.
But why? Just make kernel size smaller?
For the popular architectures (i386,x86_64) we discard .exit.text at
runtime so here we do not see the error from ld (sadly).
From which version? On my machine I have seen the same problem when
building i386 target with the version 2.6.21.
	Sam
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: modpost warning question

From: Sam Ravnborg <hidden>
Date: 2007-07-25 11:44:39

On Wed, Jul 25, 2007 at 06:08:03PM +0800, chengong wrote:
On Wed, 2007-07-25 at 09:27 +0200, Sam Ravnborg wrote:
quoted
On Wed, Jul 25, 2007 at 02:14:12AM -0500, Kumar Gala wrote:
quoted
I'm seeing the following warning:

WARNING: vmlinux.o(.init.text+0x1acdc): Section mismatch: reference to
.exit.text:gfar_mdio_exit (between 'gfar_init' and 'gfar_mdio_init')

I don't understand why its not ok to access .exit.text from .init.text
Several architectures discards .exit.text in the final linker
script (arch/$(ARCH)/kernel/vmlinux.lds.S

So any references to .exit.text will when a module is build-in result
in a linker error because ld will flag it as an error when we reference
a symbol in a discarded section.
But why? Just make kernel size smaller?
Yes - that the whole goal of init/exit sections.
quoted
For the popular architectures (i386,x86_64) we discard .exit.text at
runtime so here we do not see the error from ld (sadly).
From which version? On my machine I have seen the same problem when
building i386 target with the version 2.6.21.
modpost has started to warn about it. I assume you did not see link errors.

	Sam
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help