• Tony Luck's avatar
    [PATCH] ia64: fix reloc-out-of-range error on module loading · e8253652
    Tony Luck authored
    I'm hitting this problem because the module I want to load was
    compiled with -g, so the filesize is absolutely huge.  kernel/module.c
    does a vmalloc() to inhale the entire file, and then two calls to
    module_alloc() (which calls vmalloc() on ia64) to load the 'init' and
    'core' sections. The 'init' is small and slips into a gap early in the
    vmalloc playspace, while the 'core' area is allocated after the huge
    area that was allocated for the inhaled copy of the whole file.
    
    I made a one coding change to Jean-Marc's version, adding a check to
    see whether the init/core sections are close enough together for the
    PCREL21B to reach (they almost always are).
    
    I've kept the test that there are no jumps from core to init (though
    the message that is printed is almost as unhelpful as the one that you
    get when you statically link a module into the kernel that has calls
    to the discarded .exit section :-)
    
    This patch stalled out before on the question of whether a PLT was
    overkill for a section-to-section branch, and whether it would be
    better to use relaxation techniques to extend the range.  Doing that
    might be more elegant in some way, but it needs a whole heap of extra
    code (to count how many relaxed branches need to be added and
    allocated them as needed).  This seems a lot of extra code that is
    only ever going to be exercised by maniacs like me with 49MB .ko
    files.
    
    I fixed up the comments to be a little more heplful.
    
    Signed-off-by: <tony.luck@intel.com>
    Signed-off-by: default avatarDavid Mosberger <davidm@hpl.hp.com>
    e8253652
module.c 26.5 KB