Commit b9700b82 authored by David Mosberger's avatar David Mosberger

ia64: More module-loader fixing.

parent 70e1e33a
...@@ -313,10 +313,10 @@ static const struct plt_entry ia64_plt_template = { ...@@ -313,10 +313,10 @@ static const struct plt_entry ia64_plt_template = {
}; };
static int static int
patch_plt (struct plt_entry *plt, unsigned long target_ip, unsigned long target_gp) patch_plt (struct module *mod, struct plt_entry *plt, long target_ip, unsigned long target_gp)
{ {
if (apply_imm64((struct insn *) (plt->bundle[0] + 2), target_ip) if (apply_imm64(mod, (struct insn *) (plt->bundle[0] + 2), target_ip)
&& apply_imm64((struct insn *) (plt->bundle[1] + 2), target_gp)) && apply_imm64(mod, (struct insn *) (plt->bundle[1] + 2), target_gp))
return 1; return 1;
return 0; return 0;
} }
...@@ -837,9 +837,14 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symind ...@@ -837,9 +837,14 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symind
* XXX Should have an arch-hook for running this after final section * XXX Should have an arch-hook for running this after final section
* addresses have been selected... * addresses have been selected...
*/ */
/* See if gp can cover the entire core module: */
uint64_t gp = (uint64_t) mod->module_core + MAX_LTOFF / 2; uint64_t gp = (uint64_t) mod->module_core + MAX_LTOFF / 2;
if ((mod->arch.got->sh_addr + mod->arch.got->sh_size) - gp >= MAX_LTOFF) if (mod->core_size >= MAX_LTOFF)
gp = mod->arch.got->sh_addr + mod->arch.got->sh_size - MAX_LTOFF / 2; /*
* This takes advantage of fact that SHF_ARCH_SMALL gets allocated
* at the end of the module.
*/
gp = (uint64_t) mod->module_core + mod->core_size - MAX_LTOFF / 2;
mod->arch.gp = gp; mod->arch.gp = gp;
DEBUGP("%s: placing gp at 0x%lx\n", __FUNCTION__, gp); DEBUGP("%s: placing gp at 0x%lx\n", __FUNCTION__, gp);
} }
...@@ -860,7 +865,7 @@ int ...@@ -860,7 +865,7 @@ int
apply_relocate (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symindex, apply_relocate (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symindex,
unsigned int relsec, struct module *mod) unsigned int relsec, struct module *mod)
{ {
printk(KERN_ERR "module %s: REL relocs in section %u unsupported\n", relsec, mod->name); printk(KERN_ERR "module %s: REL relocs in section %u unsupported\n", mod->name, relsec);
return -ENOEXEC; return -ENOEXEC;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment