vxBoot - 1.2.3 : Fix relocation
@fix <> CMakelist.txt : dump project version <> loader/elf/rela : fix some broken relocation when a global use another global
This commit is contained in:
parent
735cf1c062
commit
b2d432fcee
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue