Handle X86_64_PC64 relocation.

Those are generated by some cygwin compilers.
This commit is contained in:
Vladimir Serbinenko 2013-12-16 14:24:19 +01:00
parent 252a289cb3
commit f4171ebd34
4 changed files with 26 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2013-12-16 Vladimir Serbinenko <phcoder@gmail.com>
Handle X86_64_PC64 relocation.
Those are generated by some cygwin compilers.
2013-12-16 Vladimir Serbinenko <phcoder@gmail.com>
Determine the need for mingw-related stubs at compile time rather than

View file

@ -80,6 +80,13 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
}
break;
case R_X86_64_PC64:
{
*addr64 += rel->r_addend + sym->st_value -
(Elf64_Xword) seg->addr - rel->r_offset;
}
break;
case R_X86_64_32:
{
grub_uint64_t value = *addr32 + rel->r_addend + sym->st_value;

View file

@ -1132,6 +1132,7 @@ typedef struct
#define R_X86_64_PC16 13
#define R_X86_64_8 14
#define R_X86_64_PC8 15
#define R_X86_64_PC64 24
/* Legal values for ST_TYPE subfield of st_info (symbol type). */

View file

@ -709,6 +709,18 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
break;
}
case R_X86_64_PC64:
{
*target = grub_host_to_target64 (grub_target_to_host64 (*target)
+ addend + sym_addr
- target_section_addr - offset
- image_target->vaddr_offset);
grub_util_info ("relocating an R_X86_64_PC64 entry to 0x%llx at the offset 0x%llx",
(unsigned long long) *target,
(unsigned long long) offset);
break;
}
case R_X86_64_32:
case R_X86_64_32S:
{