public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* WARNING: arch/x86/built-in.o: Section mismatch in reference from the variable test_nmi_ipi_callback_na to function .ini.text:test_nmi_ipi_callback
@ 2012-06-02 16:15 Witold Baryluk
  2012-06-04 14:36 ` Don Zickus
  0 siblings, 1 reply; 12+ messages in thread
From: Witold Baryluk @ 2012-06-02 16:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Don Zickus

Hello everybody,

x86 32-bit Build just got 2 WARNINGS when building kernel on Linus' tree.


 VDSOSYM arch/x86/vdso/vdso32-syms.lds
  LD      arch/x86/vdso/built-in.o
  LD      arch/x86/built-in.o
WARNING: arch/x86/built-in.o(.data+0x5af0): Section mismatch in reference from the variable test_nmi_ipi_callback_na.10451 to the function .init.text:test_nmi_ipi_callback()
The variable test_nmi_ipi_callback_na.10451 references
the function __init test_nmi_ipi_callback()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: arch/x86/built-in.o(.data+0x5b04): Section mismatch in reference from the variable nmi_unk_cb_na.10399 to the function .init.text:nmi_unk_cb()
The variable nmi_unk_cb_na.10399 references
the function __init nmi_unk_cb()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

  LD      vmlinux.o
  MODPOST vmlinux.o
WARNING: vmlinux.o(.data+0x7cf0): Section mismatch in reference from the variable test_nmi_ipi_callback_na.10451 to the function .init.text:test_nmi_ipi_callback()
The variable test_nmi_ipi_callback_na.10451 references
the function __init test_nmi_ipi_callback()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: vmlinux.o(.data+0x7d04): Section mismatch in reference from the variable nmi_unk_cb_na.10399 to the function .init.text:nmi_unk_cb()
The variable nmi_unk_cb_na.10399 references
the function __init nmi_unk_cb()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

  GEN     .version
  CHK     include/generated/compile.h




This is recent change.

gcc version 4.7.0 (Debian 4.7.0-11) 

Debian sid, i386.

-- 
Witold Baryluk

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: WARNING: arch/x86/built-in.o: Section mismatch in reference from the variable test_nmi_ipi_callback_na to function .ini.text:test_nmi_ipi_callback
  2012-06-02 16:15 WARNING: arch/x86/built-in.o: Section mismatch in reference from the variable test_nmi_ipi_callback_na to function .ini.text:test_nmi_ipi_callback Witold Baryluk
@ 2012-06-04 14:36 ` Don Zickus
  2012-06-04 14:59   ` H. Peter Anvin
  2012-06-04 16:35   ` Sam Ravnborg
  0 siblings, 2 replies; 12+ messages in thread
From: Don Zickus @ 2012-06-04 14:36 UTC (permalink / raw)
  To: Witold Baryluk
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

On Sat, Jun 02, 2012 at 06:15:02PM +0200, Witold Baryluk wrote:
> Hello everybody,
> 
> x86 32-bit Build just got 2 WARNINGS when building kernel on Linus' tree.

Hi Witold,

Thanks for the warnings.

> 
> 
>  VDSOSYM arch/x86/vdso/vdso32-syms.lds
>   LD      arch/x86/vdso/built-in.o
>   LD      arch/x86/built-in.o
> WARNING: arch/x86/built-in.o(.data+0x5af0): Section mismatch in reference from the variable test_nmi_ipi_callback_na.10451 to the function .init.text:test_nmi_ipi_callback()
> The variable test_nmi_ipi_callback_na.10451 references
> the function __init test_nmi_ipi_callback()
> If the reference is valid then annotate the
> variable with __init* or __refdata (see linux/init.h) or name the variable:
> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
> 
> WARNING: arch/x86/built-in.o(.data+0x5b04): Section mismatch in reference from the variable nmi_unk_cb_na.10399 to the function .init.text:nmi_unk_cb()
> The variable nmi_unk_cb_na.10399 references
> the function __init nmi_unk_cb()
> If the reference is valid then annotate the
> variable with __init* or __refdata (see linux/init.h) or name the variable:
> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

These are intermediate variables test_nmi_ipi_callback_na.10451 and
nmi_unk_cb_na.10399.  I do not know how to fix them.

