about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-25 10:26:48 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-25 10:26:48 +0100
commit89e305878b683ee1ec5bd3cc60e94477fb9961a4 (patch)
treec64eda5c7707709b6eb54b965aea9fba8c4d9658 /src
parent45873cc2b191b9a615b29b128749bb137f99c7f7 (diff)
downloadbox64-89e305878b683ee1ec5bd3cc60e94477fb9961a4.tar.gz
box64-89e305878b683ee1ec5bd3cc60e94477fb9961a4.zip
Fixed R_X86_64_64 handling is elfloader
Diffstat (limited to 'src')
-rwxr-xr-xsrc/elfs/elfloader.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c
index f821fd4b..52aab63e 100755
--- a/src/elfs/elfloader.c
+++ b/src/elfs/elfloader.c
@@ -623,14 +623,16 @@ int RelocateElfRELA(lib_t *maplib, lib_t *local_maplib, elfheader_t* head, int c
     //                    return -1;
                     } else {
                         if(p) {
-                            printf_log(LOG_DUMP, "Apply %s R_X86_64_JUMP_SLOT @%p with sym=%s (%p -> %p)\n", (bind==STB_LOCAL)?"Local":"Global", p, symname, *(void**)p, (void*)(offs+rela[i].r_addend));
+                            printf_log(LOG_DUMP, "Apply %s R_X86_64_JUMP_SLOT @%p with sym=%s (%p -> %p)\n", 
+                                (bind==STB_LOCAL)?"Local":"Global", p, symname, *(void**)p, (void*)(offs+rela[i].r_addend));
                             *p = offs + rela[i].r_addend;
                         } else {
                             printf_log(LOG_NONE, "Warning, Symbol %s found, but Jump Slot Offset is NULL \n", symname);
                         }
                     }
                 } else {
-                    printf_log(LOG_DUMP, "Preparing (if needed) %s R_X86_64_JUMP_SLOT @%p (0x%lx->0x%0lx) with sym=%s to be apply later (addend=%ld)\n", (bind==STB_LOCAL)?"Local":"Global", p, *p, *p+head->delta, symname, rela[i].r_addend);
+                    printf_log(LOG_DUMP, "Preparing (if needed) %s R_X86_64_JUMP_SLOT @%p (0x%lx->0x%0lx) with sym=%s to be apply later (addend=%ld)\n", 
+                        (bind==STB_LOCAL)?"Local":"Global", p, *p, *p+head->delta, symname, rela[i].r_addend);
                     *p += head->delta;
                 }
                 break;
@@ -639,8 +641,9 @@ int RelocateElfRELA(lib_t *maplib, lib_t *local_maplib, elfheader_t* head, int c
                     printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply R_X86_64_64 @%p (%p) in %s\n", symname, p, *(void**)p, head->name);
 //                    return -1;
                 } else {
-                    printf_log(LOG_DUMP, "Apply %s R_X86_64_64 @%p with sym=%s addend=0x%lx (%p -> %p)\n", (bind==STB_LOCAL)?"Local":"Global", p, symname, rela[i].r_addend, *(void**)p, (void*)(offs+rela[i].r_addend+*(uint64_t*)p));
-                    *p += offs+rela[i].r_addend;
+                    printf_log(LOG_DUMP, "Apply %s R_X86_64_64 @%p with sym=%s addend=0x%lx (%p -> %p)\n", 
+                        (bind==STB_LOCAL)?"Local":"Global", p, symname, rela[i].r_addend, *(void**)p, (void*)(offs+rela[i].r_addend/*+*(uint64_t*)p*/));
+                    *p /*+*/= offs+rela[i].r_addend;
                 }
                 break;
             case R_X86_64_DTPMOD64: