-
Hi, I've been experimenting with ELFIO and I have more-or-less trying to read in an ELF and the write out again using a separate instance of // error checking and asserts omitted in the interest of brevity
using Section = ELFIO::section;
using Segment = ELFIO::segment;
void read_write(std::string in, std::string out)
{
ELFIO::elfio reader{};
ELFIO::elfio writer{};
reader.load(in);
writer.create(reader.get_class(), reader.get_encoding());
writer.set_os_abi(reader.get_os_abi());
writer.set_type(reader.get_type());
writer.set_machine(reader.get_machine());
writer.set_abi_version(reader.get_abi_version());
std::vector<std::pair<Section*, Section*>> _sections{};
std::vector<std::pair<Segment*, Segment*>> _segments{};
for(size_t i = 0; i < reader.sections.size(); ++i)
_sections.emplace_back(reader.sections[i],
writer.sections.add(reader.sections[i]->get_name()));
for(size_t i = 0; i < reader.segments.size(); ++i)
_segments.emplace_back(reader.segments[i], writer.segments.add());
for(auto& itr : _sections)
{
auto* _read = itr.first;
auto* _write = itr.second;
_write->set_type(_read->get_type());
_write->set_flags(_read->get_flags());
_write->set_addr_align(_read->get_addr_align());
_write->set_link(_read->get_link());
_write->set_info(_read->get_info());
_write->set_entry_size(_read->get_entry_size());
_write->set_name_string_offset(_read->get_name_string_offset());
_write->set_data(_read->get_data(), _read->get_size());
}
for(auto& itr : _segments)
{
auto* _read = itr.first;
auto* _write = itr.second;
_write->set_type(_read->get_type());
_write->set_flags(_read->get_flags());
_write->set_align(_read->get_align());
for(size_t i = 0; i < _read->get_sections_num(); ++i)
{
Section* _read_sec = reader.sections[_read->get_section_index_at(i)];
auto witr =
std::find_if(writer.sections.begin(), writer.sections.end(),
[_read_sec](const ELFIO::section* _wsec) {
return _wsec->get_name() == _read_sec->get_name();
});
Section* _write_sec = *witr;
_write->add_section(_write_sec, _write_sec->get_addr_align());
}
}
writer.set_entry(reader.get_entry());
writer.save(_out);
} However, the ELF is invalid. Here is a diff of $ readelf -a -W ./exe &> dump.exe && readelf -a -W ./exe.mod &> dump.exe.mod && diff -y -W 200 ./dump.exe ./dump.exe.mod
ELF Header: ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64 Class: ELF64
Data: 2's complement, little endian Data: 2's complement, little endian
Version: 1 (current) Version: 1 (current)
OS/ABI: UNIX - System V OS/ABI: UNIX - System V
ABI Version: 0 ABI Version: 0
Type: EXEC (Executable file) Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64 Machine: Advanced Micro Devices X86-64
Version: 0x1 Version: 0x1
Entry point address: 0x242a10 Entry point address: 0x242a10
Start of program headers: 64 (bytes into file) Start of program headers: 64 (bytes into file)
Start of section headers: 338336 (bytes into file) | Start of section headers: 350396 (bytes into file)
Flags: 0x0 Flags: 0x0
Size of this header: 64 (bytes) Size of this header: 64 (bytes)
Size of program headers: 56 (bytes) Size of program headers: 56 (bytes)
Number of program headers: 11 Number of program headers: 11
Size of section headers: 64 (bytes) Size of section headers: 64 (bytes)
Number of section headers: 36 | Number of section headers: 38
Section header string table index: 34 | Section header string table index: 1
Section Headers: Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al [Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .interp PROGBITS 00000000002002a8 0002a8 00001c 00 A 0 0 1 | [ 1] .shstrtab STRTAB 0000000000000000 045088 00016a 00 0 0 1
[ 2] .note.ABI-tag NOTE 00000000002002c4 0002c4 000020 00 A 0 0 4 | [ 2] NULL 0000000000000000 0451f2 000000 00 0 0 0
[ 3] .dynsym DYNSYM 00000000002002e8 0002e8 000198 18 A 7 1 8 | [ 3] .shstrtab PROGBITS 0000000000000000 001000 00001c 00 A 0 0 1
[ 4] .gnu.version VERSYM 0000000000200480 000480 000022 02 A 3 0 2 | [ 4] b NOTE 000000000000001c 00101c 000020 00 A 0 0 4
[ 5] .gnu.version_r VERNEED 00000000002004a4 0004a4 000040 00 A 7 2 4 | readelf: Warning: [ 5]: Link field (7) should index a string section.
[ 6] .gnu.hash GNU_HASH 00000000002004e8 0004e8 00001c 00 A 3 0 8 | [ 5] te.ABI-tag DYNSYM 0000000000000040 001040 000198 18 A 7 1 8
[ 7] .dynstr STRTAB 0000000000200504 000504 0001d5 00 A 0 0 1 | readelf: Warning: [ 6]: Link field (3) should index a symtab section.
[ 8] .rela.dyn RELA 00000000002006e0 0006e0 000030 18 A 3 0 8 | [ 6] ag VERSYM 00000000000001d8 0011d8 000022 02 A 3 0 2
[ 9] .rela.plt RELA 0000000000200710 000710 000120 18 AI 3 25 8 | readelf: Warning: [ 7]: Link field (7) should index a string section.
[10] .rodata PROGBITS 0000000000200830 000830 000049 00 AMS 0 0 4 | [ 7] nu.version VERNEED 00000000000001fc 0011fc 000040 00 A 7 2 4
[11] .hip_fatbin PROGBITS 0000000000201000 001000 040779 00 A 0 0 4096 | readelf: Warning: [ 8]: Link field (3) should index a symtab section.
[12] .hipFatBinSegment PROGBITS 0000000000241780 041780 000030 00 A 0 0 8 | [ 8] .version_r GNU_HASH 0000000000000240 001240 00001c 00 A 3 0 8
[13] .eh_frame_hdr PROGBITS 00000000002417b0 0417b0 00007c 00 A 0 0 4 | [ 9] STRTAB 000000000000025c 00125c 0001d5 00 A 0 0 1
[14] .eh_frame PROGBITS 0000000000241830 041830 0001d4 00 A 0 0 8 | readelf: Warning: [10]: Link field (3) should index a symtab section.
[15] .text PROGBITS 0000000000242a10 041a10 000522 00 AX 0 0 16 | [10] sh RELA 0000000000000438 001438 000030 18 A 3 0 8
[16] .init PROGBITS 0000000000242f34 041f34 00001b 00 AX 0 0 4 | readelf: Warning: [11]: Link field (3) should index a symtab section.
[17] .fini PROGBITS 0000000000242f50 041f50 00000d 00 AX 0 0 4 | [11] RELA 0000000000000468 001468 000120 18 AI 3 25 8
[18] .plt PROGBITS 0000000000242f60 041f60 0000d0 00 AX 0 0 16 | [12] PROGBITS 0000000000000588 001588 000049 00 AMS 0 0 4
[19] .fini_array FINI_ARRAY 0000000000244030 042030 000008 08 WA 0 0 8 | [13] lt PROGBITS 0000000000001000 002000 040779 00 A 0 0 4096
[20] .init_array INIT_ARRAY 0000000000244038 042038 000018 00 WA 0 0 8 | [14] hip_fatbin PROGBITS 0000000000041780 042780 000030 00 A 0 0 8
[21] .dynamic DYNAMIC 0000000000244050 042050 0001f0 10 WA 7 0 8 | [15] BinSegment PROGBITS 00000000000417b0 0427b0 00007c 00 A 0 0 4
[22] .got PROGBITS 0000000000244240 042240 000010 00 WA 0 0 8 | [16] _frame_hdr PROGBITS 0000000000041830 042830 0001d4 00 A 0 0 8
[23] .data PROGBITS 0000000000245250 042250 000010 00 WA 0 0 8 | [17] PROGBITS 0000000000000000 043000 000522 00 AX 0 0 16
[24] .tm_clone_table PROGBITS 0000000000245260 042260 000000 00 WA 0 0 8 | [18] rame PROGBITS 0000000000000524 043524 00001b 00 AX 0 0 4
[25] .got.plt PROGBITS 0000000000245260 042260 000078 00 WA 0 0 8 | [19] text PROGBITS 0000000000000540 043540 00000d 00 AX 0 0 4
[26] .bss NOBITS 00000000002452d8 0422d8 000018 00 WA 0 0 8 | [20] init PROGBITS 0000000000000550 043550 0000d0 00 AX 0 0 16
[27] .comment PROGBITS 0000000000000000 0422d8 00010b 01 MS 0 0 1 | [21] .fini FINI_ARRAY 0000000000000000 044000 000008 08 WA 0 0 8
[28] .debug_loc PROGBITS 0000000000000000 0423e3 0001a6 00 0 0 1 | [22] fini_array INIT_ARRAY 0000000000000008 044008 000018 00 WA 0 0 8
[29] .debug_abbrev PROGBITS 0000000000000000 042589 000960 00 0 0 1 | readelf: Warning: [23]: Link field (7) should index a string section.
[30] .debug_info PROGBITS 0000000000000000 042ee9 00be2c 00 0 0 1 | [23] init_array DYNAMIC 0000000000000020 044020 0001f0 10 WA 7 0 8
[31] .debug_str PROGBITS 0000000000000000 04ed15 002394 01 MS 0 0 1 | [24] y PROGBITS 0000000000000210 044210 000010 00 WA 0 0 8
[32] .debug_line PROGBITS 0000000000000000 0510a9 000e2e 00 0 0 1 | [25] namic PROGBITS 0000000000000000 045000 000010 00 WA 0 0 8
[33] .symtab SYMTAB 0000000000000000 051ed8 0005a0 18 35 33 8 | [26] .got PROGBITS 0000000000000010 045010 000000 00 WA 0 0 8
[34] .shstrtab STRTAB 0000000000000000 052478 00015f 00 0 0 1 | [27] lone_table PROGBITS 0000000000000010 045010 000078 00 WA 0 0 8
[35] .strtab STRTAB 0000000000000000 0525d7 0003c5 00 0 0 1 | [28] e NOBITS 0000000000000088 045088 000000 00 WA 0 0 8
> [29] t.plt PROGBITS 0000000000000000 0451f2 00010b 01 MS 0 0 1
> [30] s PROGBITS 0000000000000000 0452fd 0001a6 00 0 0 1
> [31] .debug_loc PROGBITS 0000000000000000 0454a3 000960 00 0 0 1
> [32] bug_abbrev PROGBITS 0000000000000000 045e03 00be2c 00 0 0 1
> [33] debug_info PROGBITS 0000000000000000 051c2f 002394 01 MS 0 0 1
> [34] .debug_str PROGBITS 0000000000000000 053fc3 000e2e 00 0 0 1
> readelf: Warning: [35]: Link field (35) should index a string section.
> [35] debug_line SYMTAB 0000000000000000 054df8 0005a0 18 35 33 8
> [36] ne STRTAB 0000000000000000 055398 00015f 00 0 0 1
> [37] STRTAB 0000000000000000 0554f7 0003c5 00 0 0 1
Key to Flags: Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info), W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS), L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude), C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific) l (large), p (processor specific)
There are no section groups in this file. There are no section groups in this file.
Program Headers: Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000040 0x0000000000200040 0x0000000000200040 0x000268 0x000268 R 0x8 | PHDR 0x000040 0x0000000000000000 0x0000000000000000 0x000268 0x000268 R 0x8
INTERP 0x0002a8 0x00000000002002a8 0x00000000002002a8 0x00001c 0x00001c R 0x1 | readelf: Error: the PHDR segment is not covered by a LOAD segment
> INTERP 0x001000 0x0000000000000000 0x0000000000000000 0x00001c 0x00001c R 0x1
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x041a04 0x041a04 R 0x1000 | LOAD 0x001000 0x0000000000000000 0x0000000000000000 0x041a04 0x041a04 R 0x1000
LOAD 0x041a10 0x0000000000242a10 0x0000000000242a10 0x000620 0x000620 R E 0x1000 | LOAD 0x043000 0x0000000000000000 0x0000000000000000 0x000620 0x000620 R E 0x1000
LOAD 0x042030 0x0000000000244030 0x0000000000244030 0x000220 0x000220 RW 0x1000 | LOAD 0x044000 0x0000000000000000 0x0000000000000000 0x000220 0x000220 RW 0x1000
LOAD 0x042250 0x0000000000245250 0x0000000000245250 0x000088 0x0000a0 RW 0x1000 | LOAD 0x045000 0x0000000000000000 0x0000000000000000 0x000088 0x000088 RW 0x1000
DYNAMIC 0x042050 0x0000000000244050 0x0000000000244050 0x0001f0 0x0001f0 RW 0x8 | DYNAMIC 0x044020 0x0000000000000000 0x0000000000000000 0x0001f0 0x0001f0 RW 0x8
GNU_RELRO 0x042030 0x0000000000244030 0x0000000000244030 0x000220 0x000fd0 R 0x1 | readelf: Error: no .dynamic section in the dynamic segment
GNU_EH_FRAME 0x0417b0 0x00000000002417b0 0x00000000002417b0 0x00007c 0x00007c R 0x4 | GNU_RELRO 0x044000 0x0000000000000000 0x0000000000000000 0x000220 0x000220 R 0x8
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 | GNU_EH_FRAME 0x0427b0 0x0000000000000000 0x0000000000000000 0x00007c 0x00007c R 0x4
NOTE 0x0002c4 0x00000000002002c4 0x00000000002002c4 0x000020 0x000020 R 0x4 | GNU_STACK 0x045088 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0
> NOTE 0x00101c 0x0000000000000000 0x0000000000000000 0x000020 0x000020 R 0x4
Section to Segment mapping: Section to Segment mapping:
Segment Sections... Segment Sections...
00 00
01 .interp | 01 .shstrtab
02 .interp .note.ABI-tag .dynsym .gnu.version .gnu.version_r .gnu.hash .dynstr .rela.dyn | 02 .shstrtab b te.ABI-tag ag nu.version .version_r sh lt hip_fatbin BinSegment _frame_
03 .text .init .fini .plt | 03 rame text init e
04 .fini_array .init_array .dynamic .got | 04 .fini fini_array init_array y e
05 .data .tm_clone_table .got.plt .bss | 05 namic .got lone_table
06 .dynamic | 06 e
07 .fini_array .init_array .dynamic .got | 07 .fini fini_array init_array y e
08 .eh_frame_hdr | 08
09 09
10 .note.ABI-tag | 10
> readelf: Warning: Virtual address 0x200504 not located in any PT_LOAD segment.
> readelf: Error: Unable to determine the length of the dynamic string table
Dynamic section at offset 0x42050 contains 31 entries: | Dynamic section at offset 0x44020 contains 31 entries:
Tag Type Name/Value Tag Type Name/Value
0x000000000000001d (RUNPATH) Library runpath: [/opt/rocm/lib:/opt/rocm-4.3.0/hip/lib | 0x000000000000001d (RUNPATH) 0x159
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] | 0x0000000000000001 (NEEDED) 0x193
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] | 0x0000000000000001 (NEEDED) 0x1a1
0x0000000000000001 (NEEDED) Shared library: [libm.so.6] | 0x0000000000000001 (NEEDED) 0x1b1
0x0000000000000001 (NEEDED) Shared library: [librt.so.1] | 0x0000000000000001 (NEEDED) 0x1bb
0x0000000000000001 (NEEDED) Shared library: [libamdhip64.so.4] | 0x0000000000000001 (NEEDED) 0x12a
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6] | 0x0000000000000001 (NEEDED) 0x1c6
0x0000000000000001 (NEEDED) Shared library: [libc.so.6] | 0x0000000000000001 (NEEDED) 0x143
0x0000000000000015 (DEBUG) 0x0 0x0000000000000015 (DEBUG) 0x0
0x0000000000000007 (RELA) 0x2006e0 0x0000000000000007 (RELA) 0x2006e0
0x0000000000000008 (RELASZ) 48 (bytes) 0x0000000000000008 (RELASZ) 48 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes)
0x0000000000000017 (JMPREL) 0x200710 0x0000000000000017 (JMPREL) 0x200710
0x0000000000000002 (PLTRELSZ) 288 (bytes) 0x0000000000000002 (PLTRELSZ) 288 (bytes)
0x0000000000000003 (PLTGOT) 0x245260 0x0000000000000003 (PLTGOT) 0x245260
0x0000000000000014 (PLTREL) RELA 0x0000000000000014 (PLTREL) RELA
0x0000000000000006 (SYMTAB) 0x2002e8 0x0000000000000006 (SYMTAB) 0x2002e8
0x000000000000000b (SYMENT) 24 (bytes) 0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000005 (STRTAB) 0x200504 0x0000000000000005 (STRTAB) 0x200504
0x000000000000000a (STRSZ) 469 (bytes) 0x000000000000000a (STRSZ) 469 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x2004e8 0x000000006ffffef5 (GNU_HASH) 0x2004e8
0x0000000000000019 (INIT_ARRAY) 0x244038 0x0000000000000019 (INIT_ARRAY) 0x244038
0x000000000000001b (INIT_ARRAYSZ) 24 (bytes) 0x000000000000001b (INIT_ARRAYSZ) 24 (bytes)
0x000000000000001a (FINI_ARRAY) 0x244030 0x000000000000001a (FINI_ARRAY) 0x244030
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes) 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x000000000000000c (INIT) 0x242f34 0x000000000000000c (INIT) 0x242f34
0x000000000000000d (FINI) 0x242f50 0x000000000000000d (FINI) 0x242f50
0x000000006ffffff0 (VERSYM) 0x200480 0x000000006ffffff0 (VERSYM) 0x200480
0x000000006ffffffe (VERNEED) 0x2004a4 0x000000006ffffffe (VERNEED) 0x2004a4
0x000000006fffffff (VERNEEDNUM) 2 0x000000006fffffff (VERNEEDNUM) 2
0x0000000000000000 (NULL) 0x0 0x0000000000000000 (NULL) 0x0
Relocation section '.rela.dyn' at offset 0x6e0 contains 2 entries: | Relocation section 'sh' at offset 0x1438 contains 2 entries:
Offset Info Type Symbol's Value Symbol's Name + Adden |
0000000000244240 0000000100000006 R_X86_64_GLOB_DAT 0000000000000000 __libc_start_main@GLI | Relocation section '' at offset 0x1468 contains 12 entries:
0000000000244248 0000000200000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0 |
| There are no static relocations in this file.
Relocation section '.rela.plt' at offset 0x710 contains 12 entries: | To see the dynamic relocations add --use-dynamic to the command line.
Offset Info Type Symbol's Value Symbol's Name + Adden <
0000000000245278 0000000500000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipPopCallConfigura <
0000000000245280 0000000600000007 R_X86_64_JUMP_SLOT 0000000000000000 hipLaunchKernel@hip_4 <
0000000000245288 0000000700000007 R_X86_64_JUMP_SLOT 0000000000000000 printf@GLIBC_2.2.5 + <
0000000000245290 0000000800000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipPushCallConfigur <
0000000000245298 0000000900000007 R_X86_64_JUMP_SLOT 0000000000000000 hipMalloc@hip_4.2 + 0 <
00000000002452a0 0000000a00000007 R_X86_64_JUMP_SLOT 0000000000000000 hipMemset@hip_4.2 + 0 <
00000000002452a8 0000000b00000007 R_X86_64_JUMP_SLOT 0000000000000000 hipMemcpy@hip_4.2 + 0 <
00000000002452b0 0000000c00000007 R_X86_64_JUMP_SLOT 0000000000000000 hipDeviceSynchronize@ <
00000000002452b8 0000000d00000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipRegisterFatBinar <
00000000002452c0 0000000e00000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipRegisterFunction <
00000000002452c8 0000000f00000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipUnregisterFatBin <
00000000002452d0 0000001000000007 R_X86_64_JUMP_SLOT 0000000000000000 __cxa_atexit@GLIBC_2. <
The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently
> readelf: Warning: Virtual address 0x2004e8 not located in any PT_LOAD segment.
> readelf: Error: Failed to read in number of buckets
Symbol table '.dynsym' contains 17 entries: | Symbol table 'te.ABI-tag' contains 17 entries:
Num: Value Size Type Bind Vis Ndx Name Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND | 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND ^Areadelf: Warning: Virtual address 0
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2) | readelf: Error: Reading 2 bytes extends past end of file for version data
2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__ |
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable | 1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND readelf: Warning: Virtual address 0x2
4: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable | readelf: Error: Reading 2 bytes extends past end of file for version data
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPopCallConfiguration@hip_4.2 (3) |
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipLaunchKernel@hip_4.2 (3) | 2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND readelf: Warning: Virtual address 0x2
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND printf@GLIBC_2.2.5 (2) | readelf: Error: Reading 2 bytes extends past end of file for version data
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPushCallConfiguration@hip_4.2 (3 |
9: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMalloc@hip_4.2 (3) | 3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND ^F^Oreadelf: Warning: Virtual address
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemset@hip_4.2 (3) | readelf: Error: Reading 2 bytes extends past end of file for version data
11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemcpy@hip_4.2 (3) |
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipDeviceSynchronize@hip_4.2 (3) | 4: 0000000000000000 0 NOTYPE WEAK DEFAULT UND readelf: Warning: Virtual address 0x2
13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFatBinary@hip_4.2 (3) | readelf: Error: Reading 2 bytes extends past end of file for version data
14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFunction@hip_4.2 (3) |
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipUnregisterFatBinary@hip_4.2 (3) | 5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.2.5 (2) | readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 9: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
> 16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND <corrupt>readelf: Warning: Virtual ad
> readelf: Error: Reading 2 bytes extends past end of file for version data
>
Symbol table '.symtab' contains 60 entries: | Symbol table 'debug_line' contains 60 entries:
Num: Value Size Type Bind Vis Ndx Name Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c | 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS
2: 0000000000245260 0 OBJECT LOCAL DEFAULT 24 __TMC_LIST__ | 2: 0000000000245260 0 OBJECT LOCAL DEFAULT 24
3: 0000000000242a50 0 FUNC LOCAL DEFAULT 15 deregister_tm_clones | 3: 0000000000242a50 0 FUNC LOCAL DEFAULT 15
4: 0000000000242a80 0 FUNC LOCAL DEFAULT 15 register_tm_clones | 4: 0000000000242a80 0 FUNC LOCAL DEFAULT 15
5: 0000000000242ac0 0 FUNC LOCAL DEFAULT 15 __do_global_dtors_aux | 5: 0000000000242ac0 0 FUNC LOCAL DEFAULT 15
6: 00000000002452d8 1 OBJECT LOCAL DEFAULT 26 completed.0 | 6: 00000000002452d8 1 OBJECT LOCAL DEFAULT 26
7: 0000000000244030 0 OBJECT LOCAL DEFAULT 19 __do_global_dtors_aux_fini_array_entr | 7: 0000000000244030 0 OBJECT LOCAL DEFAULT 19
8: 0000000000242af0 0 FUNC LOCAL DEFAULT 15 frame_dummy | 8: 0000000000242af0 0 FUNC LOCAL DEFAULT 15
9: 0000000000244038 0 OBJECT LOCAL DEFAULT 20 __frame_dummy_init_array_entry | 9: 0000000000244038 0 OBJECT LOCAL DEFAULT 20 ^Z
10: 0000000000245258 0 OBJECT LOCAL HIDDEN 23 __dso_handle | 10: 0000000000245258 0 OBJECT LOCAL HIDDEN 23
11: 0000000000000000 0 FILE LOCAL DEFAULT ABS source2.hip | 11: 0000000000000000 0 FILE LOCAL DEFAULT ABS
12: 0000000000242d20 91 FUNC LOCAL DEFAULT 15 __hip_module_ctor | 12: 0000000000242d20 91 FUNC LOCAL DEFAULT 15
13: 00000000002452e0 8 OBJECT LOCAL DEFAULT 26 __hip_gpubin_handle | 13: 00000000002452e0 8 OBJECT LOCAL DEFAULT 26
14: 0000000000241780 24 OBJECT LOCAL DEFAULT 12 __hip_fatbin_wrapper | 14: 0000000000241780 24 OBJECT LOCAL DEFAULT 12
15: 0000000000242d80 31 FUNC LOCAL DEFAULT 15 __hip_module_dtor | 15: 0000000000242d80 31 FUNC LOCAL DEFAULT 15
16: 0000000000000000 0 FILE LOCAL DEFAULT ABS source1.hip | 16: 0000000000000000 0 FILE LOCAL DEFAULT ABS ��
17: 0000000000242e00 91 FUNC LOCAL DEFAULT 15 __hip_module_ctor | 17: 0000000000242e00 91 FUNC LOCAL DEFAULT 15
18: 00000000002452e8 8 OBJECT LOCAL DEFAULT 26 __hip_gpubin_handle | 18: 00000000002452e8 8 OBJECT LOCAL DEFAULT 26
19: 0000000000241798 24 OBJECT LOCAL DEFAULT 12 __hip_fatbin_wrapper | 19: 0000000000241798 24 OBJECT LOCAL DEFAULT 12
20: 0000000000242e60 31 FUNC LOCAL DEFAULT 15 __hip_module_dtor | 20: 0000000000242e60 31 FUNC LOCAL DEFAULT 15
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS inst.hip | 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
22: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c | 22: 0000000000000000 0 FILE LOCAL DEFAULT ABS
23: 0000000000241830 0 OBJECT LOCAL DEFAULT 14 __FRAME_END__ | 23: 0000000000241830 0 OBJECT LOCAL DEFAULT 14
24: 0000000000245260 0 OBJECT LOCAL HIDDEN 24 __TMC_END__ | 24: 0000000000245260 0 OBJECT LOCAL HIDDEN 24
25: 0000000000242a40 5 FUNC LOCAL HIDDEN 15 _dl_relocate_static_pie | 25: 0000000000242a40 5 FUNC LOCAL HIDDEN 15 R$
26: 0000000000245260 0 NOTYPE LOCAL HIDDEN 25 _GLOBAL_OFFSET_TABLE_ | 26: 0000000000245260 0 NOTYPE LOCAL HIDDEN 25 ^N^A
27: 0000000000244038 0 NOTYPE LOCAL HIDDEN 20 __init_array_start | 27: 0000000000244038 0 NOTYPE LOCAL HIDDEN 20 0^H
28: 0000000000244050 0 NOTYPE LOCAL HIDDEN 20 __init_array_end | 28: 0000000000244050 0 NOTYPE LOCAL HIDDEN 20
29: 0000000000244050 0 NOTYPE LOCAL HIDDEN 21 _DYNAMIC | 29: 0000000000244050 0 NOTYPE LOCAL HIDDEN 21
30: 0000000000242f34 0 FUNC LOCAL HIDDEN 16 _init | 30: 0000000000242f34 0 FUNC LOCAL HIDDEN 16
31: 0000000000242f50 0 FUNC LOCAL HIDDEN 17 _fini | 31: 0000000000242f50 0 FUNC LOCAL HIDDEN 17
32: 0000000000242f20 18 FUNC LOCAL HIDDEN 15 atexit | 32: 0000000000242f20 18 FUNC LOCAL HIDDEN 15
33: 0000000000242f10 5 FUNC GLOBAL DEFAULT 15 __libc_csu_fini | 33: 0000000000242f10 5 FUNC GLOBAL DEFAULT 15
34: 0000000000242a10 47 FUNC GLOBAL DEFAULT 15 _start | 34: 0000000000242a10 47 FUNC GLOBAL DEFAULT 15 ^W$
35: 0000000000242ea0 101 FUNC GLOBAL DEFAULT 15 __libc_csu_init | 35: 0000000000242ea0 101 FUNC GLOBAL DEFAULT 15 ^X
36: 0000000000242b60 434 FUNC GLOBAL DEFAULT 15 main | 36: 0000000000242b60 434 FUNC GLOBAL DEFAULT 15 �-$
37: 0000000000245250 0 NOTYPE WEAK DEFAULT 23 data_start | 37: 0000000000245250 0 NOTYPE WEAK DEFAULT 23
38: 0000000000200830 4 OBJECT GLOBAL DEFAULT 10 _IO_stdin_used | 38: 0000000000200830 4 OBJECT GLOBAL DEFAULT 10
39: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main | 39: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
40: 0000000000245250 0 NOTYPE GLOBAL DEFAULT 23 __data_start | 40: 0000000000245250 0 NOTYPE GLOBAL DEFAULT 23
41: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__ | 41: 0000000000000000 0 NOTYPE WEAK DEFAULT UND
42: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable | 42: 0000000000000000 0 NOTYPE WEAK DEFAULT UND
43: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable | 43: 0000000000000000 0 NOTYPE WEAK DEFAULT UND
44: 0000000000242b00 90 FUNC GLOBAL DEFAULT 15 _Z22__device_stub__source2i | 44: 0000000000242b00 90 FUNC GLOBAL DEFAULT 15 ^N
45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPopCallConfiguration | 45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND $
46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipLaunchKernel | 46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND printf | 47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPushCallConfiguration | 48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMalloc | 49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemset | 50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND �^C
51: 0000000000242da0 88 FUNC GLOBAL DEFAULT 15 _Z22__device_stub__source1Pi | 51: 0000000000242da0 88 FUNC GLOBAL DEFAULT 15 $
52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemcpy | 52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipDeviceSynchronize | 53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ^A
54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFatBinary | 54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFunction | 55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipUnregisterFatBinary | 56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
57: 0000000000242e80 1 FUNC GLOBAL DEFAULT 15 _ZN11device_data8allocateEmP12ihipStr | 57: 0000000000242e80 1 FUNC GLOBAL DEFAULT 15
58: 0000000000242e90 1 FUNC GLOBAL DEFAULT 15 _ZN11device_data10deallocateEP12ihipS | 58: 0000000000242e90 1 FUNC GLOBAL DEFAULT 15
59: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit | 59: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
| readelf: Error: Section .shstrtab has an invalid sh_entsize of 0x0
Version symbols section '.gnu.version' contains 17 entries: |
Addr: 0x0000000000200480 Offset: 0x000480 Link: 3 (.dynsym) | Version needs section 'nu.version' contains 2 entries:
000: 0 (*local*) 2 (GLIBC_2.2.5) 1 (*global*) 1 (*global*) | Addr: 0x00000000000001fc Offset: 0x0011fc Link: 7 (nu.version)
004: 1 (*global*) 3 (hip_4.2) 3 (hip_4.2) 2 (GLIBC_2.2.5) | 000000: Version: 1 File: 12a Cnt: 1
008: 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) | 0x0020: Name index: 13b Flags: none Version: 3
00c: 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) | 0x0010: Version: 1 File: 143 Cnt: 1
010: 2 (GLIBC_2.2.5) | 0x0030: Name index: 14d Flags: none Version: 2
<
Version needs section '.gnu.version_r' contains 2 entries: <
Addr: 0x00000000002004a4 Offset: 0x0004a4 Link: 7 (.dynstr) <
000000: Version: 1 File: libamdhip64.so.4 Cnt: 1 <
0x0020: Name: hip_4.2 Flags: none Version: 3 <
0x0010: Version: 1 File: libc.so.6 Cnt: 1 <
0x0030: Name: GLIBC_2.2.5 Flags: none Version: 2 <
Displaying notes found in: .note.ABI-tag | Displaying notes found in: b
Owner Data size Description Owner Data size Description
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, A GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, A |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 1 reply
-
I've read the docs pretty thoroughly and looked at several of the examples and tests and it doesn't appear to me that there is any significant part of the API that I am ignoring when copying things over to the writer (there are a few minor things like the segment file/memory size but nearly everything I excluded was bc they were causing validation or write errors at some point). |
Beta Was this translation helpful? Give feedback.
-
Hi @jrmadsen ,
|
Beta Was this translation helpful? Give feedback.
-
@serge1 yes, that possibility was not lost on me. The objective of this exercise was to validate that I could assemble a valid ELF file from the components, not just copy it. In practice, I am going to be interacting with a compiler API and will need to essentially do something along the lines of the highly simplified model I provided here |
Beta Was this translation helpful? Give feedback.
-
By the way, I'm happy to fix this issue myself. Not expecting you to, just looking for insight or at least guesses about what is going wrong. |
Beta Was this translation helpful? Give feedback.
-
I am going to look at the differencies. The first think coming is that creating a new instance of 'elfio' automatically creates a couple of required sections. Those sections are duplicated again when the full list of sections is copied. The second aspect I would look at is the segments memory layout. When elfio creates a segment layout, it obeys the visible section align rules. It might be different from the memory layout used by the original file. In the last case, all reallocations will be shifted. This will lead to an incorrect output file image. Please also look at https://github.com/serge1/ELFIO/wiki/How-to-modify-section-data |
Beta Was this translation helpful? Give feedback.
-
As for the pair 'load+save', the library makes special effort trying to remember original offsets. It is not 100% solution too, but, it works in some basic cases. If you are going to work with a compiler API, most likely, you will work with not linked object files. In such case, the things become much easy. |
Beta Was this translation helpful? Give feedback.
-
Due to automatically inserted sections, all the 'link' fields from the original file are become invalid. In particular, this leads to incorrect relocations during loading process. |
Beta Was this translation helpful? Give feedback.
-
Yet another advice - you may check equivalence of two ELF files by using functions similar to checkObjestsAreEqual() and checkExeAreEqual() located in tests/ELFIOTest1.cpp. Let me know if you have further doubts |
Beta Was this translation helpful? Give feedback.
-
Similarly, due to a different order of sections insertion, section header string table cannot be reused "as is". All string pointers become invalid. NULL section should not be copied again |
Beta Was this translation helpful? Give feedback.
-
@serge1 Thank you for all your insight. I had to make using Section = ELFIO::section;
using Segment = ELFIO::segment;
void read_write(std::string in, std::string out)
{
ELFIO::elfio reader{};
ELFIO::elfio writer{};
reader.load(in);
writer.create(reader.get_class(), reader.get_encoding());
writer.set_os_abi(reader.get_os_abi());
writer.set_type(reader.get_type());
writer.set_machine(reader.get_machine());
writer.set_abi_version(reader.get_abi_version());
writer.set_entry(reader.get_entry());
std::vector<std::pair<Section*, Section*>> _sections{};
std::vector<std::pair<Segment*, Segment*>> _segments{};
std::map<ELFIO::Elf_Word, ELFIO::Elf_Word> _section_index_mapping = { { 0, 0 } };
for(size_t i = 0; i < reader.sections.size(); ++i)
{
Section* _read = reader.sections[i];
if(_read->get_name().empty())
continue;
auto itr = std::find_if(
writer.sections.begin(), writer.sections.end(),
[_read](const Section* _v) { return _v->get_name() == _read->get_name(); });
_sections.emplace_back(_read, (itr == writer.sections.end())
? writer.sections.add(_read->get_name())
: *itr);
}
for(size_t i = 0; i < reader.segments.size(); ++i)
_segments.emplace_back(reader.segments[i], writer.segments.add());
for(auto& itr : _sections)
_section_index_mapping.emplace(itr.first->get_index(), itr.second->get_index());
for(auto& itr : _sections)
{
auto* _read = itr.first;
auto* _write = itr.second;
_write->set_name(_read->get_name());
_write->set_type(_read->get_type());
_write->set_flags(_read->get_flags());
_write->set_address(_read->get_address());
_write->set_addr_align(_read->get_addr_align());
_write->set_link(_section_index_mapping.at(_read->get_link()));
_write->set_info(_read->get_info());
_write->set_name_string_offset(_read->get_name_string_offset());
_write->set_entry_size(_read->get_entry_size());
if(_write->get_name() != ".bss")
_write->set_data(_read->get_data(), _read->get_size());
else
_write->set_size(24);
}
for(auto& itr : _segments)
{
auto* _read = itr.first;
auto* _write = itr.second;
_write->set_type(_read->get_type());
_write->set_flags(_read->get_flags());
_write->set_align(_read->get_align());
_write->set_virtual_address(_read->get_virtual_address());
_write->set_physical_address(_read->get_physical_address());
_write->set_offset(_read->get_offset());
for(size_t i = 0; i < _read->get_sections_num(); ++i)
{
Section* _read_sec = reader.sections[_read->get_section_index_at(i)];
Section* _write_sec =
writer.sections[_section_index_mapping.at(_read_sec->get_index())];
_write->add_section(_write_sec, _write_sec->get_addr_align());
}
}
writer.save(out);
} And the diff: $ readelf -a -W ./exe &> dump.exe && readelf -a -W ./exe.mod &> dump.exe.mod && diff -y -W 200 ./dump.exe ./dump.exe.mod
ELF Header: ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64 Class: ELF64
Data: 2's complement, little endian Data: 2's complement, little endian
Version: 1 (current) Version: 1 (current)
OS/ABI: UNIX - System V OS/ABI: UNIX - System V
ABI Version: 0 ABI Version: 0
Type: EXEC (Executable file) Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64 Machine: Advanced Micro Devices X86-64
Version: 0x1 Version: 0x1
Entry point address: 0x242a10 Entry point address: 0x242a10
Start of program headers: 64 (bytes into file) Start of program headers: 64 (bytes into file)
Start of section headers: 338336 (bytes into file) Start of section headers: 338336 (bytes into file)
Flags: 0x0 Flags: 0x0
Size of this header: 64 (bytes) Size of this header: 64 (bytes)
Size of program headers: 56 (bytes) Size of program headers: 56 (bytes)
Number of program headers: 11 Number of program headers: 11
Size of section headers: 64 (bytes) Size of section headers: 64 (bytes)
Number of section headers: 36 Number of section headers: 36
Section header string table index: 34 | Section header string table index: 1
Section Headers: Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al [Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .interp PROGBITS 00000000002002a8 0002a8 00001c 00 A 0 0 1 | [ 1] .shstrtab STRTAB 0000000000000000 0422d8 00015f 00 0 0 1
[ 2] .note.ABI-tag NOTE 00000000002002c4 0002c4 000020 00 A 0 0 4 | [ 2] .interp PROGBITS 00000000002002a8 0002a8 00001c 00 A 0 0 1
[ 3] .dynsym DYNSYM 00000000002002e8 0002e8 000198 18 A 7 1 8 | [ 3] .note.ABI-tag NOTE 00000000002002c4 0002c4 000020 00 A 0 0 4
[ 4] .gnu.version VERSYM 0000000000200480 000480 000022 02 A 3 0 2 | [ 4] .dynsym DYNSYM 00000000002002e8 0002e8 000198 18 A 8 1 8
[ 5] .gnu.version_r VERNEED 00000000002004a4 0004a4 000040 00 A 7 2 4 | [ 5] .gnu.version VERSYM 0000000000200480 000480 000022 02 A 4 0 2
[ 6] .gnu.hash GNU_HASH 00000000002004e8 0004e8 00001c 00 A 3 0 8 | [ 6] .gnu.version_r VERNEED 00000000002004a4 0004a4 000040 00 A 8 2 4
[ 7] .dynstr STRTAB 0000000000200504 000504 0001d5 00 A 0 0 1 | [ 7] .gnu.hash GNU_HASH 00000000002004e8 0004e8 00001c 00 A 4 0 8
[ 8] .rela.dyn RELA 00000000002006e0 0006e0 000030 18 A 3 0 8 | [ 8] .dynstr STRTAB 0000000000200504 000504 0001d5 00 A 0 0 1
[ 9] .rela.plt RELA 0000000000200710 000710 000120 18 AI 3 25 8 | [ 9] .rela.dyn RELA 00000000002006e0 0006e0 000030 18 A 4 0 8
[10] .rodata PROGBITS 0000000000200830 000830 000049 00 AMS 0 0 4 | [10] .rela.plt RELA 0000000000200710 000710 000120 18 AI 4 25 8
[11] .hip_fatbin PROGBITS 0000000000201000 001000 040779 00 A 0 0 4096 | [11] .rodata PROGBITS 0000000000200830 000830 000049 00 AMS 0 0 4
[12] .hipFatBinSegment PROGBITS 0000000000241780 041780 000030 00 A 0 0 8 | [12] .hip_fatbin PROGBITS 0000000000201000 001000 040779 00 A 0 0 4096
[13] .eh_frame_hdr PROGBITS 00000000002417b0 0417b0 00007c 00 A 0 0 4 | [13] .hipFatBinSegment PROGBITS 0000000000241780 041780 000030 00 A 0 0 8
[14] .eh_frame PROGBITS 0000000000241830 041830 0001d4 00 A 0 0 8 | [14] .eh_frame_hdr PROGBITS 00000000002417b0 0417b0 00007c 00 A 0 0 4
[15] .text PROGBITS 0000000000242a10 041a10 000522 00 AX 0 0 16 | [15] .eh_frame PROGBITS 0000000000241830 041830 0001d4 00 A 0 0 8
[16] .init PROGBITS 0000000000242f34 041f34 00001b 00 AX 0 0 4 | [16] .text PROGBITS 0000000000242a10 041a10 000522 00 AX 0 0 16
[17] .fini PROGBITS 0000000000242f50 041f50 00000d 00 AX 0 0 4 | [17] .init PROGBITS 0000000000242f34 041f34 00001b 00 AX 0 0 4
[18] .plt PROGBITS 0000000000242f60 041f60 0000d0 00 AX 0 0 16 | [18] .fini PROGBITS 0000000000242f50 041f50 00000d 00 AX 0 0 4
[19] .fini_array FINI_ARRAY 0000000000244030 042030 000008 08 WA 0 0 8 | [19] .plt PROGBITS 0000000000242f60 041f60 0000d0 00 AX 0 0 16
[20] .init_array INIT_ARRAY 0000000000244038 042038 000018 00 WA 0 0 8 | [20] .fini_array FINI_ARRAY 0000000000244030 042030 000008 08 WA 0 0 8
[21] .dynamic DYNAMIC 0000000000244050 042050 0001f0 10 WA 7 0 8 | [21] .init_array INIT_ARRAY 0000000000244038 042038 000018 00 WA 0 0 8
[22] .got PROGBITS 0000000000244240 042240 000010 00 WA 0 0 8 | [22] .dynamic DYNAMIC 0000000000244050 042050 0001f0 10 WA 8 0 8
[23] .data PROGBITS 0000000000245250 042250 000010 00 WA 0 0 8 | [23] .got PROGBITS 0000000000244240 042240 000010 00 WA 0 0 8
[24] .tm_clone_table PROGBITS 0000000000245260 042260 000000 00 WA 0 0 8 | [24] .data PROGBITS 0000000000245250 042250 000010 00 WA 0 0 8
[25] .got.plt PROGBITS 0000000000245260 042260 000078 00 WA 0 0 8 | [25] .tm_clone_table PROGBITS 0000000000245260 042260 000000 00 WA 0 0 8
[26] .bss NOBITS 00000000002452d8 0422d8 000018 00 WA 0 0 8 | [26] .got.plt PROGBITS 0000000000245260 042260 000078 00 WA 0 0 8
[27] .comment PROGBITS 0000000000000000 0422d8 00010b 01 MS 0 0 1 | [27] .bss NOBITS 00000000002452d8 0422d8 000018 00 WA 0 0 8
[28] .debug_loc PROGBITS 0000000000000000 0423e3 0001a6 00 0 0 1 | [28] .comment PROGBITS 0000000000000000 042437 00010b 01 MS 0 0 1
[29] .debug_abbrev PROGBITS 0000000000000000 042589 000960 00 0 0 1 | [29] .debug_loc PROGBITS 0000000000000000 042542 0001a6 00 0 0 1
[30] .debug_info PROGBITS 0000000000000000 042ee9 00be2c 00 0 0 1 | [30] .debug_abbrev PROGBITS 0000000000000000 0426e8 000960 00 0 0 1
[31] .debug_str PROGBITS 0000000000000000 04ed15 002394 01 MS 0 0 1 | [31] .debug_info PROGBITS 0000000000000000 043048 00be2c 00 0 0 1
[32] .debug_line PROGBITS 0000000000000000 0510a9 000e2e 00 0 0 1 | [32] .debug_str PROGBITS 0000000000000000 04ee74 002394 01 MS 0 0 1
[33] .symtab SYMTAB 0000000000000000 051ed8 0005a0 18 35 33 8 | [33] .debug_line PROGBITS 0000000000000000 051208 000e2e 00 0 0 1
[34] .shstrtab STRTAB 0000000000000000 052478 00015f 00 0 0 1 | [34] .symtab SYMTAB 0000000000000000 052038 0005a0 18 35 33 8
[35] .strtab STRTAB 0000000000000000 0525d7 0003c5 00 0 0 1 | [35] .strtab STRTAB 0000000000000000 0525d8 0003c5 00 0 0 1
Key to Flags: Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info), W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS), L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude), C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific) l (large), p (processor specific)
There are no section groups in this file. There are no section groups in this file.
Program Headers: Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000040 0x0000000000200040 0x0000000000200040 0x000268 0x000268 R 0x8 PHDR 0x000040 0x0000000000200040 0x0000000000200040 0x000268 0x000268 R 0x8
INTERP 0x0002a8 0x00000000002002a8 0x00000000002002a8 0x00001c 0x00001c R 0x1 INTERP 0x0002a8 0x00000000002002a8 0x00000000002002a8 0x00001c 0x00001c R 0x1
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x041a04 0x041a04 R 0x1000 LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x041a04 0x041a04 R 0x1000
LOAD 0x041a10 0x0000000000242a10 0x0000000000242a10 0x000620 0x000620 R E 0x1000 LOAD 0x041a10 0x0000000000242a10 0x0000000000242a10 0x000620 0x000620 R E 0x1000
LOAD 0x042030 0x0000000000244030 0x0000000000244030 0x000220 0x000220 RW 0x1000 LOAD 0x042030 0x0000000000244030 0x0000000000244030 0x000220 0x000220 RW 0x1000
LOAD 0x042250 0x0000000000245250 0x0000000000245250 0x000088 0x0000a0 RW 0x1000 LOAD 0x042250 0x0000000000245250 0x0000000000245250 0x000088 0x0000a0 RW 0x1000
DYNAMIC 0x042050 0x0000000000244050 0x0000000000244050 0x0001f0 0x0001f0 RW 0x8 DYNAMIC 0x042050 0x0000000000244050 0x0000000000244050 0x0001f0 0x0001f0 RW 0x8
GNU_RELRO 0x042030 0x0000000000244030 0x0000000000244030 0x000220 0x000fd0 R 0x1 | GNU_RELRO 0x042030 0x0000000000244030 0x0000000000244030 0x000220 0x000220 R 0x8
GNU_EH_FRAME 0x0417b0 0x00000000002417b0 0x00000000002417b0 0x00007c 0x00007c R 0x4 GNU_EH_FRAME 0x0417b0 0x00000000002417b0 0x00000000002417b0 0x00007c 0x00007c R 0x4
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0
NOTE 0x0002c4 0x00000000002002c4 0x00000000002002c4 0x000020 0x000020 R 0x4 NOTE 0x0002c4 0x00000000002002c4 0x00000000002002c4 0x000020 0x000020 R 0x4
Section to Segment mapping: Section to Segment mapping:
Segment Sections... Segment Sections...
00 00
01 .interp 01 .interp
02 .interp .note.ABI-tag .dynsym .gnu.version .gnu.version_r .gnu.hash .dynstr .rela.dyn 02 .interp .note.ABI-tag .dynsym .gnu.version .gnu.version_r .gnu.hash .dynstr .rela.dyn
03 .text .init .fini .plt 03 .text .init .fini .plt
04 .fini_array .init_array .dynamic .got 04 .fini_array .init_array .dynamic .got
05 .data .tm_clone_table .got.plt .bss 05 .data .tm_clone_table .got.plt .bss
06 .dynamic 06 .dynamic
07 .fini_array .init_array .dynamic .got 07 .fini_array .init_array .dynamic .got
08 .eh_frame_hdr 08 .eh_frame_hdr
09 09
10 .note.ABI-tag 10 .note.ABI-tag
Dynamic section at offset 0x42050 contains 31 entries: Dynamic section at offset 0x42050 contains 31 entries:
Tag Type Name/Value Tag Type Name/Value
0x000000000000001d (RUNPATH) Library runpath: [/opt/rocm/lib:/opt/rocm-4.3.0/hip/lib 0x000000000000001d (RUNPATH) Library runpath: [/opt/rocm/lib:/opt/rocm-4.3.0/hip/lib
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [librt.so.1] 0x0000000000000001 (NEEDED) Shared library: [librt.so.1]
0x0000000000000001 (NEEDED) Shared library: [libamdhip64.so.4] 0x0000000000000001 (NEEDED) Shared library: [libamdhip64.so.4]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6] 0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000015 (DEBUG) 0x0 0x0000000000000015 (DEBUG) 0x0
0x0000000000000007 (RELA) 0x2006e0 0x0000000000000007 (RELA) 0x2006e0
0x0000000000000008 (RELASZ) 48 (bytes) 0x0000000000000008 (RELASZ) 48 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes)
0x0000000000000017 (JMPREL) 0x200710 0x0000000000000017 (JMPREL) 0x200710
0x0000000000000002 (PLTRELSZ) 288 (bytes) 0x0000000000000002 (PLTRELSZ) 288 (bytes)
0x0000000000000003 (PLTGOT) 0x245260 0x0000000000000003 (PLTGOT) 0x245260
0x0000000000000014 (PLTREL) RELA 0x0000000000000014 (PLTREL) RELA
0x0000000000000006 (SYMTAB) 0x2002e8 0x0000000000000006 (SYMTAB) 0x2002e8
0x000000000000000b (SYMENT) 24 (bytes) 0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000005 (STRTAB) 0x200504 0x0000000000000005 (STRTAB) 0x200504
0x000000000000000a (STRSZ) 469 (bytes) 0x000000000000000a (STRSZ) 469 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x2004e8 0x000000006ffffef5 (GNU_HASH) 0x2004e8
0x0000000000000019 (INIT_ARRAY) 0x244038 0x0000000000000019 (INIT_ARRAY) 0x244038
0x000000000000001b (INIT_ARRAYSZ) 24 (bytes) 0x000000000000001b (INIT_ARRAYSZ) 24 (bytes)
0x000000000000001a (FINI_ARRAY) 0x244030 0x000000000000001a (FINI_ARRAY) 0x244030
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes) 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x000000000000000c (INIT) 0x242f34 0x000000000000000c (INIT) 0x242f34
0x000000000000000d (FINI) 0x242f50 0x000000000000000d (FINI) 0x242f50
0x000000006ffffff0 (VERSYM) 0x200480 0x000000006ffffff0 (VERSYM) 0x200480
0x000000006ffffffe (VERNEED) 0x2004a4 0x000000006ffffffe (VERNEED) 0x2004a4
0x000000006fffffff (VERNEEDNUM) 2 0x000000006fffffff (VERNEEDNUM) 2
0x0000000000000000 (NULL) 0x0 0x0000000000000000 (NULL) 0x0
Relocation section '.rela.dyn' at offset 0x6e0 contains 2 entries: Relocation section '.rela.dyn' at offset 0x6e0 contains 2 entries:
Offset Info Type Symbol's Value Symbol's Name + Adden Offset Info Type Symbol's Value Symbol's Name + Adden
0000000000244240 0000000100000006 R_X86_64_GLOB_DAT 0000000000000000 __libc_start_main@GLI 0000000000244240 0000000100000006 R_X86_64_GLOB_DAT 0000000000000000 __libc_start_main@GLI
0000000000244248 0000000200000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0 0000000000244248 0000000200000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0
Relocation section '.rela.plt' at offset 0x710 contains 12 entries: Relocation section '.rela.plt' at offset 0x710 contains 12 entries:
Offset Info Type Symbol's Value Symbol's Name + Adden Offset Info Type Symbol's Value Symbol's Name + Adden
0000000000245278 0000000500000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipPopCallConfigura 0000000000245278 0000000500000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipPopCallConfigura
0000000000245280 0000000600000007 R_X86_64_JUMP_SLOT 0000000000000000 hipLaunchKernel@hip_4 0000000000245280 0000000600000007 R_X86_64_JUMP_SLOT 0000000000000000 hipLaunchKernel@hip_4
0000000000245288 0000000700000007 R_X86_64_JUMP_SLOT 0000000000000000 printf@GLIBC_2.2.5 + 0000000000245288 0000000700000007 R_X86_64_JUMP_SLOT 0000000000000000 printf@GLIBC_2.2.5 +
0000000000245290 0000000800000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipPushCallConfigur 0000000000245290 0000000800000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipPushCallConfigur
0000000000245298 0000000900000007 R_X86_64_JUMP_SLOT 0000000000000000 hipMalloc@hip_4.2 + 0 0000000000245298 0000000900000007 R_X86_64_JUMP_SLOT 0000000000000000 hipMalloc@hip_4.2 + 0
00000000002452a0 0000000a00000007 R_X86_64_JUMP_SLOT 0000000000000000 hipMemset@hip_4.2 + 0 00000000002452a0 0000000a00000007 R_X86_64_JUMP_SLOT 0000000000000000 hipMemset@hip_4.2 + 0
00000000002452a8 0000000b00000007 R_X86_64_JUMP_SLOT 0000000000000000 hipMemcpy@hip_4.2 + 0 00000000002452a8 0000000b00000007 R_X86_64_JUMP_SLOT 0000000000000000 hipMemcpy@hip_4.2 + 0
00000000002452b0 0000000c00000007 R_X86_64_JUMP_SLOT 0000000000000000 hipDeviceSynchronize@ 00000000002452b0 0000000c00000007 R_X86_64_JUMP_SLOT 0000000000000000 hipDeviceSynchronize@
00000000002452b8 0000000d00000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipRegisterFatBinar 00000000002452b8 0000000d00000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipRegisterFatBinar
00000000002452c0 0000000e00000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipRegisterFunction 00000000002452c0 0000000e00000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipRegisterFunction
00000000002452c8 0000000f00000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipUnregisterFatBin 00000000002452c8 0000000f00000007 R_X86_64_JUMP_SLOT 0000000000000000 __hipUnregisterFatBin
00000000002452d0 0000001000000007 R_X86_64_JUMP_SLOT 0000000000000000 __cxa_atexit@GLIBC_2. 00000000002452d0 0000001000000007 R_X86_64_JUMP_SLOT 0000000000000000 __cxa_atexit@GLIBC_2.
The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently
Symbol table '.dynsym' contains 17 entries: Symbol table '.dynsym' contains 17 entries:
Num: Value Size Type Bind Vis Ndx Name Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2) 1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2)
2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__ 2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable 3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
4: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable 4: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPopCallConfiguration@hip_4.2 (3) 5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPopCallConfiguration@hip_4.2 (3)
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipLaunchKernel@hip_4.2 (3) 6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipLaunchKernel@hip_4.2 (3)
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND printf@GLIBC_2.2.5 (2) 7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND printf@GLIBC_2.2.5 (2)
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPushCallConfiguration@hip_4.2 (3 8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPushCallConfiguration@hip_4.2 (3
9: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMalloc@hip_4.2 (3) 9: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMalloc@hip_4.2 (3)
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemset@hip_4.2 (3) 10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemset@hip_4.2 (3)
11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemcpy@hip_4.2 (3) 11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemcpy@hip_4.2 (3)
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipDeviceSynchronize@hip_4.2 (3) 12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipDeviceSynchronize@hip_4.2 (3)
13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFatBinary@hip_4.2 (3) 13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFatBinary@hip_4.2 (3)
14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFunction@hip_4.2 (3) 14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFunction@hip_4.2 (3)
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipUnregisterFatBinary@hip_4.2 (3) 15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipUnregisterFatBinary@hip_4.2 (3)
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.2.5 (2) 16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.2.5 (2)
Symbol table '.symtab' contains 60 entries: Symbol table '.symtab' contains 60 entries:
Num: Value Size Type Bind Vis Ndx Name Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
2: 0000000000245260 0 OBJECT LOCAL DEFAULT 24 __TMC_LIST__ 2: 0000000000245260 0 OBJECT LOCAL DEFAULT 24 __TMC_LIST__
3: 0000000000242a50 0 FUNC LOCAL DEFAULT 15 deregister_tm_clones 3: 0000000000242a50 0 FUNC LOCAL DEFAULT 15 deregister_tm_clones
4: 0000000000242a80 0 FUNC LOCAL DEFAULT 15 register_tm_clones 4: 0000000000242a80 0 FUNC LOCAL DEFAULT 15 register_tm_clones
5: 0000000000242ac0 0 FUNC LOCAL DEFAULT 15 __do_global_dtors_aux 5: 0000000000242ac0 0 FUNC LOCAL DEFAULT 15 __do_global_dtors_aux
6: 00000000002452d8 1 OBJECT LOCAL DEFAULT 26 completed.0 6: 00000000002452d8 1 OBJECT LOCAL DEFAULT 26 completed.0
7: 0000000000244030 0 OBJECT LOCAL DEFAULT 19 __do_global_dtors_aux_fini_array_entr 7: 0000000000244030 0 OBJECT LOCAL DEFAULT 19 __do_global_dtors_aux_fini_array_entr
8: 0000000000242af0 0 FUNC LOCAL DEFAULT 15 frame_dummy 8: 0000000000242af0 0 FUNC LOCAL DEFAULT 15 frame_dummy
9: 0000000000244038 0 OBJECT LOCAL DEFAULT 20 __frame_dummy_init_array_entry 9: 0000000000244038 0 OBJECT LOCAL DEFAULT 20 __frame_dummy_init_array_entry
10: 0000000000245258 0 OBJECT LOCAL HIDDEN 23 __dso_handle 10: 0000000000245258 0 OBJECT LOCAL HIDDEN 23 __dso_handle
11: 0000000000000000 0 FILE LOCAL DEFAULT ABS source2.hip 11: 0000000000000000 0 FILE LOCAL DEFAULT ABS source2.hip
12: 0000000000242d20 91 FUNC LOCAL DEFAULT 15 __hip_module_ctor 12: 0000000000242d20 91 FUNC LOCAL DEFAULT 15 __hip_module_ctor
13: 00000000002452e0 8 OBJECT LOCAL DEFAULT 26 __hip_gpubin_handle 13: 00000000002452e0 8 OBJECT LOCAL DEFAULT 26 __hip_gpubin_handle
14: 0000000000241780 24 OBJECT LOCAL DEFAULT 12 __hip_fatbin_wrapper 14: 0000000000241780 24 OBJECT LOCAL DEFAULT 12 __hip_fatbin_wrapper
15: 0000000000242d80 31 FUNC LOCAL DEFAULT 15 __hip_module_dtor 15: 0000000000242d80 31 FUNC LOCAL DEFAULT 15 __hip_module_dtor
16: 0000000000000000 0 FILE LOCAL DEFAULT ABS source1.hip 16: 0000000000000000 0 FILE LOCAL DEFAULT ABS source1.hip
17: 0000000000242e00 91 FUNC LOCAL DEFAULT 15 __hip_module_ctor 17: 0000000000242e00 91 FUNC LOCAL DEFAULT 15 __hip_module_ctor
18: 00000000002452e8 8 OBJECT LOCAL DEFAULT 26 __hip_gpubin_handle 18: 00000000002452e8 8 OBJECT LOCAL DEFAULT 26 __hip_gpubin_handle
19: 0000000000241798 24 OBJECT LOCAL DEFAULT 12 __hip_fatbin_wrapper 19: 0000000000241798 24 OBJECT LOCAL DEFAULT 12 __hip_fatbin_wrapper
20: 0000000000242e60 31 FUNC LOCAL DEFAULT 15 __hip_module_dtor 20: 0000000000242e60 31 FUNC LOCAL DEFAULT 15 __hip_module_dtor
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS inst.hip 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS inst.hip
22: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c 22: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
23: 0000000000241830 0 OBJECT LOCAL DEFAULT 14 __FRAME_END__ 23: 0000000000241830 0 OBJECT LOCAL DEFAULT 14 __FRAME_END__
24: 0000000000245260 0 OBJECT LOCAL HIDDEN 24 __TMC_END__ 24: 0000000000245260 0 OBJECT LOCAL HIDDEN 24 __TMC_END__
25: 0000000000242a40 5 FUNC LOCAL HIDDEN 15 _dl_relocate_static_pie 25: 0000000000242a40 5 FUNC LOCAL HIDDEN 15 _dl_relocate_static_pie
26: 0000000000245260 0 NOTYPE LOCAL HIDDEN 25 _GLOBAL_OFFSET_TABLE_ 26: 0000000000245260 0 NOTYPE LOCAL HIDDEN 25 _GLOBAL_OFFSET_TABLE_
27: 0000000000244038 0 NOTYPE LOCAL HIDDEN 20 __init_array_start 27: 0000000000244038 0 NOTYPE LOCAL HIDDEN 20 __init_array_start
28: 0000000000244050 0 NOTYPE LOCAL HIDDEN 20 __init_array_end 28: 0000000000244050 0 NOTYPE LOCAL HIDDEN 20 __init_array_end
29: 0000000000244050 0 NOTYPE LOCAL HIDDEN 21 _DYNAMIC 29: 0000000000244050 0 NOTYPE LOCAL HIDDEN 21 _DYNAMIC
30: 0000000000242f34 0 FUNC LOCAL HIDDEN 16 _init 30: 0000000000242f34 0 FUNC LOCAL HIDDEN 16 _init
31: 0000000000242f50 0 FUNC LOCAL HIDDEN 17 _fini 31: 0000000000242f50 0 FUNC LOCAL HIDDEN 17 _fini
32: 0000000000242f20 18 FUNC LOCAL HIDDEN 15 atexit 32: 0000000000242f20 18 FUNC LOCAL HIDDEN 15 atexit
33: 0000000000242f10 5 FUNC GLOBAL DEFAULT 15 __libc_csu_fini 33: 0000000000242f10 5 FUNC GLOBAL DEFAULT 15 __libc_csu_fini
34: 0000000000242a10 47 FUNC GLOBAL DEFAULT 15 _start 34: 0000000000242a10 47 FUNC GLOBAL DEFAULT 15 _start
35: 0000000000242ea0 101 FUNC GLOBAL DEFAULT 15 __libc_csu_init 35: 0000000000242ea0 101 FUNC GLOBAL DEFAULT 15 __libc_csu_init
36: 0000000000242b60 434 FUNC GLOBAL DEFAULT 15 main 36: 0000000000242b60 434 FUNC GLOBAL DEFAULT 15 main
37: 0000000000245250 0 NOTYPE WEAK DEFAULT 23 data_start 37: 0000000000245250 0 NOTYPE WEAK DEFAULT 23 data_start
38: 0000000000200830 4 OBJECT GLOBAL DEFAULT 10 _IO_stdin_used 38: 0000000000200830 4 OBJECT GLOBAL DEFAULT 10 _IO_stdin_used
39: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main 39: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main
40: 0000000000245250 0 NOTYPE GLOBAL DEFAULT 23 __data_start 40: 0000000000245250 0 NOTYPE GLOBAL DEFAULT 23 __data_start
41: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__ 41: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
42: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable 42: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
43: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable 43: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
44: 0000000000242b00 90 FUNC GLOBAL DEFAULT 15 _Z22__device_stub__source2i 44: 0000000000242b00 90 FUNC GLOBAL DEFAULT 15 _Z22__device_stub__source2i
45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPopCallConfiguration 45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPopCallConfiguration
46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipLaunchKernel 46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipLaunchKernel
47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND printf 47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND printf
48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPushCallConfiguration 48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipPushCallConfiguration
49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMalloc 49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMalloc
50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemset 50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemset
51: 0000000000242da0 88 FUNC GLOBAL DEFAULT 15 _Z22__device_stub__source1Pi 51: 0000000000242da0 88 FUNC GLOBAL DEFAULT 15 _Z22__device_stub__source1Pi
52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemcpy 52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipMemcpy
53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipDeviceSynchronize 53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND hipDeviceSynchronize
54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFatBinary 54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFatBinary
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFunction 55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipRegisterFunction
56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipUnregisterFatBinary 56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __hipUnregisterFatBinary
57: 0000000000242e80 1 FUNC GLOBAL DEFAULT 15 _ZN11device_data8allocateEmP12ihipStr 57: 0000000000242e80 1 FUNC GLOBAL DEFAULT 15 _ZN11device_data8allocateEmP12ihipStr
58: 0000000000242e90 1 FUNC GLOBAL DEFAULT 15 _ZN11device_data10deallocateEP12ihipS 58: 0000000000242e90 1 FUNC GLOBAL DEFAULT 15 _ZN11device_data10deallocateEP12ihipS
59: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit 59: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit
Version symbols section '.gnu.version' contains 17 entries: Version symbols section '.gnu.version' contains 17 entries:
Addr: 0x0000000000200480 Offset: 0x000480 Link: 3 (.dynsym) | Addr: 0x0000000000200480 Offset: 0x000480 Link: 4 (.dynsym)
000: 0 (*local*) 2 (GLIBC_2.2.5) 1 (*global*) 1 (*global*) 000: 0 (*local*) 2 (GLIBC_2.2.5) 1 (*global*) 1 (*global*)
004: 1 (*global*) 3 (hip_4.2) 3 (hip_4.2) 2 (GLIBC_2.2.5) 004: 1 (*global*) 3 (hip_4.2) 3 (hip_4.2) 2 (GLIBC_2.2.5)
008: 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) 008: 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2)
00c: 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) 00c: 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2) 3 (hip_4.2)
010: 2 (GLIBC_2.2.5) 010: 2 (GLIBC_2.2.5)
Version needs section '.gnu.version_r' contains 2 entries: Version needs section '.gnu.version_r' contains 2 entries:
Addr: 0x00000000002004a4 Offset: 0x0004a4 Link: 7 (.dynstr) | Addr: 0x00000000002004a4 Offset: 0x0004a4 Link: 8 (.dynstr)
000000: Version: 1 File: libamdhip64.so.4 Cnt: 1 000000: Version: 1 File: libamdhip64.so.4 Cnt: 1
0x0020: Name: hip_4.2 Flags: none Version: 3 0x0020: Name: hip_4.2 Flags: none Version: 3
0x0010: Version: 1 File: libc.so.6 Cnt: 1 0x0010: Version: 1 File: libc.so.6 Cnt: 1
0x0030: Name: GLIBC_2.2.5 Flags: none Version: 2 0x0030: Name: GLIBC_2.2.5 Flags: none Version: 2
Displaying notes found in: .note.ABI-tag Displaying notes found in: .note.ABI-tag
Owner Data size Description Owner Data size Description
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, A GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, A |
Beta Was this translation helpful? Give feedback.
-
Great news! The outputs look pretty identical! Did you try to actually run the result file? |
Beta Was this translation helpful? Give feedback.
-
For future reference, I am moving the item to 'Discussions' |
Beta Was this translation helpful? Give feedback.
@serge1 Thank you for all your insight. I had to make
segment::set_offset
public to finally get it working. Here is the final simplified workflow: