• Rusty Russell's avatar
    [PATCH] module names fix · c99f5cea
    Rusty Russell authored
    By Kai Germaschewski:
    
     "Well, I have another solution, which doesn't need additional Makefile
      magic or anything.
    
      I just put the module name into each .o file where <linux/module.h> is
      included. Putting it into the section .gnu.linkonce.modname has the effect
      that even for multi-part modules, we only end up with one copy of the
      name.
    
      Caveat: I'm using the preprocessor macro KBUILD_MODNAME to know what to
      put into .gnu.linkonce.modname. The following used to happen:
    
      (drivers/isdn/eicon/Makefile)
    
      divas-objs := common.o Divas_mod.o ...
      eicon-objs := common.o eicon_mod.o ...
    
      Divas_mod.o is compiled with -DKBUILD_MODNAME=divas
      eicon_mod.o is compiled with -DKBUILD_MODNAME=eicon
      common.o is compiled with -DKBUILD_MODNAME=divas_eicon
    
      So in the case above, both divas.o and eicon.o would end up with
      a .gnu.linkonce.modname section containing "divas_eicon"
    
      My fix to this is to not define KBUILD_MODNAME when compiling an object
      whilch will be linked into more than one module - so common.o gets no
      .gnu.linkonce.modname section at all. Works fine here.
    
      Now, doing this I remove one of the reasons why we would need modules
      linked as '.ko' ;), but it seems much cleaner than generating a temporary
      file, using objcopy etc."
    c99f5cea
inflate_syms.c 519 Bytes