Basically the test registers two nmi_handlers, run some tests, and
then unregisters them.  Those handlers are what the compiler seems to be
complaining about.  I do not know what magic to pass the compiler to let
it know that both of the handlers will be unregistered before the init
section is destroyed.

Perhaps I should tag those callbacks with __ref? I am not sure the right
thing to do here.

Cheers,
Don

> 
>   LD      vmlinux.o
>   MODPOST vmlinux.o
> WARNING: vmlinux.o(.data+0x7cf0): Section mismatch in reference from the variable test_nmi_ipi_callback_na.10451 to the function .init.text:test_nmi_ipi_callback()
> The variable test_nmi_ipi_callback_na.10451 references
> the function __init test_nmi_ipi_callback()
> If the reference is valid then annotate the
> variable with __init* or __refdata (see linux/init.h) or name the variable:
> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
> 
> WARNING: vmlinux.o(.data+0x7d04): Section mismatch in reference from the variable nmi_unk_cb_na.10399 to the function .init.text:nmi_unk_cb()
> The variable nmi_unk_cb_na.10399 references
> the function __init nmi_unk_cb()
> If the reference is valid then annotate the
> variable with __init* or __refdata (see linux/init.h) or name the variable:
> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
> 
>   GEN     .version
>   CHK     include/generated/compile.h
> 
> 
> 
> 
> This is recent change.
> 
> gcc version 4.7.0 (Debian 4.7.0-11) 
> 
> Debian sid, i386.
> 
> -- 
> Witold Baryluk

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: WARNING: arch/x86/built-in.o: Section mismatch in reference from the variable test_nmi_ipi_callback_na to function .ini.text:test_nmi_ipi_callback
  2012-06-04 14:36 ` Don Zickus
@ 2012-06-04 14:59   ` H. Peter Anvin
  2012-06-04 15:08     ` Don Zickus
  2012-06-04 16:35   ` Sam Ravnborg
  1 sibling, 1 reply; 12+ messages in thread
From: H. Peter Anvin @ 2012-06-04 14:59 UTC (permalink / raw)
  To: Don Zickus
  Cc: Witold Baryluk, linux-kernel, Thomas Gleixner, Ingo Molnar, x86

On 06/04/2012 07:36 AM, Don Zickus wrote:
> 
> Basically the test registers two nmi_handlers, run some tests, and
> then unregisters them.  Those handlers are what the compiler seems to be
> complaining about.  I do not know what magic to pass the compiler to let
> it know that both of the handlers will be unregistered before the init
> section is destroyed.
> 
> Perhaps I should tag those callbacks with __ref? I am not sure the right
> thing to do here.
> 

Using __ref is the right thing, although __ref is hard to use right...

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: WARNING: arch/x86/built-in.o: Section mismatch in reference from the variable test_nmi_ipi_callback_na to function .ini.text:test_nmi_ipi_callback
  2012-06-04 14:59   ` H. Peter Anvin
@ 2012-06-04 15:08     ` Don Zickus
  0 siblings, 0 replies; 12+ messages in thread
From: Don Zickus @ 2012-06-04 15:08 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Witold Baryluk, linux-kernel, Thomas Gleixner, Ingo Molnar, x86

On Mon, Jun 04, 2012 at 07:59:41AM -0700, H. Peter Anvin wrote:
> On 06/04/2012 07:36 AM, Don Zickus wrote:
> > 
> > Basically the test registers two nmi_handlers, run some tests, and
> > then unregisters them.  Those handlers are what the compiler seems to be
> > complaining about.  I do not know what magic to pass the compiler to let
> > it know that both of the handlers will be unregistered before the init
> > section is destroyed.
> > 
> > Perhaps I should tag those callbacks with __ref? I am not sure the right
> > thing to do here.
> > 
> 
> Using __ref is the right thing, although __ref is hard to use right...

Thanks!  I'll poke at it and see how lucky I get.

Cheers,
Don

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: WARNING: arch/x86/built-in.o: Section mismatch in reference from the variable test_nmi_ipi_callback_na to function .ini.text:test_nmi_ipi_callback
  2012-06-04 14:36 ` Don Zickus
  2012-06-04 14:59   ` H. Peter Anvin
@ 2012-06-04 16:35   ` Sam Ravnborg
  2012-06-04 19:08     ` Different WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit() Witold Baryluk
  1 sibling, 1 reply; 12+ messages in thread
