Community
Participate
Working Groups
Hi, The new llvm compiler generate R_X86_64_32S type relocation information which couldn't be handled by current TCF open source code, so please help to add the support of R_X86_64_32S in elf_relocate() (/agent/machine/x86_64/tcf/dwarfreloc-mdep.h). The R_X86_64_32S type relocation information is as below: readelf -r dkm_itl.out | grep R_X86_64_32S : 00000000000c 001e0000000b R_X86_64_32S 00000000000000e8 __init_array_start + 0 000000000017 001d0000000b R_X86_64_32S 00000000000000e8 __init_array_end + 0 000000000062 001b0000000b R_X86_64_32S 00000000000000e8 __fini_array_end + 0 000000000071 001c0000000b R_X86_64_32S 00000000000000e8 __fini_array_start + 0 0000000000bb 00010000000b R_X86_64_32S 0000000000000000 .text + d3 Thanks
Created attachment 276177 [details] The ELF of test case
Our PPC64 also use R_PPC64_REL32 relocation type, which isn't supported by ageng/machine/ppc64/tcf/dwarfreloc-mdep.h readelf -r dkmppc.out | grep R_PPC64_REL32 00000000001c 00010000001a R_PPC64_REL32 0000000000000000 .text + 0 00000000003c 00010000001a R_PPC64_REL32 0000000000000000 .text + 8c 000000000074 00010000001a R_PPC64_REL32 0000000000000000 .text + 118
The patch below works for me diff --git a/agent/machine/x86_64/tcf/dwarfreloc-mdep.h b/agent/machine/x86_64/tcf/dwarfreloc-mdep.h index 4f09257f..ac50a7e3 100644 --- a/agent/machine/x86_64/tcf/dwarfreloc-mdep.h +++ b/agent/machine/x86_64/tcf/dwarfreloc-mdep.h @@ -21,6 +21,7 @@ #define R_X86_64_64 1 #define R_X86_64_PC32 2 #define R_X86_64_32 10 +#define R_X86_64_32S 11 static void elf_relocate(void) { if (relocs->type == SHT_REL && reloc_type != R_X86_64_NONE) { @@ -48,6 +49,7 @@ static void elf_relocate(void) { *destination_section = NULL; break; case R_X86_64_32: + case R_X86_64_32S: if (data_size < 4) str_exception(ERR_INV_FORMAT, "Invalid relocation record"); *(U4_T *)data_buf = (U4_T)(sym_value + reloc_addend); break;
Fixed. Thanks!