Skip to content

Commit

Permalink
modules: make arch's use default loader hooks
Browse files Browse the repository at this point in the history
This patch removes all the module loader hook implementations in the
architecture specific code where the functionality is the same as that
now provided by the recently added default hooks.

Signed-off-by: Jonas Bonn <[email protected]>
Acked-by: Mike Frysinger <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
Tested-by: Michal Simek <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
Jonas Bonn authored and rustyrussell committed Jul 24, 2011
1 parent 74e08fc commit 66574cc
Show file tree
Hide file tree
Showing 26 changed files with 12 additions and 777 deletions.
34 changes: 0 additions & 34 deletions arch/alpha/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,6 @@
#define DEBUGP(fmt...)
#endif

void *
module_alloc(unsigned long size)
{
if (size == 0)
return NULL;
return vmalloc(size);
}

void
module_free(struct module *mod, void *module_region)
{
vfree(module_region);
}

/* Allocate the GOT at the end of the core sections. */

struct got_entry {
Expand Down Expand Up @@ -155,14 +141,6 @@ module_frob_arch_sections(Elf64_Ehdr *hdr, Elf64_Shdr *sechdrs,
return 0;
}

int
apply_relocate(Elf64_Shdr *sechdrs, const char *strtab, unsigned int symindex,
unsigned int relsec, struct module *me)
{
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
return -ENOEXEC;
}

int
apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
unsigned int symindex, unsigned int relsec,
Expand Down Expand Up @@ -302,15 +280,3 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,

return 0;
}

int
module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
struct module *me)
{
return 0;
}

void
module_arch_cleanup(struct module *mod)
{
}
29 changes: 1 addition & 28 deletions arch/arm/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,7 @@ void *module_alloc(unsigned long size)
GFP_KERNEL, PAGE_KERNEL_EXEC, -1,
__builtin_return_address(0));
}
#else /* CONFIG_MMU */
void *module_alloc(unsigned long size)
{
return size == 0 ? NULL : vmalloc(size);
}
#endif /* !CONFIG_MMU */

void module_free(struct module *module, void *region)
{
vfree(region);
}

int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
}
#endif

int
apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
Expand Down Expand Up @@ -265,15 +247,6 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
return 0;
}

int
apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
unsigned int symindex, unsigned int relsec, struct module *module)
{
printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
module->name);
return -ENOEXEC;
}

struct mod_unwind_map {
const Elf_Shdr *unw_sec;
const Elf_Shdr *txt_sec;
Expand Down
20 changes: 0 additions & 20 deletions arch/avr32/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
#include <linux/moduleloader.h>
#include <linux/vmalloc.h>

void *module_alloc(unsigned long size)
{
if (size == 0)
return NULL;
return vmalloc(size);
}

void module_free(struct module *mod, void *module_region)
{
vfree(mod->arch.syminfo);
Expand Down Expand Up @@ -299,15 +292,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
return ret;
}

int apply_relocate(Elf32_Shdr *sechdrs, const char *strtab,
unsigned int symindex, unsigned int relindex,
struct module *module)
{
printk(KERN_ERR "module %s: REL relocations are not supported\n",
module->name);
return -ENOEXEC;
}

int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
struct module *module)
{
Expand All @@ -316,7 +300,3 @@ int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,

return 0;
}

void module_arch_cleanup(struct module *module)
{
}
21 changes: 0 additions & 21 deletions arch/blackfin/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@
#include <asm/cacheflush.h>
#include <asm/uaccess.h>

void *module_alloc(unsigned long size)
{
if (size == 0)
return NULL;
return vmalloc(size);
}

/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
{
vfree(module_region);
}

/* Transfer the section to the L1 memory */
int
module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
Expand Down Expand Up @@ -150,14 +137,6 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
return 0;
}

int
apply_relocate(Elf_Shdr * sechdrs, const char *strtab,
unsigned int symindex, unsigned int relsec, struct module *mod)
{
pr_err(".rel unsupported\n");
return -ENOEXEC;
}

/*************************************************************************/
/* FUNCTION : apply_relocate_add */
/* ABSTRACT : Blackfin specific relocation handling for the loadable */
Expand Down
43 changes: 3 additions & 40 deletions arch/cris/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,45 +30,19 @@
#endif

#ifdef CONFIG_ETRAX_KMALLOCED_MODULES
#define MALLOC_MODULE(size) kmalloc(size, GFP_KERNEL)
#define FREE_MODULE(region) kfree(region)
#else
#define MALLOC_MODULE(size) vmalloc_exec(size)
#define FREE_MODULE(region) vfree(region)
#endif

void *module_alloc(unsigned long size)
{
if (size == 0)
return NULL;
return MALLOC_MODULE(size);
return kmalloc(size, GFP_KERNEL);
}


/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
{
FREE_MODULE(module_region);
}

/* We don't need anything special. */
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
}

int apply_relocate(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
return -ENOEXEC;
kfree(module_region);
}
#endif

int apply_relocate_add(Elf32_Shdr *sechdrs,
const char *strtab,
Expand Down Expand Up @@ -108,14 +82,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,

return 0;
}

int module_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *me)
{
return 0;
}

void module_arch_cleanup(struct module *mod)
{
}
57 changes: 3 additions & 54 deletions arch/frv/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,57 +22,6 @@
#define DEBUGP(fmt...)
#endif

void *module_alloc(unsigned long size)
{
if (size == 0)
return NULL;

return vmalloc_exec(size);
}


/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
{
vfree(module_region);
}

/* We don't need anything special. */
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
}

int apply_relocate(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
return -ENOEXEC;
}

int apply_relocate_add(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
return -ENOEXEC;
}

int module_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *me)
{
return 0;
}

void module_arch_cleanup(struct module *mod)
{
}
/* TODO: At least one of apply_relocate or apply_relocate_add must be
* implemented in order to get working module support.
*/
45 changes: 0 additions & 45 deletions arch/h8300/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,6 @@
#define DEBUGP(fmt...)
#endif

void *module_alloc(unsigned long size)
{
if (size == 0)
return NULL;
return vmalloc(size);
}


/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
{
vfree(module_region);
}

/* We don't need anything special. */
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
}

int apply_relocate(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
printk(KERN_ERR "module %s: RELOCATION unsupported\n",
me->name);
return -ENOEXEC;
}

int apply_relocate_add(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
Expand Down Expand Up @@ -107,14 +73,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
me->name, rela[i].r_offset);
return -ENOEXEC;
}

int module_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *me)
{
return 0;
}

void module_arch_cleanup(struct module *mod)
{
}
16 changes: 0 additions & 16 deletions arch/ia64/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,6 @@ plt_target (struct plt_entry *plt)

#endif /* !USE_BRL */

void *
module_alloc (unsigned long size)
{
if (!size)
return NULL;
return vmalloc(size);
}

void
module_free (struct module *mod, void *module_region)
{
Expand Down Expand Up @@ -853,14 +845,6 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symind
return 0;
}

int
apply_relocate (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symindex,
unsigned int relsec, struct module *mod)
{
printk(KERN_ERR "module %s: REL relocs in section %u unsupported\n", mod->name, relsec);
return -ENOEXEC;
}

/*
* Modules contain a single unwind table which covers both the core and the init text
* sections but since the two are not contiguous, we need to split this table up such that
Expand Down
Loading

0 comments on commit 66574cc

Please sign in to comment.