diff --git a/CMakeLists.txt b/CMakeLists.txt index 7662a49..1b50435 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.15) -project(vxBoot VERSION 1.2.2 LANGUAGES C) +project(vxBoot VERSION 1.2.3 LANGUAGES C) include(GenerateG1A) include(GenerateG3A) diff --git a/src/loader/elf/rela.c b/src/loader/elf/rela.c index 0a8fa6b..b2397e8 100644 --- a/src/loader/elf/rela.c +++ b/src/loader/elf/rela.c @@ -93,7 +93,18 @@ static int loader_reloc_section( loc += (uintptr_t)kernel->hardware.ram.physical.kernel_addr; loc |= (uintptr_t)0xa0000000; - val = kernel->elf.sym.tab[ELF32_R_SYM(rela[i].r_info)].st_value; + /* IMPORTANT NOTE: + + We cannot use the real symbols value for patching the binary + because some symbols are completely broken and refer to + something else. Specially when a global use another global + (for example: const char * const text = "vive les g@m3rz"). + + But, after some RE, each time a global symbol is used, its + virtual address is set. So, for now, we just need to add the + relocation offset to the content of the location. */ + //val = kernel->elf.sym.tab[ELF32_R_SYM(rela[i].r_info)].st_value; + val = *(uintptr_t*)loc; switch (table[type].id) { case R_SH_GOT32: