x86_64: R_X86_64_PC32 and R_X86_64_DTPOFF32 are 32-bit wide relocations.

Change-Id: I9c4e6c5ae77f4c17c2b6901f2b133db4b9dc48e3
Reviewed-on: https://review.haiku-os.org/445
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Jérôme Duval
2018-08-15 16:16:20 +00:00
committed by waddlesplash
parent fe8b46fb0d
commit ee692b38b2
2 changed files with 10 additions and 4 deletions
+5 -2
View File
@@ -239,7 +239,7 @@ arch_elf_relocate_rela(struct elf_image_info *image,
// Calculate the relocation value.
Elf64_Addr relocValue;
switch(type) {
switch (type) {
case R_X86_64_NONE:
continue;
case R_X86_64_64:
@@ -269,7 +269,10 @@ arch_elf_relocate_rela(struct elf_image_info *image,
return B_BAD_ADDRESS;
}
*(Elf64_Addr *)relocAddr = relocValue;
if (type == R_X86_64_PC32)
*(Elf32_Addr *)relocAddr = relocValue;
else
*(Elf64_Addr *)relocAddr = relocValue;
#endif
}
@@ -43,7 +43,7 @@ relocate_rela(image_t* rootImage, image_t* image, Elf64_Rela* rel,
// Calculate the relocation value.
Elf64_Addr relocValue;
switch(type) {
switch (type) {
case R_X86_64_NONE:
continue;
case R_X86_64_64:
@@ -70,7 +70,10 @@ relocate_rela(image_t* rootImage, image_t* image, Elf64_Rela* rel,
return B_BAD_DATA;
}
*(Elf64_Addr *)relocAddr = relocValue;
if (type == R_X86_64_PC32 || type == R_X86_64_DTPOFF32)
*(Elf32_Addr *)relocAddr = relocValue;
else
*(Elf64_Addr *)relocAddr = relocValue;
}
return B_OK;