2000-11-18 05:46:31

by Jeff Garzik

[permalink] [raw]
Subject: EXPORT_NO_SYMBOLS vs. (null) ?

What is the difference between a module that exports no symbols and
includes EXPORT_NO_SYMBOLS reference, and such a module that lacks
EXPORT_NO_SYMBOLS?

Alan once upbraided me for assuming they were the same :)

--
Jeff Garzik |
Building 1024 | The chief enemy of creativity is "good" sense
MandrakeSoft | -- Picasso


2000-11-18 08:10:42

by Keith Owens

[permalink] [raw]
Subject: Re: EXPORT_NO_SYMBOLS vs. (null) ?

On Sat, 18 Nov 2000 00:15:35 -0500,
Jeff Garzik <[email protected]> wrote:
>What is the difference between a module that exports no symbols and
>includes EXPORT_NO_SYMBOLS reference, and such a module that lacks
>EXPORT_NO_SYMBOLS?

When modules were first introduced, all symbols were automatically
exported. For kernel 2.0 compatibility, a module without
EXPORT_NO_SYMBOLS actually exports everything. There are flags on
insmod to override this default. modutils 2.5 will remove this
backwards compatibility, no module will export symbols unless they are
explicitly exported. If you are feeling brave, add
insmod_opt=-x
to your modules.conf and see what breaks in 2.4.

2000-11-18 17:42:27

by Alan

[permalink] [raw]
Subject: Re: EXPORT_NO_SYMBOLS vs. (null) ?

> What is the difference between a module that exports no symbols and
> includes EXPORT_NO_SYMBOLS reference, and such a module that lacks
> EXPORT_NO_SYMBOLS?
>
> Alan once upbraided me for assuming they were the same :)

EXPORT_NO_SYMBOLS - nothing exported
MODULE_foo - export specific symbol

none of the above, export all globals but without modvers

The behaviour may have changed with newer modutils, its originally there for
compatibility in the earlier days of the module stuff

2000-11-18 18:10:36

by Rogier Wolff

[permalink] [raw]
Subject: Re: EXPORT_NO_SYMBOLS vs. (null) ?

Alan Cox wrote:
> > What is the difference between a module that exports no symbols and
> > includes EXPORT_NO_SYMBOLS reference, and such a module that lacks
> > EXPORT_NO_SYMBOLS?
> >
> > Alan once upbraided me for assuming they were the same :)
>
> EXPORT_NO_SYMBOLS - nothing exported
> MODULE_foo - export specific symbol
>
> none of the above, export all globals but without modvers
^^^^^^^ and statics!!!!

I consider that a bug, but...

Roger.

--
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots.
* There are also old, bald pilots.

2000-11-18 18:16:06

by Jeff Garzik

[permalink] [raw]
Subject: Re: EXPORT_NO_SYMBOLS vs. (null) ?

Rogier Wolff wrote:
>
> Alan Cox wrote:
> > > What is the difference between a module that exports no symbols and
> > > includes EXPORT_NO_SYMBOLS reference, and such a module that lacks
> > > EXPORT_NO_SYMBOLS?
> > >
> > > Alan once upbraided me for assuming they were the same :)
> >
> > EXPORT_NO_SYMBOLS - nothing exported
> > MODULE_foo - export specific symbol
> >
> > none of the above, export all globals but without modvers
> ^^^^^^^ and statics!!!!
>
> I consider that a bug, but...

eh? Can you give an example of this? This should definitely -not- be
the case.

Jeff


--
Jeff Garzik |
Building 1024 | The chief enemy of creativity is "good" sense
MandrakeSoft | -- Picasso

2000-11-18 18:20:28

by Rogier Wolff

[permalink] [raw]
Subject: Re: EXPORT_NO_SYMBOLS vs. (null) ?

Jeff Garzik wrote:
> Rogier Wolff wrote:
> >
> > Alan Cox wrote:
> > > > What is the difference between a module that exports no symbols and
> > > > includes EXPORT_NO_SYMBOLS reference, and such a module that lacks
> > > > EXPORT_NO_SYMBOLS?
> > > >
> > > > Alan once upbraided me for assuming they were the same :)
> > >
> > > EXPORT_NO_SYMBOLS - nothing exported
> > > MODULE_foo - export specific symbol
> > >
> > > none of the above, export all globals but without modvers
> > ^^^^^^^ and statics!!!!
> >
> > I consider that a bug, but...
>
> eh? Can you give an example of this? This should definitely -not- be
> the case.

Compile a kernel, marking "sx" and "riscom8" as modules.

Install, modprobe sx, and voila, you'll pull in the riscom because
its "block_til_ready" static was found to satisfy the block_til_ready
from generic_serial.

We're working on renaming the one in generic_serial to
"gs_block_til_ready", but haven't checked yet if the patch got
applied. So you may have to use a "month-old" kernel for this test.

Roger.

--
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots.
* There are also old, bald pilots.

2000-11-18 19:15:34

by Jeff Garzik

[permalink] [raw]
Subject: Re: EXPORT_NO_SYMBOLS vs. (null) ?

Rogier Wolff wrote:
>
> Jeff Garzik wrote:
> > Rogier Wolff wrote:
> > >
> > > Alan Cox wrote:
> > > > > What is the difference between a module that exports no symbols and
> > > > > includes EXPORT_NO_SYMBOLS reference, and such a module that lacks
> > > > > EXPORT_NO_SYMBOLS?
> > > > >
> > > > > Alan once upbraided me for assuming they were the same :)
> > > >
> > > > EXPORT_NO_SYMBOLS - nothing exported
> > > > MODULE_foo - export specific symbol
> > > >
> > > > none of the above, export all globals but without modvers
> > > ^^^^^^^ and statics!!!!
> > >
> > > I consider that a bug, but...
> >
> > eh? Can you give an example of this? This should definitely -not- be
> > the case.
>
> Compile a kernel, marking "sx" and "riscom8" as modules.
>
> Install, modprobe sx, and voila, you'll pull in the riscom because
> its "block_til_ready" static was found to satisfy the block_til_ready
> from generic_serial.

That doesn't imply that statics are being exported as symbols.
generic_serial had no EXPORT_xxx markers, and block_til_ready was
public, so it was expected behavior for g_s to export b_t_r as a symbol.

It is strange that a static which exists in riscom8 causes another
module which exports the same symbol to be pulled in.

> We're working on renaming the one in generic_serial to
> "gs_block_til_ready", but haven't checked yet if the patch got
> applied. So you may have to use a "month-old" kernel for this test.

Can this function be made static? It looks like many drivers define it
themselves..

In any case, you have a patch coming to you [offline] cleaning up the sx
and riscom8 namespaces...

Jeff


--
Jeff Garzik |
Building 1024 | The chief enemy of creativity is "good" sense
MandrakeSoft | -- Picasso

2000-11-19 08:42:43

by Keith Owens

[permalink] [raw]
Subject: Re: EXPORT_NO_SYMBOLS vs. (null) ?

On Sat, 18 Nov 2000 18:50:00 +0100 (MET),
[email protected] (Rogier Wolff) wrote:
>Compile a kernel, marking "sx" and "riscom8" as modules.
>
>Install, modprobe sx, and voila, you'll pull in the riscom because
>its "block_til_ready" static was found to satisfy the block_til_ready
>from generic_serial.

If that is true then it is a bug in either depmod or modprobe. However
I cannot reproduce it using kernel 2.4.0-test11-pre7 and modutils
2.3.20. In particular depmod correctly recognises that sx depends on
block_til_ready in generic_serial, not in riscom. Which kernel, which
modutils, which .config?