|
@@ -30,14 +30,14 @@
|
|
#include <asm/page.h>
|
|
#include <asm/page.h>
|
|
#include <asm/pgtable.h>
|
|
#include <asm/pgtable.h>
|
|
|
|
|
|
-#define DEBUGP(fmt...)
|
|
|
|
|
|
+#define DEBUGP(fmt...)
|
|
|
|
|
|
#ifndef CONFIG_UML
|
|
#ifndef CONFIG_UML
|
|
void module_free(struct module *mod, void *module_region)
|
|
void module_free(struct module *mod, void *module_region)
|
|
{
|
|
{
|
|
vfree(module_region);
|
|
vfree(module_region);
|
|
/* FIXME: If module_region == mod->init_region, trim exception
|
|
/* FIXME: If module_region == mod->init_region, trim exception
|
|
- table entries. */
|
|
|
|
|
|
+ table entries. */
|
|
}
|
|
}
|
|
|
|
|
|
void *module_alloc(unsigned long size)
|
|
void *module_alloc(unsigned long size)
|
|
@@ -77,7 +77,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
|
|
Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr;
|
|
Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr;
|
|
Elf64_Sym *sym;
|
|
Elf64_Sym *sym;
|
|
void *loc;
|
|
void *loc;
|
|
- u64 val;
|
|
|
|
|
|
+ u64 val;
|
|
|
|
|
|
DEBUGP("Applying relocate section %u to %u\n", relsec,
|
|
DEBUGP("Applying relocate section %u to %u\n", relsec,
|
|
sechdrs[relsec].sh_info);
|
|
sechdrs[relsec].sh_info);
|
|
@@ -91,11 +91,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
|
|
sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
|
|
sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
|
|
+ ELF64_R_SYM(rel[i].r_info);
|
|
+ ELF64_R_SYM(rel[i].r_info);
|
|
|
|
|
|
- DEBUGP("type %d st_value %Lx r_addend %Lx loc %Lx\n",
|
|
|
|
- (int)ELF64_R_TYPE(rel[i].r_info),
|
|
|
|
- sym->st_value, rel[i].r_addend, (u64)loc);
|
|
|
|
|
|
+ DEBUGP("type %d st_value %Lx r_addend %Lx loc %Lx\n",
|
|
|
|
+ (int)ELF64_R_TYPE(rel[i].r_info),
|
|
|
|
+ sym->st_value, rel[i].r_addend, (u64)loc);
|
|
|
|
|
|
- val = sym->st_value + rel[i].r_addend;
|
|
|
|
|
|
+ val = sym->st_value + rel[i].r_addend;
|
|
|
|
|
|
switch (ELF64_R_TYPE(rel[i].r_info)) {
|
|
switch (ELF64_R_TYPE(rel[i].r_info)) {
|
|
case R_X86_64_NONE:
|
|
case R_X86_64_NONE:
|
|
@@ -113,16 +113,16 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
|
|
if ((s64)val != *(s32 *)loc)
|
|
if ((s64)val != *(s32 *)loc)
|
|
goto overflow;
|
|
goto overflow;
|
|
break;
|
|
break;
|
|
- case R_X86_64_PC32:
|
|
|
|
|
|
+ case R_X86_64_PC32:
|
|
val -= (u64)loc;
|
|
val -= (u64)loc;
|
|
*(u32 *)loc = val;
|
|
*(u32 *)loc = val;
|
|
#if 0
|
|
#if 0
|
|
if ((s64)val != *(s32 *)loc)
|
|
if ((s64)val != *(s32 *)loc)
|
|
- goto overflow;
|
|
|
|
|
|
+ goto overflow;
|
|
#endif
|
|
#endif
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
- printk(KERN_ERR "module %s: Unknown rela relocation: %Lu\n",
|
|
|
|
|
|
+ printk(KERN_ERR "module %s: Unknown rela relocation: %llu\n",
|
|
me->name, ELF64_R_TYPE(rel[i].r_info));
|
|
me->name, ELF64_R_TYPE(rel[i].r_info));
|
|
return -ENOEXEC;
|
|
return -ENOEXEC;
|
|
}
|
|
}
|
|
@@ -130,7 +130,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
overflow:
|
|
overflow:
|
|
- printk(KERN_ERR "overflow in relocation type %d val %Lx\n",
|
|
|
|
|
|
+ printk(KERN_ERR "overflow in relocation type %d val %Lx\n",
|
|
(int)ELF64_R_TYPE(rel[i].r_info), val);
|
|
(int)ELF64_R_TYPE(rel[i].r_info), val);
|
|
printk(KERN_ERR "`%s' likely not compiled with -mcmodel=kernel\n",
|
|
printk(KERN_ERR "`%s' likely not compiled with -mcmodel=kernel\n",
|
|
me->name);
|
|
me->name);
|
|
@@ -143,13 +143,13 @@ int apply_relocate(Elf_Shdr *sechdrs,
|
|
unsigned int relsec,
|
|
unsigned int relsec,
|
|
struct module *me)
|
|
struct module *me)
|
|
{
|
|
{
|
|
- printk("non add relocation not supported\n");
|
|
|
|
|
|
+ printk(KERN_ERR "non add relocation not supported\n");
|
|
return -ENOSYS;
|
|
return -ENOSYS;
|
|
-}
|
|
|
|
|
|
+}
|
|
|
|
|
|
int module_finalize(const Elf_Ehdr *hdr,
|
|
int module_finalize(const Elf_Ehdr *hdr,
|
|
- const Elf_Shdr *sechdrs,
|
|
|
|
- struct module *me)
|
|
|
|
|
|
+ const Elf_Shdr *sechdrs,
|
|
|
|
+ struct module *me)
|
|
{
|
|
{
|
|
const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL,
|
|
const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL,
|
|
*para = NULL;
|
|
*para = NULL;
|
|
@@ -161,7 +161,7 @@ int module_finalize(const Elf_Ehdr *hdr,
|
|
if (!strcmp(".altinstructions", secstrings + s->sh_name))
|
|
if (!strcmp(".altinstructions", secstrings + s->sh_name))
|
|
alt = s;
|
|
alt = s;
|
|
if (!strcmp(".smp_locks", secstrings + s->sh_name))
|
|
if (!strcmp(".smp_locks", secstrings + s->sh_name))
|
|
- locks= s;
|
|
|
|
|
|
+ locks = s;
|
|
if (!strcmp(".parainstructions", secstrings + s->sh_name))
|
|
if (!strcmp(".parainstructions", secstrings + s->sh_name))
|
|
para = s;
|
|
para = s;
|
|
}
|
|
}
|