[lkml]   [1996]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Module complexities
Hi Matthias!

Here is a quick answer to your mail. I will look further into the
problem and will perhaps give a lengthier answer later...

The CONFIG_MODVERSION vs. MODVERSIONS "problem" came up as a result
of Linus wanting to remove as many "#include <linux/config.h>" as
possible, as supported by the awk-script depend.awk (in 1.3.39?).
This meant that he renamed CONFIG_MODVERSIONS to just MODVERSIONS, and
I had to find a way to make the symbol versioning work in spite of this...

I'd just like to know if you have tried genksyms from a recent release
of the module utilities, i.e. modules-1.3.57 (and later).
In the latest versions of genksyms, the "if" in the *.ver files look like:
#if (defined(CONFIG_MODVERSIONS) || defined(MODVERSIONS)) && \

The -D_EXPORT_SYMTAB is only intended for exporting objects that are
included resident in the kernel, i.e. not intended as modules.

Well, I'm still afraid that you will have to do a bit of "magic"
in the Makefile, especially w.r.t. versioned modules..

Anyway, it _should_ work with just this in your source:
#include <linux/module.h>
#include "symtables.h"

Your Makefile should then look something like:
INCDIR = /usr/include
CFLAGS = -O2 -Wall -I. -I$(INCDIR) -D__KERNEL__
MODFLAGS = -DMODULE -DMODVERSIONS -include $(INCDIR)/linux/modversions.h
# MODFLAGS = -DMODULE # for unversioned modules

OBJS = a.o b.o c.o d.o

module.o: $(OBJS)

# versioning support
%.ver: %.c
$(CC) $(CFLAGS) -E -D__GENKSYMS__ $< | /sbin/genksyms -w .

# versioning support
symtables.h: $(addprefix ./,$(OBJS:.o=.ver))
@echo updating symtables.h
@(echo "#ifdef MODVERSIONS";\
echo "#ifndef _set_ver";\
echo "#define _set_ver(sym,vers) sym ## _R ## vers";\
echo "#endif";\
for f in *.ver; do echo "#include \"$${f}\""; done; \
echo "#endif") \
> symtables.h

$(OBJS): symtables.h
$(CC) $(CFLAGS) $(MODFLAGS) -c $(@:.o=.c)


This is more or less "from the top of my head", so I may be wrong.
It _is_ a bit hairy to follow all the variants in the header files,
and I only understand it fully myself on alternate Thursdays...

Except finding out by itself if modules should be versioned or not,
does this do what you want?

I should perhaps create a "standard" Rules.make for modules and
include it in the next release of modules-x.y.z. Or not...?


Bjorn <> <>

> Matthias Urlichs \ XLink-POP N=FCrnberg | EMail: urlichs@smurf.=
> Schleiermacherstra=DFe 12 \ Unix+Linux+Mac | Phone: ...please use =
> email.
> 90491 N=FCrnberg (Germany) \ Consulting+Networking+Programming+etc'i=
> ng 42
> PGP: 1B 89 E2 1C 43 EA 80 44 15 D2 29 CF C6 C7 E0 DE=20
> Click <A HREF=3D"">here</A>.

 \ /
  Last update: 2005-03-22 13:36    [W:0.121 / U:1.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site