Re: Making module versions (Was: OFFTOPIC: binary modules, bad

Roderich Schupp (rsch@ExperTeam.de)
Fri, 26 Dec 1997 21:50:31 +0100


teunis@mauve.computersupportcentre.com said:
> (As a side note: I can't figure out why the indirection __kstrtab_bar
> is needed. I think it would suffice to have
> const struct module_symbol __ksymtab_bar ...
> { (unsigned long)&bar, "bar_R123" };
> this is because that symbol is exported to a seperate section of that
> file (section "__ksymtab") (the name gets exported to ".kstrtab").
> This is where __start___ksymtab ends up pointing.
I understand why __kysmtab_bar goes into into section __ksymtab.
My nit was: why does the string "bar_R123" need a section attribute
(into ".kstrtab"), too? Someone told me that otherwise the loader might
be tempted to put the string into the same section, i.e. __ksymtab
(which would be a spoiler), but I can't reproduce that...

> The way symbols are extracted from a module and inserted into a
> running kernel is by exporting the "__ksymtab" and ".kstrtab" sections
> of the module into the kernel.... In other words, your "elf" trick
> you described is already in use.
OK, so __ksymtab of module foo.o records the symbols exported by foo.o.
Insmod extracts that information and uses it in the init_module
system call. This will update the kernel ksymtab so that later modules
can reference that symbols, too.

> The only problem with this is that you have to relocate the module so
> it's compatible with kernel-space.... (open the destination memory,
> then upload the module into that memory, then initialize). The
> current scheme works better actually here.
Isn't that was insmod already does? As far as I can tell insmod
insists on being a self-contained mini-linker (without employing
the help of ld or the like).
Chhers, Roderich

--
       Vinny: Is it possible, the two utes...
       Judge: Eh, the two what? Uh, uh, what was that word?
       Vinny: Uh, what word?
       Judge: Two what?
       Vinny: What?
       Judge: Uh, did you say 'Utes'?
       Vinny: Yeah, two utes.
       Judge: What is a ute?
       Vinny: Oh, excuse me, your honor. Two YOUTHS.
Roderich Schupp          mailto:rsch@ExperTeam.de
ExperTeam GmbH           http://www.experteam.de/
Munich, Germany               Linux: 2.1.76