Re: Exporting new functions from kernel 2.2.14

Keith Owens (kaos@ocs.com.au)
Wed, 06 Jun 2001 00:59:39 +1000


On Tue, 05 Jun 2001 10:32:41 -0700,
Stephen Wille Padnos <stephenwp@adelphia.net> wrote:
>Unfortunately, the printk warning was still there.
>
>I replaced the unconditional #define MODVERSIONS with
>#include <linux/config.h>
>#ifdef CONFIG_MODVERSIONS
>#define MODVERSIONS
>#include <linux/modversions.h>
>#endif
>
>this is at the top of my source file. (before module.h and linux.h)
>
>(as seen somewhere on the web)

And like many things on the web, it is wrong. Do not put anything in
the source code expect #include <linux/module.h> as the first include.
In particular do not include modversions.h yourself, it will break in
2.5. You compile a module with these gcc flags

(1) -DMODULE
(2) -DMODVERSIONS -include $(TOPDIR)/include/linux/modversions.h
(3) -DEXPORT_SYMTAB

All modules get flag (1).
All modules get flags (2) but only if .config contains
CONFIG_MODVERSIONS, otherwise omit these flags.
Only modules that export symbols get flag (3).

That is what the standard kernel Makefiles do and is the only correct
way to compile modules.

Keith Owens, kernel build and modutils maintainer.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/