X86_64: We use RELA not REL
Weird huh? GNU ld uses RELA but no addends, as soon as you get an addend from LLD, this code breaks Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
This commit is contained in:
parent
9c953ddf27
commit
2765122e67
@ -45,14 +45,14 @@ EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn,
|
||||
EFI_SYSTEM_TABLE *systab EFI_UNUSED)
|
||||
{
|
||||
long relsz = 0, relent = 0;
|
||||
Elf64_Rel *rel = 0;
|
||||
Elf64_Rela *rel = 0;
|
||||
unsigned long *addr;
|
||||
int i;
|
||||
|
||||
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
|
||||
switch (dyn[i].d_tag) {
|
||||
case DT_RELA:
|
||||
rel = (Elf64_Rel*)
|
||||
rel = (Elf64_Rela*)
|
||||
((unsigned long)dyn[i].d_un.d_ptr
|
||||
+ ldbase);
|
||||
break;
|
||||
@ -85,13 +85,13 @@ EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn,
|
||||
case R_X86_64_RELATIVE:
|
||||
addr = (unsigned long *)
|
||||
(ldbase + rel->r_offset);
|
||||
*addr += ldbase;
|
||||
*addr = ldbase + rel->r_addend;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
rel = (Elf64_Rel*) ((char *) rel + relent);
|
||||
rel = (Elf64_Rela*) ((char *) rel + relent);
|
||||
relsz -= relent;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
|
Loading…
Reference in New Issue
Block a user