* grub-core/kern/ia64/dl_helper.c (grub_ia64_dl_get_tramp_got_size):
Fix potential usage of Elf32 instead of Elf64 when compiling on 32-bit architecture. Add endianness macros while on it.
This commit is contained in:
parent
4959e11109
commit
543a8f6ef9
2 changed files with 22 additions and 16 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/ia64/dl_helper.c (grub_ia64_dl_get_tramp_got_size):
|
||||||
|
Fix potential usage of Elf32 instead of Elf64 when compiling on
|
||||||
|
32-bit architecture. Add endianness macros while on it.
|
||||||
|
|
||||||
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
2011-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Use mipsel- rather than mips- in directories involving mipsel ports to
|
Use mipsel- rather than mips- in directories involving mipsel ports to
|
||||||
|
|
|
@ -27,35 +27,35 @@ void
|
||||||
grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||||
grub_size_t *got)
|
grub_size_t *got)
|
||||||
{
|
{
|
||||||
const Elf_Ehdr *e = ehdr;
|
const Elf64_Ehdr *e = ehdr;
|
||||||
grub_size_t cntt = 0, cntg = 0;;
|
grub_size_t cntt = 0, cntg = 0;;
|
||||||
const Elf_Shdr *s;
|
const Elf64_Shdr *s;
|
||||||
Elf_Word entsize;
|
Elf64_Word entsize;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
/* Find a symbol table. */
|
/* Find a symbol table. */
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu32 (e->e_shoff));
|
||||||
i < e->e_shnum;
|
i < grub_le_to_cpu16 (e->e_shnum);
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize)))
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
if (grub_le_to_cpu32 (s->sh_type) == SHT_SYMTAB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (i == e->e_shnum)
|
if (i == grub_le_to_cpu16 (e->e_shnum))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
entsize = s->sh_entsize;
|
||||||
|
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu32 (e->e_shoff));
|
||||||
i < e->e_shnum;
|
i < grub_le_to_cpu16 (e->e_shnum);
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize)))
|
||||||
if (s->sh_type == SHT_RELA)
|
if (grub_le_to_cpu32 (s->sh_type) == SHT_RELA)
|
||||||
{
|
{
|
||||||
Elf_Rela *rel, *max;
|
Elf64_Rela *rel, *max;
|
||||||
|
|
||||||
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
|
for (rel = (Elf64_Rela *) ((char *) e + grub_le_to_cpu32 (s->sh_offset)),
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
max = rel + grub_le_to_cpu32 (s->sh_size) / grub_le_to_cpu16 (s->sh_entsize);
|
||||||
rel < max; rel++)
|
rel < max; rel++)
|
||||||
switch (ELF_R_TYPE (rel->r_info))
|
switch (ELF64_R_TYPE (grub_le_to_cpu32 (rel->r_info)))
|
||||||
{
|
{
|
||||||
case R_IA64_PCREL21B:
|
case R_IA64_PCREL21B:
|
||||||
cntt++;
|
cntt++;
|
||||||
|
|
Loading…
Reference in a new issue