Yesterday, I needed to patch CUBIN inside object file, and my fb failed to do it. Let's check why:
file bobhash32.o
bobhash32.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
readelf -S bobhash32.oAs you can see we have section .nvFatBinSegment but section with CUBINs has name __nv_relfatbin instead of usual .nv_fatbin. Beside we also have relocs for .nvFatBinSegment:
[ 8] __nv_relfatbin PROGBITS 0000000000000000 00000720
0000000000005f18 0000000000000000 A 0 0 8
[ 9] .nvFatBinSegment PROGBITS 0000000000000000 00006638
0000000000000018 0000000000000000 WA 0 0 8
[10] .rela.nvFatBinSeg RELA 0000000000000000 000070d8
0000000000000018 0000000000000018 I 18 9 8
readelf -r bobhash32.o
Relocation section '.rela.nvFatBinSegment' at offset 0x70d8 contains 1 entry:Offset 8 is field data and in object file it zeroed, but 64bit reloc points to section __nv_relfatbin with addend 0
Offset Info Type Sym. Value Sym. Name + Addend
000000000008 001000000001 R_X86_64_64 0000000000000000 __nv_relfatbin + 0
So I added some very limited support of object files - currently only for x86-64 and single reloc type R_X86_64_64. And magically it works now
Комментариев нет:
Отправить комментарий