2009-07-01 Pavel Roskin <proski@gnu.org>
* include/grub/elf.h: Define Elf_Sword and Elf_Xword. * kern/i386/dl.c: Use ELF symbols without "32" or "64". * kern/powerpc/dl.c: Likewise. * kern/sparc64/dl.c: Likewise. * kern/x86_64/dl.c: Likewise.
This commit is contained in:
parent
3f7f0cd003
commit
3262295617
6 changed files with 76 additions and 64 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2009-07-01 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* include/grub/elf.h: Define Elf_Sword and Elf_Xword.
|
||||||
|
* kern/i386/dl.c: Use ELF symbols without "32" or "64".
|
||||||
|
* kern/powerpc/dl.c: Likewise.
|
||||||
|
* kern/sparc64/dl.c: Likewise.
|
||||||
|
* kern/x86_64/dl.c: Likewise.
|
||||||
|
|
||||||
2009-07-01 Robert Millan <rmh.grub@aybabtu.com>
|
2009-07-01 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
Fix grub-emu build on sparc64-ieee1275.
|
Fix grub-emu build on sparc64-ieee1275.
|
||||||
|
|
|
@ -2340,8 +2340,10 @@ typedef Elf32_Rel Elf_Rel;
|
||||||
typedef Elf32_Rela Elf_Rela;
|
typedef Elf32_Rela Elf_Rela;
|
||||||
typedef Elf32_Section Elf_Section;
|
typedef Elf32_Section Elf_Section;
|
||||||
typedef Elf32_Shdr Elf_Shdr;
|
typedef Elf32_Shdr Elf_Shdr;
|
||||||
|
typedef Elf32_Sword Elf_Sword;
|
||||||
typedef Elf32_Sym Elf_Sym;
|
typedef Elf32_Sym Elf_Sym;
|
||||||
typedef Elf32_Word Elf_Word;
|
typedef Elf32_Word Elf_Word;
|
||||||
|
typedef Elf32_Xword Elf_Xword;
|
||||||
|
|
||||||
#define ELF_ST_BIND(val) ELF32_ST_BIND(val)
|
#define ELF_ST_BIND(val) ELF32_ST_BIND(val)
|
||||||
#define ELF_ST_TYPE(val) ELF32_ST_TYPE(val)
|
#define ELF_ST_TYPE(val) ELF32_ST_TYPE(val)
|
||||||
|
@ -2359,8 +2361,10 @@ typedef Elf64_Rel Elf_Rel;
|
||||||
typedef Elf64_Rela Elf_Rela;
|
typedef Elf64_Rela Elf_Rela;
|
||||||
typedef Elf64_Section Elf_Section;
|
typedef Elf64_Section Elf_Section;
|
||||||
typedef Elf64_Shdr Elf_Shdr;
|
typedef Elf64_Shdr Elf_Shdr;
|
||||||
|
typedef Elf64_Sword Elf_Sword;
|
||||||
typedef Elf64_Sym Elf_Sym;
|
typedef Elf64_Sym Elf_Sym;
|
||||||
typedef Elf64_Word Elf_Word;
|
typedef Elf64_Word Elf_Word;
|
||||||
|
typedef Elf64_Xword Elf_Xword;
|
||||||
|
|
||||||
#define ELF_ST_BIND(val) ELF64_ST_BIND (val)
|
#define ELF_ST_BIND(val) ELF64_ST_BIND (val)
|
||||||
#define ELF_ST_TYPE(val) ELF64_ST_TYPE (val)
|
#define ELF_ST_TYPE(val) ELF64_ST_TYPE (val)
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_check_header (void *ehdr)
|
grub_arch_dl_check_header (void *ehdr)
|
||||||
{
|
{
|
||||||
Elf32_Ehdr *e = ehdr;
|
Elf_Ehdr *e = ehdr;
|
||||||
|
|
||||||
/* Check the magic numbers. */
|
/* Check the magic numbers. */
|
||||||
if (e->e_ident[EI_CLASS] != ELFCLASS32
|
if (e->e_ident[EI_CLASS] != ELFCLASS32
|
||||||
|
@ -41,15 +41,15 @@ grub_arch_dl_check_header (void *ehdr)
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
{
|
{
|
||||||
Elf32_Ehdr *e = ehdr;
|
Elf_Ehdr *e = ehdr;
|
||||||
Elf32_Shdr *s;
|
Elf_Shdr *s;
|
||||||
Elf32_Word entsize;
|
Elf_Word entsize;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
/* Find a symbol table. */
|
/* Find a symbol table. */
|
||||||
for (i = 0, s = (Elf32_Shdr *) ((char *) e + e->e_shoff);
|
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||||
i < e->e_shnum;
|
i < e->e_shnum;
|
||||||
i++, s = (Elf32_Shdr *) ((char *) s + e->e_shentsize))
|
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
if (s->sh_type == SHT_SYMTAB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
entsize = s->sh_entsize;
|
||||||
|
|
||||||
for (i = 0, s = (Elf32_Shdr *) ((char *) e + e->e_shoff);
|
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||||
i < e->e_shnum;
|
i < e->e_shnum;
|
||||||
i++, s = (Elf32_Shdr *) ((char *) s + e->e_shentsize))
|
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||||
if (s->sh_type == SHT_REL)
|
if (s->sh_type == SHT_REL)
|
||||||
{
|
{
|
||||||
grub_dl_segment_t seg;
|
grub_dl_segment_t seg;
|
||||||
|
@ -72,32 +72,32 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
|
|
||||||
if (seg)
|
if (seg)
|
||||||
{
|
{
|
||||||
Elf32_Rel *rel, *max;
|
Elf_Rel *rel, *max;
|
||||||
|
|
||||||
for (rel = (Elf32_Rel *) ((char *) e + s->sh_offset),
|
for (rel = (Elf_Rel *) ((char *) e + s->sh_offset),
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
max = rel + s->sh_size / s->sh_entsize;
|
||||||
rel < max;
|
rel < max;
|
||||||
rel++)
|
rel++)
|
||||||
{
|
{
|
||||||
Elf32_Word *addr;
|
Elf_Word *addr;
|
||||||
Elf32_Sym *sym;
|
Elf_Sym *sym;
|
||||||
|
|
||||||
if (seg->size < rel->r_offset)
|
if (seg->size < rel->r_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
"reloc offset is out of the segment");
|
"reloc offset is out of the segment");
|
||||||
|
|
||||||
addr = (Elf32_Word *) ((char *) seg->addr + rel->r_offset);
|
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
||||||
sym = (Elf32_Sym *) ((char *) mod->symtab
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
+ entsize * ELF32_R_SYM (rel->r_info));
|
+ entsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
switch (ELF32_R_TYPE (rel->r_info))
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
{
|
{
|
||||||
case R_386_32:
|
case R_386_32:
|
||||||
*addr += sym->st_value;
|
*addr += sym->st_value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R_386_PC32:
|
case R_386_PC32:
|
||||||
*addr += (sym->st_value - (Elf32_Word) seg->addr
|
*addr += (sym->st_value - (Elf_Word) seg->addr
|
||||||
- rel->r_offset);
|
- rel->r_offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_check_header (void *ehdr)
|
grub_arch_dl_check_header (void *ehdr)
|
||||||
{
|
{
|
||||||
Elf32_Ehdr *e = ehdr;
|
Elf_Ehdr *e = ehdr;
|
||||||
|
|
||||||
/* Check the magic numbers. */
|
/* Check the magic numbers. */
|
||||||
if (e->e_ident[EI_CLASS] != ELFCLASS32
|
if (e->e_ident[EI_CLASS] != ELFCLASS32
|
||||||
|
@ -42,15 +42,15 @@ grub_arch_dl_check_header (void *ehdr)
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
{
|
{
|
||||||
Elf32_Ehdr *e = ehdr;
|
Elf_Ehdr *e = ehdr;
|
||||||
Elf32_Shdr *s;
|
Elf_Shdr *s;
|
||||||
Elf32_Word entsize;
|
Elf_Word entsize;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
/* Find a symbol table. */
|
/* Find a symbol table. */
|
||||||
for (i = 0, s = (Elf32_Shdr *) ((char *) e + e->e_shoff);
|
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||||
i < e->e_shnum;
|
i < e->e_shnum;
|
||||||
i++, s = (Elf32_Shdr *) ((char *) s + e->e_shentsize))
|
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
if (s->sh_type == SHT_SYMTAB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
entsize = s->sh_entsize;
|
||||||
|
|
||||||
for (i = 0, s = (Elf32_Shdr *) ((char *) e + e->e_shoff);
|
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||||
i < e->e_shnum;
|
i < e->e_shnum;
|
||||||
i++, s = (Elf32_Shdr *) ((char *) s + e->e_shentsize))
|
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||||
if (s->sh_type == SHT_RELA)
|
if (s->sh_type == SHT_RELA)
|
||||||
{
|
{
|
||||||
grub_dl_segment_t seg;
|
grub_dl_segment_t seg;
|
||||||
|
@ -73,37 +73,37 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
|
|
||||||
if (seg)
|
if (seg)
|
||||||
{
|
{
|
||||||
Elf32_Rela *rel, *max;
|
Elf_Rela *rel, *max;
|
||||||
|
|
||||||
for (rel = (Elf32_Rela *) ((char *) e + s->sh_offset),
|
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
max = rel + s->sh_size / s->sh_entsize;
|
||||||
rel < max;
|
rel < max;
|
||||||
rel++)
|
rel++)
|
||||||
{
|
{
|
||||||
Elf32_Word *addr;
|
Elf_Word *addr;
|
||||||
Elf32_Sym *sym;
|
Elf_Sym *sym;
|
||||||
grub_uint32_t value;
|
grub_uint32_t value;
|
||||||
|
|
||||||
if (seg->size < rel->r_offset)
|
if (seg->size < rel->r_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
"reloc offset is out of the segment");
|
"reloc offset is out of the segment");
|
||||||
|
|
||||||
addr = (Elf32_Word *) ((char *) seg->addr + rel->r_offset);
|
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
||||||
sym = (Elf32_Sym *) ((char *) mod->symtab
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
+ entsize * ELF32_R_SYM (rel->r_info));
|
+ entsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
/* On the PPC the value does not have an explicit
|
/* On the PPC the value does not have an explicit
|
||||||
addend, add it. */
|
addend, add it. */
|
||||||
value = sym->st_value + rel->r_addend;
|
value = sym->st_value + rel->r_addend;
|
||||||
switch (ELF32_R_TYPE (rel->r_info))
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
{
|
{
|
||||||
case R_PPC_ADDR16_LO:
|
case R_PPC_ADDR16_LO:
|
||||||
*(Elf32_Half *) addr = value;
|
*(Elf_Half *) addr = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R_PPC_REL24:
|
case R_PPC_REL24:
|
||||||
{
|
{
|
||||||
Elf32_Sword delta = value - (Elf32_Word) addr;
|
Elf_Sword delta = value - (Elf_Word) addr;
|
||||||
|
|
||||||
if (delta << 6 >> 6 != delta)
|
if (delta << 6 >> 6 != delta)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, "Relocation overflow");
|
return grub_error (GRUB_ERR_BAD_MODULE, "Relocation overflow");
|
||||||
|
@ -112,7 +112,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
}
|
}
|
||||||
|
|
||||||
case R_PPC_ADDR16_HA:
|
case R_PPC_ADDR16_HA:
|
||||||
*(Elf32_Half *) addr = (value + 0x8000) >> 16;
|
*(Elf_Half *) addr = (value + 0x8000) >> 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R_PPC_ADDR32:
|
case R_PPC_ADDR32:
|
||||||
|
@ -120,13 +120,13 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R_PPC_REL32:
|
case R_PPC_REL32:
|
||||||
*addr = value - (Elf32_Word) addr;
|
*addr = value - (Elf_Word) addr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
"This relocation (%d) is not implemented yet",
|
"This relocation (%d) is not implemented yet",
|
||||||
ELF32_R_TYPE (rel->r_info));
|
ELF_R_TYPE (rel->r_info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_check_header (void *ehdr)
|
grub_arch_dl_check_header (void *ehdr)
|
||||||
{
|
{
|
||||||
Elf64_Ehdr *e = ehdr;
|
Elf_Ehdr *e = ehdr;
|
||||||
|
|
||||||
/* Check the magic numbers. */
|
/* Check the magic numbers. */
|
||||||
if (e->e_ident[EI_CLASS] != ELFCLASS64
|
if (e->e_ident[EI_CLASS] != ELFCLASS64
|
||||||
|
@ -42,15 +42,15 @@ grub_arch_dl_check_header (void *ehdr)
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
{
|
{
|
||||||
Elf64_Ehdr *e = ehdr;
|
Elf_Ehdr *e = ehdr;
|
||||||
Elf64_Shdr *s;
|
Elf_Shdr *s;
|
||||||
Elf64_Word entsize;
|
Elf_Word entsize;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
/* Find a symbol table. */
|
/* Find a symbol table. */
|
||||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + e->e_shoff);
|
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||||
i < e->e_shnum;
|
i < e->e_shnum;
|
||||||
i++, s = (Elf64_Shdr *) ((char *) s + e->e_shentsize))
|
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
if (s->sh_type == SHT_SYMTAB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
entsize = s->sh_entsize;
|
||||||
|
|
||||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + e->e_shoff);
|
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||||
i < e->e_shnum;
|
i < e->e_shnum;
|
||||||
i++, s = (Elf64_Shdr *) ((char *) s + e->e_shentsize))
|
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||||
if (s->sh_type == SHT_RELA)
|
if (s->sh_type == SHT_RELA)
|
||||||
{
|
{
|
||||||
grub_dl_segment_t seg;
|
grub_dl_segment_t seg;
|
||||||
|
@ -73,27 +73,27 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
|
|
||||||
if (seg)
|
if (seg)
|
||||||
{
|
{
|
||||||
Elf64_Rela *rel, *max;
|
Elf_Rela *rel, *max;
|
||||||
|
|
||||||
for (rel = (Elf64_Rela *) ((char *) e + s->sh_offset),
|
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
max = rel + s->sh_size / s->sh_entsize;
|
||||||
rel < max;
|
rel < max;
|
||||||
rel++)
|
rel++)
|
||||||
{
|
{
|
||||||
Elf64_Word *addr;
|
Elf_Word *addr;
|
||||||
Elf64_Sym *sym;
|
Elf_Sym *sym;
|
||||||
Elf64_Addr value;
|
Elf_Addr value;
|
||||||
|
|
||||||
if (seg->size < rel->r_offset)
|
if (seg->size < rel->r_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
"reloc offset is out of the segment");
|
"reloc offset is out of the segment");
|
||||||
|
|
||||||
addr = (Elf64_Word *) ((char *) seg->addr + rel->r_offset);
|
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
||||||
sym = (Elf64_Sym *) ((char *) mod->symtab
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
+ entsize * ELF64_R_SYM (rel->r_info));
|
+ entsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
value = sym->st_value + rel->r_addend;
|
value = sym->st_value + rel->r_addend;
|
||||||
switch (ELF64_R_TYPE (rel->r_info) & 0xff)
|
switch (ELF_R_TYPE (rel->r_info) & 0xff)
|
||||||
{
|
{
|
||||||
case R_SPARC_32: /* 3 V-word32 */
|
case R_SPARC_32: /* 3 V-word32 */
|
||||||
if (value & 0xFFFFFFFF00000000)
|
if (value & 0xFFFFFFFF00000000)
|
||||||
|
@ -102,13 +102,13 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
*addr = value;
|
*addr = value;
|
||||||
break;
|
break;
|
||||||
case R_SPARC_WDISP30: /* 7 V-disp30 */
|
case R_SPARC_WDISP30: /* 7 V-disp30 */
|
||||||
if (((value - (Elf64_Addr) addr) & 0xFFFFFFFF00000000) &&
|
if (((value - (Elf_Addr) addr) & 0xFFFFFFFF00000000) &&
|
||||||
(((value - (Elf64_Addr) addr) & 0xFFFFFFFF00000000)
|
(((value - (Elf_Addr) addr) & 0xFFFFFFFF00000000)
|
||||||
!= 0xFFFFFFFF00000000))
|
!= 0xFFFFFFFF00000000))
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
"Displacement out of 30 bits range");
|
"Displacement out of 30 bits range");
|
||||||
*addr = (*addr & 0xC0000000) |
|
*addr = (*addr & 0xC0000000) |
|
||||||
(((grub_int32_t) ((value - (Elf64_Addr) addr) >> 2)) &
|
(((grub_int32_t) ((value - (Elf_Addr) addr) >> 2)) &
|
||||||
0x3FFFFFFF);
|
0x3FFFFFFF);
|
||||||
break;
|
break;
|
||||||
case R_SPARC_HI22: /* 9 V-imm22 */
|
case R_SPARC_HI22: /* 9 V-imm22 */
|
||||||
|
@ -121,18 +121,18 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
*addr = (*addr & 0xFFFFFC00) | (value & 0x3FF);
|
*addr = (*addr & 0xFFFFFC00) | (value & 0x3FF);
|
||||||
break;
|
break;
|
||||||
case R_SPARC_64: /* 32 V-xwords64 */
|
case R_SPARC_64: /* 32 V-xwords64 */
|
||||||
*(Elf64_Xword *) addr = value;
|
*(Elf_Xword *) addr = value;
|
||||||
break;
|
break;
|
||||||
case R_SPARC_OLO10:
|
case R_SPARC_OLO10:
|
||||||
*addr = (*addr & ~0x1fff)
|
*addr = (*addr & ~0x1fff)
|
||||||
| (((value & 0x3ff) +
|
| (((value & 0x3ff) +
|
||||||
(ELF64_R_TYPE (rel->r_info) >> 8))
|
(ELF_R_TYPE (rel->r_info) >> 8))
|
||||||
& 0x1fff);
|
& 0x1fff);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
"This relocation (%d) is not implemented yet",
|
"This relocation (%d) is not implemented yet",
|
||||||
ELF64_R_TYPE (rel->r_info));
|
ELF_R_TYPE (rel->r_info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,9 +90,9 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
addr32 = (Elf64_Word *) ((char *) seg->addr + rel->r_offset);
|
addr32 = (Elf64_Word *) ((char *) seg->addr + rel->r_offset);
|
||||||
addr64 = (Elf64_Xword *) addr32;
|
addr64 = (Elf64_Xword *) addr32;
|
||||||
sym = (Elf64_Sym *) ((char *) mod->symtab
|
sym = (Elf64_Sym *) ((char *) mod->symtab
|
||||||
+ entsize * ELF64_R_SYM (rel->r_info));
|
+ entsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
switch (ELF64_R_TYPE (rel->r_info))
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
{
|
{
|
||||||
case R_X86_64_64:
|
case R_X86_64_64:
|
||||||
*addr64 += rel->r_addend + sym->st_value;
|
*addr64 += rel->r_addend + sym->st_value;
|
||||||
|
@ -109,7 +109,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
grub_fatal ("Unrecognized relocation: %d\n", ELF64_R_TYPE (rel->r_info));
|
grub_fatal ("Unrecognized relocation: %d\n", ELF_R_TYPE (rel->r_info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue