Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Pull sparc updates from David Miller: 1) Debugging builds on 32-bit sparc need to handle the R_SPARC_DISP32 relocation, not just 64-bit sparc. From Andreas Larsson. 2) Wei Yongjun noticed that module_alloc() on sparc can return an error pointer, but that's not allowed. module_alloc() should return only a valid pointer, or NULL. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc: sparc: fix the return value of module_alloc() sparc32: Enable the relocation target R_SPARC_DISP32 for sparc32
This commit is contained in:
commit
6219844e72
1 changed files with 5 additions and 8 deletions
|
@ -48,9 +48,7 @@ void *module_alloc(unsigned long size)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = module_map(size);
|
ret = module_map(size);
|
||||||
if (!ret)
|
if (ret)
|
||||||
ret = ERR_PTR(-ENOMEM);
|
|
||||||
else
|
|
||||||
memset(ret, 0, size);
|
memset(ret, 0, size);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -116,6 +114,10 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
|
||||||
v = sym->st_value + rel[i].r_addend;
|
v = sym->st_value + rel[i].r_addend;
|
||||||
|
|
||||||
switch (ELF_R_TYPE(rel[i].r_info) & 0xff) {
|
switch (ELF_R_TYPE(rel[i].r_info) & 0xff) {
|
||||||
|
case R_SPARC_DISP32:
|
||||||
|
v -= (Elf_Addr) location;
|
||||||
|
*loc32 = v;
|
||||||
|
break;
|
||||||
#ifdef CONFIG_SPARC64
|
#ifdef CONFIG_SPARC64
|
||||||
case R_SPARC_64:
|
case R_SPARC_64:
|
||||||
location[0] = v >> 56;
|
location[0] = v >> 56;
|
||||||
|
@ -128,11 +130,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
|
||||||
location[7] = v >> 0;
|
location[7] = v >> 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R_SPARC_DISP32:
|
|
||||||
v -= (Elf_Addr) location;
|
|
||||||
*loc32 = v;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R_SPARC_WDISP19:
|
case R_SPARC_WDISP19:
|
||||||
v -= (Elf_Addr) location;
|
v -= (Elf_Addr) location;
|
||||||
*loc32 = (*loc32 & ~0x7ffff) |
|
*loc32 = (*loc32 & ~0x7ffff) |
|
||||||
|
|
Loading…
Reference in a new issue