From c2cdde70b367924b040634a912066206bb0268f5 Mon Sep 17 00:00:00 2001 From: davem Date: Tue, 7 Apr 2009 23:48:28 +0000 Subject: [PATCH] * kern/sparc64/dl.c (grub_arch_dl_relocate_symbols): Add support for R_SPARC_OLO10 relocations. Fix compile warning for R_SPARC_WDISP30 case. --- ChangeLog | 6 ++++++ kern/sparc64/dl.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff629413c..c7e854ede 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-04-07 David S. Miller + + * kern/sparc64/dl.c (grub_arch_dl_relocate_symbols): Add + support for R_SPARC_OLO10 relocations. Fix compile warning for + R_SPARC_WDISP30 case. + 2009-04-06 Pavel Roskin * include/grub/misc.h (ARRAY_SIZE): New macro. diff --git a/kern/sparc64/dl.c b/kern/sparc64/dl.c index 28ea35279..29b8c8a9a 100644 --- a/kern/sparc64/dl.c +++ b/kern/sparc64/dl.c @@ -95,7 +95,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) + entsize * ELF64_R_SYM (rel->r_info)); value = sym->st_value + rel->r_addend; - switch (ELF64_R_TYPE (rel->r_info)) + switch (ELF64_R_TYPE (rel->r_info) & 0xff) { case R_SPARC_32: /* 3 V-word32 */ if (value & 0xFFFFFFFF00000000) @@ -105,8 +105,8 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) break; case R_SPARC_WDISP30: /* 7 V-disp30 */ if (((value - (Elf64_Addr) addr) & 0xFFFFFFFF00000000) && - ((value - (Elf64_Addr) addr) & 0xFFFFFFFF00000000 - != 0xFFFFFFFF00000000)) + (((value - (Elf64_Addr) addr) & 0xFFFFFFFF00000000) + != 0xFFFFFFFF00000000)) return grub_error (GRUB_ERR_BAD_MODULE, "Displacement out of 30 bits range"); *addr = (*addr & 0xC0000000) | @@ -125,6 +125,12 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) case R_SPARC_64: /* 32 V-xwords64 */ *(Elf64_Xword *) addr = value; break; + case R_SPARC_OLO10: + *addr = (*addr & ~0x1fff) + | (((value & 0x3ff) + + (ELF64_R_TYPE (rel->r_info) >> 8)) + & 0x1fff); + break; default: return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "This relocation (%d) is not implemented yet",