From: Sam Ravnborg @ 2012-06-04 16:35 UTC (permalink / raw)
  To: Don Zickus
  Cc: Witold Baryluk, linux-kernel, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Mon, Jun 04, 2012 at 10:36:43AM -0400, Don Zickus wrote:
> On Sat, Jun 02, 2012 at 06:15:02PM +0200, Witold Baryluk wrote:
> > Hello everybody,
> > 
> > x86 32-bit Build just got 2 WARNINGS when building kernel on Linus' tree.
> 
> Hi Witold,
> 
> Thanks for the warnings.
> 
> > 
> > 
> >  VDSOSYM arch/x86/vdso/vdso32-syms.lds
> >   LD      arch/x86/vdso/built-in.o
> >   LD      arch/x86/built-in.o
> > WARNING: arch/x86/built-in.o(.data+0x5af0): Section mismatch in reference from the variable test_nmi_ipi_callback_na.10451 to the function .init.text:test_nmi_ipi_callback()
> > The variable test_nmi_ipi_callback_na.10451 references
> > the function __init test_nmi_ipi_callback()
> > If the reference is valid then annotate the
> > variable with __init* or __refdata (see linux/init.h) or name the variable:
> > *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
> > 
> > WARNING: arch/x86/built-in.o(.data+0x5b04): Section mismatch in reference from the variable nmi_unk_cb_na.10399 to the function .init.text:nmi_unk_cb()
> > The variable nmi_unk_cb_na.10399 references
> > the function __init nmi_unk_cb()
> > If the reference is valid then annotate the
> > variable with __init* or __refdata (see linux/init.h) or name the variable:
> > *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
> 
> These are intermediate variables test_nmi_ipi_callback_na.10451 and
> nmi_unk_cb_na.10399.  I do not know how to fix them.
> 
> Basically the test registers two nmi_handlers, run some tests, and
> then unregisters them.  Those handlers are what the compiler seems to be
> complaining about.  I do not know what magic to pass the compiler to let
> it know that both of the handlers will be unregistered before the init
> section is destroyed.
> 
> Perhaps I should tag those callbacks with __ref? I am not sure the right
> thing to do here.

Drop the __init from nmi_unk_cb() and test_nmi_ipi_callback().
Then the warnings are gone.

Trying to let register_nmi_handler() accept a function annotated __init is
wrong as we do not want this.
I someone try this in 'real' code we would be screwed.

	Sam

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Different WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit()
  2012-06-04 16:35   ` Sam Ravnborg
@ 2012-06-04 19:08     ` Witold Baryluk
  2012-06-04 19:17       ` Sam Ravnborg
  0 siblings, 1 reply; 12+ messages in thread
From: Witold Baryluk @ 2012-06-04 19:08 UTC (permalink / raw)
  To: Robert Love
  Cc: linux-kernel, Robert Love, James E.J. Bottomley, devel,
	linux-scsi

On 06-04 18:35, Sam Ravnborg wrote:
> On Mon, Jun 04, 2012 at 10:36:43AM -0400, Don Zickus wrote:
> > On Sat, Jun 02, 2012 at 06:15:02PM +0200, Witold Baryluk wrote:
> > > Hello everybody,
> > > 
> > > x86 32-bit Build just got 2 WARNINGS when building kernel on Linus' tree.
> > 
> > Hi Witold,
> > 
> > Thanks for the warnings.
> > 
> > > 
> > > 
> > >  VDSOSYM arch/x86/vdso/vdso32-syms.lds
> > >   LD      arch/x86/vdso/built-in.o
> > >   LD      arch/x86/built-in.o
> > > WARNING: arch/x86/built-in.o(.data+0x5af0): Section mismatch in reference from the variable test_nmi_ipi_callback_na.10451 to the function .init.text:test_nmi_ipi_callback()
> > > The variable test_nmi_ipi_callback_na.10451 references
> > > the function __init test_nmi_ipi_callback()
> > > If the reference is valid then annotate the
> > > variable with __init* or __refdata (see linux/init.h) or name the variable:
> > > *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
> > > 
> > > WARNING: arch/x86/built-in.o(.data+0x5b04): Section mismatch in reference from the variable nmi_unk_cb_na.10399 to the function .init.text:nmi_unk_cb()
> > > The variable nmi_unk_cb_na.10399 references
> > > the function __init nmi_unk_cb()
> > > If the reference is valid then annotate the
> > > variable with __init* or __refdata (see linux/init.h) or name the variable:
> > > *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
> > 
> > These are intermediate variables test_nmi_ipi_callback_na.10451 and
> > nmi_unk_cb_na.10399.  I do not know how to fix them.
> > 
> > Basically the test registers two nmi_handlers, run some tests, and
> > then unregisters them.  Those handlers are what the compiler seems to be
> > complaining about.  I do not know what magic to pass the compiler to let
> > it know that both of the handlers will be unregistered before the init
> > section is destroyed.
> > 
> > Perhaps I should tag those callbacks with __ref? I am not sure the right
> > thing to do here.
> 
> Drop the __init from nmi_unk_cb() and test_nmi_ipi_callback().
> Then the warnings are gone.
> 
> Trying to let register_nmi_handler() accept a function annotated __init is
> wrong as we do not want this.
> I someone try this in 'real' code we would be screwed.
> 
> 	Sam


By the way when we are on topic, here is one more


  MKPIGGY arch/x86/boot/compressed/piggy.S
  AS      arch/x86/boot/compressed/piggy.o
  LD      arch/x86/boot/compressed/vmlinux
  ZOFFSET arch/x86/boot/zoffset.h
  AS      arch/x86/boot/header.o
  CC      arch/x86/boot/version.o
  LD      arch/x86/boot/setup.elf
  OBJCOPY arch/x86/boot/setup.bin
  OBJCOPY arch/x86/boot/vmlinux.bin
  BUILD   arch/x86/boot/bzImage
Setup is 16288 bytes (padded to 16384 bytes).
System is 4418 kB
CRC 46186b65
Kernel: arch/x86/boot/bzImage is ready  (#12)
  Building modules, stage 2.
  MODPOST 591 modules
WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit()
The function __init init_module() references
a function __exit fcoe_transport_exit().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
fcoe_transport_exit() so it may be used outside an exit section.

  CC      arch/x86/crypto/crc32c-intel.mod.o
  LD [M]  arch/x86/crypto/crc32c-intel.ko
  CC      arch/x86/crypto/salsa20-i586.mod.o
  LD [M]  arch/x86/crypto/salsa20-i586.ko
  CC      arch/x86/crypto/serpent-sse2-i586.mod.o
  LD [M]  arch/x86/crypto/serpent-sse2-i586.ko



(I'm dropping previous CC list, as this warning is easier to solve,
probably just following this instructions - dropping __exit from
fcoe_transport_exit() should be fine, especially if indeed it is needed
from init_module in error path).


Regards,
Witek

-- 
Witold Baryluk

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Different WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit()
  2012-06-04 19:08     ` Different WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit() Witold Baryluk
@ 2012-06-04 19:17       ` Sam Ravnborg
  2012-06-04 20:52         ` Zou, Yi
  0 siblings, 1 reply; 12+ messages in thread
From: Sam Ravnborg @ 2012-06-04 19:17 UTC (permalink / raw)
  To: Witold Baryluk
  Cc: Robert Love, linux-kernel, James E.J. Bottomley, devel,
	linux-scsi

> WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit()
> The function __init init_module() references
> a function __exit fcoe_transport_exit().
> This is often seen when error handling in the init function
> uses functionality in the exit path.
> The fix is often to remove the __exit annotation of
> fcoe_transport_exit() so it may be used outside an exit section.
> 
>   CC      arch/x86/crypto/crc32c-intel.mod.o
>   LD [M]  arch/x86/crypto/crc32c-intel.ko
>   CC      arch/x86/crypto/salsa20-i586.mod.o
>   LD [M]  arch/x86/crypto/salsa20-i586.ko
>   CC      arch/x86/crypto/serpent-sse2-i586.mod.o
>   LD [M]  arch/x86/crypto/serpent-sse2-i586.ko
> 
> 
> 
> (I'm dropping previous CC list, as this warning is easier to solve,
> probably just following this instructions - dropping __exit from
> fcoe_transport_exit() should be fine, especially if indeed it is needed
> from init_module in error path).

Correct - dropping __exit is the fix here.

	Sam

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: Different WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit()
  2012-06-04 19:17       ` Sam Ravnborg
@ 2012-06-04 20:52         ` Zou, Yi
  2012-06-04 22:33           ` Sam Ravnborg
  0 siblings, 1 reply; 12+ messages in thread
From: Zou, Yi @ 2012-06-04 20:52 UTC (permalink / raw)
  To: Sam Ravnborg, Witold Baryluk
  Cc: Love, Robert W, linux-kernel@vger.kernel.org,
	James E.J. Bottomley, devel@open-fcoe.org,
	linux-scsi@vger.kernel.org

> 
> > WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch
> in reference from the function init_module() to the
> function .exit.text:fcoe_transport_exit()
> > The function __init init_module() references
> > a function __exit fcoe_transport_exit().
> > This is often seen when error handling in the init function
> > uses functionality in the exit path.
> > The fix is often to remove the __exit annotation of
> > fcoe_transport_exit() so it may be used outside an exit section.
> >
> >   CC      arch/x86/crypto/crc32c-intel.mod.o
> >   LD [M]  arch/x86/crypto/crc32c-intel.ko
> >   CC      arch/x86/crypto/salsa20-i586.mod.o
> >   LD [M]  arch/x86/crypto/salsa20-i586.ko
> >   CC      arch/x86/crypto/serpent-sse2-i586.mod.o
> >   LD [M]  arch/x86/crypto/serpent-sse2-i586.ko
> >
> >
> >
> > (I'm dropping previous CC list, as this warning is easier to solve,
> > probably just following this instructions - dropping __exit from
> > fcoe_transport_exit() should be fine, especially if indeed it is needed
> > from init_module in error path).
> 
> Correct - dropping __exit is the fix here.
> 
> 	Sam

> 	Sam
However, fcoe_transport_exit() is called only in module *exit* path by the
module exit func libfcoe_exit(), not in the init_module error path. Let me 
take a objdump of the libfcoe.o to see where your above section mismatch warning
is from. Is this on 32bit only?

yi

> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Different WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit()
  2012-06-04 20:52         ` Zou, Yi
@ 2012-06-04 22:33           ` Sam Ravnborg
  2012-06-04 23:11             ` Zou, Yi
  0 siblings, 1 reply; 12+ messages in thread
From: Sam Ravnborg @ 2012-06-04 22:33 UTC (permalink / raw)
  To: Zou, Yi
  Cc: Witold Baryluk, Love, Robert W, linux-kernel@vger.kernel.org,
	James E.J. Bottomley, devel@open-fcoe.org,
	linux-scsi@vger.kernel.org

> However, fcoe_transport_exit() is called only in module *exit* path by the
> module exit func libfcoe_exit(), not in the init_module error path. Let me 
> take a objdump of the libfcoe.o to see where your above section mismatch warning
> is from. Is this on 32bit only?

static int __init libfcoe_init(void)
{
        int rc = 0;

        rc = fcoe_transport_init();
        if (rc)
                return rc;

        rc = fcoe_sysfs_setup();
        if (rc)
                fcoe_transport_exit();    <=============

        return rc;
}

It is called from __init context here.




static void __exit libfcoe_exit(void)
{
        fcoe_sysfs_teardown();
        fcoe_transport_exit();     <==============
}

And from __exit context here.
This is -rc1.

	Sam

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: Different WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit()
  2012-06-04 22:33           ` Sam Ravnborg
@ 2012-06-04 23:11             ` Zou, Yi
  2012-06-06 18:59               ` [PATCH] libfcoe: Fix section mismatch Robert Love
  0 siblings, 1 reply; 12+ messages in thread
From: Zou, Yi @ 2012-06-04 23:11 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Witold Baryluk, Love, Robert W, linux-kernel@vger.kernel.org,
	James E.J. Bottomley, devel@open-fcoe.org,
	linux-scsi@vger.kernel.org

> 
> > However, fcoe_transport_exit() is called only in module *exit* path by
> the
> > module exit func libfcoe_exit(), not in the init_module error path. Let
> me
> > take a objdump of the libfcoe.o to see where your above section
> mismatch warning
> > is from. Is this on 32bit only?
> 
> static int __init libfcoe_init(void)
> {
>         int rc = 0;
> 
>         rc = fcoe_transport_init();
>         if (rc)
>                 return rc;
> 
>         rc = fcoe_sysfs_setup();
>         if (rc)
>                 fcoe_transport_exit();    <=============
> 
>         return rc;
> }
> 
> It is called from __init context here.
> 
> 
> 
> 
> static void __exit libfcoe_exit(void)
> {
>         fcoe_sysfs_teardown();
>         fcoe_transport_exit();     <==============
> }
> 
> And from __exit context here.
> This is -rc1.
> 
> 	Sam
Ah...haven't pulled the rc1 yet, which was why I did not see the this.
Anyway, yeah you are right, dropping __exit should fix the problem.

thanks,
yi


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] libfcoe: Fix section mismatch
  2012-06-04 23:11             ` Zou, Yi
@ 2012-06-06 18:59               ` Robert Love
  2012-06-06 19:58                 ` Sam Ravnborg
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Love @ 2012-06-06 18:59 UTC (permalink / raw)
  To: linux-scsi, baryluk, linux-kernel, JBottomley, devel; +Cc: Mark Rustad, yi.zou

From: Mark Rustad <mark.d.rustad@intel.com>

Recent changes to add fcoe_sysfs caused libfcoe_init to call fcoe_transport_exit
in a module initialization routine. The change resulted in the below error. This
patch removes the __exit keyword from the fcoe_transport_exit definition such
that it may be called from an __init routine.

WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x21): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transp
exit()
The function __init init_module() references
a function __exit fcoe_transport_exit().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
fcoe_transport_exit() so it may be used outside an exit section.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
 drivers/scsi/fcoe/fcoe_transport.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index b46f43d..71cc909 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -502,7 +502,7 @@ static int __init fcoe_transport_init(void)
 	return 0;
 }
 
-static int __exit fcoe_transport_exit(void)
+static int fcoe_transport_exit(void)
 {
 	struct fcoe_transport *ft;
 


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] libfcoe: Fix section mismatch
  2012-06-06 18:59               ` [PATCH] libfcoe: Fix section mismatch Robert Love
@ 2012-06-06 19:58                 ` Sam Ravnborg
  0 siblings, 0 replies; 12+ messages in thread
From: Sam Ravnborg @ 2012-06-06 19:58 UTC (permalink / raw)
  To: Robert Love
  Cc: linux-scsi, baryluk, linux-kernel, JBottomley, devel, Mark Rustad,
	yi.zou

On Wed, Jun 06, 2012 at 11:59:48AM -0700, Robert Love wrote:
> From: Mark Rustad <mark.d.rustad@intel.com>
> 
> Recent changes to add fcoe_sysfs caused libfcoe_init to call fcoe_transport_exit
> in a module initialization routine. The change resulted in the below error. This
> patch removes the __exit keyword from the fcoe_transport_exit definition such
> that it may be called from an __init routine.
> 
> WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x21): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transp
> exit()
> The function __init init_module() references
> a function __exit fcoe_transport_exit().
> This is often seen when error handling in the init function
> uses functionality in the exit path.
> The fix is often to remove the __exit annotation of
> fcoe_transport_exit() so it may be used outside an exit section.
> 
> Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
> Signed-off-by: Robert Love <robert.w.love@intel.com>

Looks good.

Acked-by: Sam Ravnborg <sam@ravnborg.org>

	Sam

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-06-06 19:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-02 16:15 WARNING: arch/x86/built-in.o: Section mismatch in reference from the variable test_nmi_ipi_callback_na to function .ini.text:test_nmi_ipi_callback Witold Baryluk
2012-06-04 14:36 ` Don Zickus
2012-06-04 14:59   ` H. Peter Anvin
2012-06-04 15:08     ` Don Zickus
2012-06-04 16:35   ` Sam Ravnborg
2012-06-04 19:08     ` Different WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x1a): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transport_exit() Witold Baryluk
2012-06-04 19:17       ` Sam Ravnborg
2012-06-04 20:52         ` Zou, Yi
2012-06-04 22:33           ` Sam Ravnborg
2012-06-04 23:11             ` Zou, Yi
2012-06-06 18:59               ` [PATCH] libfcoe: Fix section mismatch Robert Love
2012-06-06 19:58                 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox