UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
syms_elf_parser.c
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#ifndef SYMS_ELF_PARSER_C
4#define SYMS_ELF_PARSER_C
5
6#include <zlib.h>
7
9//~ rjf: Low-Level Header/Section Parsing
10
13{
14 void *file_base = file.str;
15 SYMS_U64Range file_range = syms_make_u64_range(0, file.size);
16
17 //- rjf: predetermined read offsets
19
20 //- rjf: figure out if this file starts with a ELF header
23 {
24 syms_memset(sig, 0, sizeof(sig));
25 syms_based_range_read(file_base, file_range, elf_header_off, sizeof(sig), sig);
26 sig_is_elf = (sig[SYMS_ElfIdentifier_MAG0] == 0x7f &&
27 sig[SYMS_ElfIdentifier_MAG1] == 'E' &&
28 sig[SYMS_ElfIdentifier_MAG2] == 'L' &&
29 sig[SYMS_ElfIdentifier_MAG3] == 'F');
30 }
31
32 //- rjf: parse ELF header
34 SYMS_B32 is_32bit = syms_false;
36 if(sig_is_elf)
37 {
39 switch(sig[SYMS_ElfIdentifier_CLASS])
40 {
41 //- rjf: parse 32-bit header
43 {
48 is_32bit = syms_true;
49 }break;
50 //- rjf: parse 64-bit header
52 {
55 }break;
56 default:break;
57 }
58 }
59
60 //- allen: extract entry point
61 SYMS_U64 entry_point = elf_header.e_entry;
62
63 //- rjf: parse section header
64 SYMS_U64 sh_name_low_offset = SYMS_U64_MAX;
65 SYMS_U64 sh_name_high_offset = SYMS_U64_MAX;
69 {
72 SYMS_U64 shstr_off = elf_header.e_shoff + elf_header.e_shentsize*elf_header.e_shstrndx;
73 switch (sig[SYMS_ElfIdentifier_CLASS]) {
74 case SYMS_ElfClass_32: {
80 } break;
81 case SYMS_ElfClass_64: {
84 } break;
85 }
86
87 //- rjf: save base address and high address of string header names
88 sh_name_low_offset = section_header.sh_offset;
89 sh_name_high_offset = sh_name_low_offset + section_header.sh_size;
90 }
91
92 //- rjf: parse program headers
93 SYMS_U64 base_address = 0;
95 {
98
99 //- rjf: search for base address, by grabbing the first LOAD phdr
100 for(SYMS_U64 i = 0; i < program_header_num; i += 1)
101 {
103 switch(sig[SYMS_ElfIdentifier_CLASS])
104 {
105 case SYMS_ElfClass_32:
106 {
111 }break;
112 case SYMS_ElfClass_64:
113 {
115 }break;
116 }
118 {
119 base_address = program_header.p_vaddr;
120 break;
121 }
122 }
123 }
124
125 //- rjf: determine SYMS_Arch from the ELF machine kind
127 switch(elf_header.e_machine)
128 {
129 default:break;
130 case SYMS_ElfMachineKind_AARCH64: arch = SYMS_Arch_ARM; break;
131 case SYMS_ElfMachineKind_ARM: arch = SYMS_Arch_ARM32; break;
132 case SYMS_ElfMachineKind_386: arch = SYMS_Arch_X86; break;
133 case SYMS_ElfMachineKind_X86_64: arch = SYMS_Arch_X64; break;
134 case SYMS_ElfMachineKind_PPC: arch = SYMS_Arch_PPC; break;
135 case SYMS_ElfMachineKind_PPC64: arch = SYMS_Arch_PPC64; break;
136 case SYMS_ElfMachineKind_IA_64: arch = SYMS_Arch_IA64; break;
137 }
138
139 //- rjf: fill img
142 {
143 img.valid = 1;
144 img.is_32bit = is_32bit;
145 img.ehdr = elf_header;
146 img.arch = arch;
147 img.sh_name_low_offset = sh_name_low_offset;
148 img.sh_name_high_offset = sh_name_high_offset;
149 img.base_address = base_address;
150 img.entry_point = entry_point;
151 }
152
153 return img;
154}
155
158{
159 SYMS_ElfSectionArray result = {0};
160 void *file_base = file.str;
161 SYMS_U64Range file_range = syms_make_u64_range(0, file.size);
162
163 //- rjf: figure out section count
164 // NOTE(rjf): ELF files have a null/empty section at the first slot of the
165 // section header table. We're explicitly skipping that, so we need to
166 // account for (e_shnum-1) sections.
167 SYMS_U64 section_count = img.ehdr.e_shnum ? (img.ehdr.e_shnum-1) : 0;
168
169 //- rjf: figure out section range and section header size (32-bit or 64-bit)
171 SYMS_U64 section_header_size = img.ehdr.e_shentsize;
172 {
173 section_range.min = img.ehdr.e_shoff + 1*section_header_size;
174 section_range.max = section_range.min + section_count*section_header_size;
176 }
177
178 //- rjf: allocate sections
179 SYMS_ElfSection *sections = syms_push_array_zero(arena, SYMS_ElfSection, section_count);
180
181 //- rjf: parse section headers
182 for(SYMS_U64 section_idx = 0; section_idx < section_count; section_idx += 1)
183 {
184 // rjf: parse section header
185 SYMS_ElfShdr64 header;
186 if(img.is_32bit)
187 {
188 // NOTE(rjf): In the case of 32-bit ELF files, we need to convert the 32-bit section
189 // headers to the 64-bit format, which is what we'll be using everywhere else.
193 }
194 else
195 {
197 }
198
199 // rjf: parse section name
200 SYMS_String8 name = syms_based_range_read_string(file_base, file_range, img.sh_name_low_offset + header.sh_name);
202
203 // allen: determine virt size vs file size
204 SYMS_U64 virt_size = header.sh_size;
205 if ((header.sh_flags & SYMS_ElfSectionFlag_ALLOC) == 0){
206 virt_size = 0;
207 }
208 SYMS_U64 file_size = header.sh_size;
209 if (header.sh_type == SYMS_ElfSectionCode_NOBITS){
210 file_size = 0;
211 }
212
213 // rjf: fill section data
214 sections[section_idx].header = header;
215 sections[section_idx].virtual_range = syms_make_u64_range(header.sh_addr, header.sh_addr + virt_size);
216 sections[section_idx].file_range = syms_make_u64_range(header.sh_offset, header.sh_offset + file_size);
217 sections[section_idx].name = name_stabilized;
218
220 {
224
225 SYMS_ElfChdr64 chdr = { 0 };
227 if (img.is_32bit)
228 {
229 SYMS_ElfChdr32 chdr32 = { 0 };
231 if (chdr_size == sizeof(chdr32))
232 {
233 chdr.ch_type = chdr32.ch_type;
234 chdr.ch_size = chdr32.ch_size;
235 chdr.ch_addr_align = chdr32.ch_addr_align;
236 }
237 }
238 else
239 {
240 SYMS_ElfChdr64 chdr64 = { 0 };
242 if (chdr_size == sizeof(chdr64))
243 {
244 chdr.ch_type = chdr64.ch_type;
245 chdr.ch_size = chdr64.ch_size;
246 chdr.ch_addr_align = chdr64.ch_addr_align;
247 }
248 }
249
250 if (chdr.ch_type == SYMS_ElfCompressType_None)
251 {
252 // ok, no compression
253 }
254 else if (chdr.ch_type == SYMS_ElfCompressType_ZLib)
255 {
257 SYMS_U64 compressed_size = file_size;
258 if (compressed_size > syms_u64_range_size(file_range) - header.sh_offset) compressed_size = 0;
260
261 // chdr.ch_addr_align is not relevant here, because structures will be memcpy'ied out of memory
263 SYMS_U8* compressed = (SYMS_U8*)file_base + header.sh_offset + chdr_size;
264
266
267 z_stream stream = { 0 };
268 int err = inflateInit(&stream);
269
270 if (err == Z_OK)
271 {
272 stream.next_in = (const Bytef*)compressed;
273 stream.next_out = (Bytef*)uncompressed;
274
275 const SYMS_U64 max_chunk = SYMS_U32_MAX; // max uInt value for zlib
276
277 do
278 {
279 if (stream.avail_out == 0)
280 {
281 stream.avail_out = (uInt)SYMS_ClampTop(uncompressed_size, max_chunk);
282 uncompressed_size -= stream.avail_out;
283 }
284 if (stream.avail_in == 0)
285 {
286 stream.avail_in = (uInt)SYMS_ClampTop(compressed_size, max_chunk);
287 compressed_size -= stream.avail_in;
288 }
289
290 uInt avail_out = stream.avail_out;
291
292 err = inflate(&stream, Z_NO_FLUSH);
293 if (err == Z_OK || err == Z_STREAM_END)
294 {
295 output_size += avail_out - stream.avail_out;
296 }
297 }
298 while (err == Z_OK);
299
300 if (err != Z_STREAM_END)
301 {
302 output_size = 0;
303 }
304
305 inflateEnd(&stream);
306 }
307
308 if (output_size == 0)
309 {
310 // failed to decompress with zlib, this is failure
311 result.v = 0;
312 result.count = 0;
313 return result;
314 }
315
316 // adjust range so when original data pointer is added, we get offsets into newly allocated space
319 }
320 //else if (chdr.ch_type == ELF_CompressType_ZStd)
321 //{
322 // TODO
323 //}
324 else
325 {
326 // unknown compression type, cannot continue parsing
327 result.v = 0;
328 result.count = 0;
329 return result;
330 }
331 }
332 }
333
334 //- rjf: fill result
335 result.v = sections;
336 result.count = section_count;
337
338 return result;
339}
340
343{
344 void *base = file.str;
345 SYMS_U64Range range = syms_make_u64_range(0, file.size);
346
347 SYMS_U64 segment_count = img.ehdr.e_phnum;
348 SYMS_ElfPhdr64 *segments = syms_push_array_zero(arena, SYMS_ElfPhdr64, segment_count);
349 for(SYMS_U64 segment_idx = 0; segment_idx < segment_count; segment_idx += 1)
350 {
351 if(img.is_32bit)
352 {
354 syms_based_range_read_struct(base, range, img.ehdr.e_phoff + segment_idx * sizeof(SYMS_ElfPhdr32), &phdr32);
356 }
357 else
358 {
359 syms_based_range_read_struct(base, range, img.ehdr.e_phoff + segment_idx * sizeof(SYMS_ElfPhdr64), &segments[segment_idx]);
360 }
361 }
362
364 result.count = segment_count;
365 result.v = segments;
366
367 return result;
368}
369
372{
373 void *file_base = file.str;
374 SYMS_U64Range file_range = syms_make_u64_range(0, file.size);
375 SYMS_ElfExtDebugRef result;
376 syms_memzero_struct(&result);
377 for(SYMS_U64 section_idx = 0; section_idx < sections.count; section_idx += 1)
378 {
379 if(syms_string_match(sections.v[section_idx].name, syms_str8_lit(".gnu_debuglink"), 0))
380 {
381 //- rjf: offsets
384
385 //- rjf: read external debug info path
387 SYMS_U64 path_bytes = result.path.size + 1;
388
389 //- rjf: calculate checksum read offset; pad to the next 4-byte boundary
391 checksum_off += (checksum_off % 4);
392
393 //- rjf: read checksum
395
396 break;
397 }
398 }
399 return result;
400}
401
403//~ rjf: High-Level API Canonical Conversions
404
407 SYMS_SecInfo result = {0};
408 result.vrange = elf_section.virtual_range;
409 result.frange = elf_section.file_range;
410 result.name = elf_section.name;
411 return(result);
412}
413
419
421//~ rjf: File Accelerator
422
425{
428 if (file_accel->header.valid){
430 }
431 return file_accel;
432}
433
435//~ rjf: Binary
436
439{
441 syms_memmove(&bin_accel->header, &file_accel->header, sizeof(file_accel->header));
442 bin_accel->format = file_accel->format;
443 bin_accel->sections = syms_elf_section_array_from_img_header(arena, data, file_accel->header);
444 bin_accel->segments = syms_elf_segment_array_from_img_header(arena, data, file_accel->header);
445 return bin_accel;
446}
447
450{
453 if(ext_debug_ref.path.size != 0)
454 {
456 node->ext_file.file_name = ext_debug_ref.path;
458 syms_memmove(node->ext_file.match_key.v, &ext_debug_ref.external_file_checksum, sizeof(SYMS_U32));
459 SYMS_QueuePush(list.first, list.last, node);
460 list.node_count += 1;
461 }
462 return list;
463}
464
467{
469 array.count = bin->sections.count;
470 array.sec_info = syms_push_array_zero(arena, SYMS_SecInfo, array.count);
471 for(SYMS_U64 idx = 0; idx < array.count; idx += 1)
472 {
473 array.sec_info[idx] = syms_elf_section_info_from_elf_section(bin->sections.v[idx]);
474 }
475 return array;
476}
477
483
489
492 SYMS_Arch result = bin->header.arch;
493 return(result);
494}
495
497//~ NOTE(allen): ELF Specific Helpers
498
501 SYMS_ElfSection *result = 0;
502 for (SYMS_ElfSection *section = bin->sections.v, *opl = bin->sections.v + bin->sections.count;
503 section < opl;
504 section += 1){
505 if (syms_string_match(name, section->name, 0)){
506 result = section;
507 break;
508 }
509 }
510 return(result);
511}
512
514//~ rjf: Imports/Exports
515
518{
520
521 //- rjf: grab prerequisites
522 void *base = (void *)data.str;
525
526 //- rjf: find ranges
532 {
533 SYMS_ElfSection *first = &bin->sections.v[0];
534 SYMS_ElfSection *opl = first+bin->sections.count;
535 for(SYMS_ElfSection *sect = first; sect < opl; sect += 1)
536 {
537 // NOTE(rjf): We subtract 1 from sh_link because we don't store the null
538 // section in the bin section array.
539 SYMS_U64 sh_link_idx = sect->header.sh_link-1;
540 SYMS_B32 sh_link_in_bounds = (0 < sect->header.sh_link && sect->header.sh_link < bin->sections.count);
542 if(syms_string_match(sect->name, syms_str8_lit(".gnu.version_r"), 0))
543 {
544 verneed_range = sect->file_range;
546 }
547 if(syms_string_match(sect->name, syms_str8_lit(".gnu.version"), 0))
548 {
549 versym_range = sect->file_range;
550 }
551 if(syms_string_match(sect->name, syms_str8_lit(".dynsym"), 0))
552 {
553 dynsym_range = sect->file_range;
555 }
556 }
557 }
558
559 //- rjf: grab .dynsym symbol array
563 {
567 // NOTE(rjf): We start the read offset at sym_size because the format
568 // always has a meaningless null symbol at the beginning of the block.
570 if(bin_is_32bit)
571 {
572 for(SYMS_U64 idx = 0; idx < sym_arr_count; idx += 1)
573 {
576 }
577 }
578 else
579 {
581 }
582 }
583
584 //- rjf: parse all import info
588 {
589 SYMS_U64 sym_idx = 1;
590 for(SYMS_ElfSym64 *sym = sym_arr; sym < sym_arr_opl; sym += 1, sym_idx += 1)
591 {
592 // rjf: skip any symbol that does not have the right section index
593 if(sym->st_shndx != SYMS_ElfSectionIndex_UNDEF)
594 {
595 continue;
596 }
597
598 // rjf: read versym
602
603 // rjf: parse vn_file / vna_name
604 SYMS_String8 vn_file = syms_str8_lit("");
605 SYMS_String8 vna_name = syms_str8_lit("");
606 {
607 // rjf: parse all verneeds
609 SYMS_U16 version = vs.vs_vers & SYMS_ELF_EXTERNAL_VERSYM_MASK;
611 for(;;)
612 {
614
615 // rjf: find vernaux with a matching version
617 for(SYMS_U32 aux_idx = 0; aux_idx < vn.vn_cnt; aux_idx += 1)
618 {
619 // rjf: read
622
623 // rjf: if the version matches, we've found the right strings
624 if(vna.vna_other == version)
625 {
626 vn_file = syms_based_range_read_string(base, verneed_strtab_range, vn.vn_file);
627 vna_name = syms_based_range_read_string(base, verneed_strtab_range, vna.vna_name);
629 }
630
631 // rjf: advance
632 if(vna.vna_next == 0)
633 {
634 break;
635 }
636 aux_read_offset += vna.vna_next;
637 }
638
639 // rjf: advance
640 if(vn.vn_next == 0)
641 {
642 break;
643 }
644 verneed_read_offset += vn.vn_next;
645 }
646 }
648
649 // rjf: build node
652 import_count += 1;
653 {
654 SYMS_Import *imp = &node->data;
655
656 // rjf: fill out symbol name
657 {
661 syms_string_list_push(temp.arena, &list, symbol_name);
662 if(vna_name.size > 0)
663 {
666 syms_string_list_push(temp.arena, &list, vna_name);
667 }
668 imp->name = syms_string_list_join(arena, &list, 0);
670 }
671
672 // rjf: fill library name
673 {
674 imp->library_name = syms_push_string_copy(arena, vn_file);
675 }
676 }
677 }
678 }
679
680 //- rjf: build/fill result
681 SYMS_ImportArray result = {0};
682 {
683 result.count = import_count;
684 result.imports = syms_push_array_zero(arena, SYMS_Import, result.count);
685 SYMS_U64 idx = 0;
687 in != 0;
688 in = in->next, idx += 1)
689 {
690 result.imports[idx] = in->data;
691 }
692 }
693
694 //- rjf: return
696 return result;
697}
698
701{
703
709 for (SYMS_U32 sec_idx = 0; sec_idx < bin->sections.count; sec_idx += 1)
710 {
712 if (syms_string_match(sect->name, syms_str8_lit(".gnu.version_d"), 0))
713 {
714 SYMS_ASSERT(sect->header.sh_link > 0 && sect->header.sh_link < bin->sections.count);
715 verdef_range = sect->file_range;
716 verdef_strtab_range = bin->sections.v[sect->header.sh_link-1].file_range;
717 }
718 if (syms_string_match(sect->name, syms_str8_lit(".gnu.version"), 0))
719 {
720 versym_range = sect->file_range;
721 }
722 if (syms_string_match(sect->name, syms_str8_lit(".dynsym"), 0))
723 {
724 SYMS_ASSERT(sect->header.sh_link > 0 && sect->header.sh_link < bin->sections.count);
725 dynsym_range = sect->file_range;
726 dynsym_strtab_range = bin->sections.v[sect->header.sh_link-1].file_range;
727 }
728 }
729
733 void *base = (void*)data.str;
736 {
739 if (bin->header.is_32bit)
740 {
744 }
745 else
746 {
749 }
754 {
757
759 syms_string_list_push(scratch.arena, &name_list, st_name);
760
761 {
762 // find symbol version token
766 // iterate defined version to find version string
769 {
772 SYMS_U32 version = vd.vd_ndx & SYMS_ELF_EXTERNAL_VERSYM_MASK;
773 if (version == symbol_version)
774 {
775 SYMS_B32 has_name = vd.vd_ndx > 1 && (~vd.vd_flags & SYMS_ElfExternalVerFlag_BASE);
776 if (has_name)
777 {
785 }
786 break;
787 }
788 if (vd.vd_next == 0)
789 {
790 break;
791 }
792 verdef_read_offset += vd.vd_next;
793 }
794 }
795
797 if (sym.st_shndx < SYMS_ElfSectionIndex_LO_RESERVE)
798 {
799 SYMS_ASSERT(sym.st_shndx > 0 && sym.st_shndx <= bin->sections.count);
800 SYMS_ElfSection *sect = &bin->sections.v[sym.st_shndx-1];
802 }
803
804 // add to list
807 export_count += 1;
808
809 // fill out data
810 SYMS_Export *exp = &node->data;
812 exp->address = symbol_base_address + sym.st_value;
813 exp->ordinal = 0;
814 exp->forwarder_library_name = syms_str8(0,0);
815 exp->forwarder_import_name = syms_str8(0,0);
816 }
817 }
818
822 for (SYMS_ExportNode *en = first_export; en != 0; en = en->next)
823 {
824 export_array.exports[export_array.count++] = en->data;
825 }
826
828
829 return export_array;
830}
831
832#endif // SYMS_ELF_PARSER_C
OODEFFUNC typedef const char * file
Definition oodle2.h:678
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition syms_base.h:402
Definition syms_elf_parser.h:68
SYMS_ElfImgHeader header
Definition syms_elf_parser.h:70
SYMS_ElfSectionArray sections
Definition syms_elf_parser.h:71
Definition syms_elf.h:303
Definition syms_elf.h:310
Definition syms_elf.h:49
Definition syms_elf.h:30
Definition syms_elf_parser.h:48
SYMS_U32 external_file_checksum
Definition syms_elf_parser.h:50
SYMS_String8 path
Definition syms_elf_parser.h:49
Definition syms_elf.h:245
Definition syms_elf.h:233
Definition syms_elf.h:262
Definition syms_elf.h:252
Definition syms_elf.h:272
Definition syms_elf_parser.h:58
Definition syms_elf_parser.h:12
SYMS_U64 entry_point
Definition syms_elf_parser.h:20
SYMS_U64 base_address
Definition syms_elf_parser.h:19
SYMS_B32 valid
Definition syms_elf_parser.h:13
SYMS_Arch arch
Definition syms_elf_parser.h:16
SYMS_B32 is_32bit
Definition syms_elf_parser.h:14
Definition syms_elf.h:111
Definition syms_elf.h:98
Definition syms_elf_parser.h:34
SYMS_U64 count
Definition syms_elf_parser.h:35
SYMS_ElfSection * v
Definition syms_elf_parser.h:36
Definition syms_elf_parser.h:25
SYMS_String8 name
Definition syms_elf_parser.h:29
SYMS_U64Range file_range
Definition syms_elf_parser.h:28
SYMS_U64Range virtual_range
Definition syms_elf_parser.h:27
SYMS_ElfShdr64 header
Definition syms_elf_parser.h:26
Definition syms_elf_parser.h:41
SYMS_U64 count
Definition syms_elf_parser.h:42
SYMS_ElfPhdr64 * v
Definition syms_elf_parser.h:43
Definition syms_elf.h:83
Definition syms_elf.h:68
SYMS_U64 sh_flags
Definition syms_elf.h:71
SYMS_U64 sh_size
Definition syms_elf.h:74
SYMS_U32 sh_name
Definition syms_elf.h:69
SYMS_U32 sh_type
Definition syms_elf.h:70
SYMS_U64 sh_addr
Definition syms_elf.h:72
SYMS_U64 sh_offset
Definition syms_elf.h:73
Definition syms_elf.h:170
Definition syms_elf.h:180
Definition syms_debug_info.h:69
SYMS_U64 count
Definition syms_debug_info.h:71
Definition syms_debug_info.h:59
struct SYMS_ExportNode * next
Definition syms_debug_info.h:60
SYMS_Export data
Definition syms_debug_info.h:61
Definition syms_debug_info.h:45
SYMS_String8 name
Definition syms_debug_info.h:46
Definition syms_debug_info.h:119
Definition syms_debug_info.h:114
SYMS_ExtFile ext_file
Definition syms_debug_info.h:116
SYMS_String8 file_name
Definition syms_debug_info.h:110
SYMS_ExtMatchKey match_key
Definition syms_debug_info.h:111
SYMS_U8 v[16]
Definition syms_debug_info.h:106
Definition syms_debug_info.h:64
SYMS_Import * imports
Definition syms_debug_info.h:65
SYMS_U64 count
Definition syms_debug_info.h:66
Definition syms_debug_info.h:54
SYMS_Import data
Definition syms_debug_info.h:56
struct SYMS_ImportNode * next
Definition syms_debug_info.h:55
Definition syms_debug_info.h:39
Definition syms_debug_info.h:21
SYMS_U64 count
Definition syms_debug_info.h:23
Definition syms_debug_info.h:15
SYMS_U64Range vrange
Definition syms_debug_info.h:17
SYMS_String8 name
Definition syms_debug_info.h:16
SYMS_U64Range frange
Definition syms_debug_info.h:18
Definition syms_base.h:306
Definition syms_base.h:296
SYMS_U8 * str
Definition syms_base.h:297
SYMS_U64 size
Definition syms_base.h:298
Definition syms_base.h:325
Definition syms_base.h:264
SYMS_U64 max
Definition syms_base.h:266
SYMS_U64 min
Definition syms_base.h:265
SYMS_API SYMS_U64 syms_u64_range_size(SYMS_U64Range range)
Definition syms_base.c:31
SYMS_API SYMS_U64 syms_based_range_read(void *base, SYMS_U64Range range, SYMS_U64 offset, SYMS_U64 out_size, void *out)
Definition syms_base.c:753
SYMS_API SYMS_String8 syms_string_list_join(SYMS_Arena *arena, SYMS_String8List *list, SYMS_StringJoin *join_ptr)
Definition syms_base.c:315
SYMS_API SYMS_ArenaTemp syms_get_scratch(SYMS_Arena **conflicts, SYMS_U64 conflict_count)
Definition syms_base.c:694
SYMS_API SYMS_B32 syms_string_match(SYMS_String8 a, SYMS_String8 b, SYMS_StringMatchFlags flags)
Definition syms_base.c:210
SYMS_API void * syms_based_range_ptr(void *base, SYMS_U64Range range, SYMS_U64 offset)
Definition syms_base.c:744
SYMS_API SYMS_U64Range syms_make_u64_range(SYMS_U64 min, SYMS_U64 max)
Definition syms_base.c:18
SYMS_API SYMS_String8 syms_based_range_read_string(void *base, SYMS_U64Range range, SYMS_U64 offset)
Definition syms_base.c:823
SYMS_API void syms_arena_temp_end(SYMS_ArenaTemp temp)
Definition syms_base.c:689
SYMS_API SYMS_String8 syms_str8(SYMS_U8 *str, SYMS_U64 size)
Definition syms_base.c:169
SYMS_API SYMS_String8 syms_push_string_copy(SYMS_Arena *arena, SYMS_String8 string)
Definition syms_base.c:353
SYMS_API void syms_string_list_push(SYMS_Arena *arena, SYMS_String8List *list, SYMS_String8 string)
Definition syms_base.c:282
SYMS_API SYMS_ArenaTemp syms_arena_temp_begin(SYMS_Arena *arena)
Definition syms_base.c:682
#define syms_true
Definition syms_base.h:105
#define SYMS_U16_MAX
Definition syms_base.h:174
#define syms_based_range_read_struct(b, r, o, p)
Definition syms_base.h:593
#define SYMS_U32_MAX
Definition syms_base.h:175
#define syms_push_array(a, T, c)
Definition syms_base.h:561
#define syms_memzero_struct(s)
Definition syms_base.h:161
#define SYMS_ClampTop(a, b)
Definition syms_base.h:182
#define syms_false
Definition syms_base.h:104
#define SYMS_API
Definition syms_base.h:29
#define SYMS_ASSERT(x)
Definition syms_base.h:125
SYMS_S32 SYMS_B32
Definition syms_base.h:99
#define syms_push_array_zero(a, T, c)
Definition syms_base.h:564
#define SYMS_U64_MAX
Definition syms_base.h:176
#define syms_str8_lit(s)
Definition syms_base.h:483
#define SYMS_QueuePush(f, l, n)
Definition syms_base.h:220
#define syms_release_scratch
Definition syms_base.h:567
uint32_t SYMS_U32
Definition syms_crt_overrides.h:38
uint64_t SYMS_U64
Definition syms_crt_overrides.h:39
#define syms_memmove
Definition syms_crt_overrides.h:65
uint16_t SYMS_U16
Definition syms_crt_overrides.h:37
#define syms_memset
Definition syms_crt_overrides.h:66
uint8_t SYMS_U8
Definition syms_crt_overrides.h:36
#define SYMS_Arena
Definition syms_default_arena.h:61
SYMS_API SYMS_ElfPhdr64 syms_elf_phdr64_from_phdr32(SYMS_ElfPhdr32 h32)
Definition syms_elf.c:53
SYMS_API SYMS_ElfShdr64 syms_elf_shdr64_from_shdr32(SYMS_ElfShdr32 h32)
Definition syms_elf.c:36
SYMS_API SYMS_ElfSym64 syms_elf_sym64_from_sym32(SYMS_ElfSym32 sym32)
Definition syms_elf.c:76
SYMS_API SYMS_ElfEhdr64 syms_elf_ehdr64_from_ehdr32(SYMS_ElfEhdr32 h32)
Definition syms_elf.c:15
@ SYMS_ElfCompressType_ZLib
Definition syms_elf.h:292
@ SYMS_ElfCompressType_None
Definition syms_elf.h:291
#define SYMS_ELF_EXTERNAL_VERSYM_MASK
Definition syms_elf.h:229
#define SYMS_ELF_ST_BIND(x)
Definition syms_elf.h:190
#define SYMS_ELF_EXTERNAL_VERSYM_HIDDEN
Definition syms_elf.h:228
@ SYMS_ElfIdentifier_MAG3
Definition syms_elf.h:19
@ SYMS_ElfIdentifier_MAG1
Definition syms_elf.h:17
@ SYMS_ElfIdentifier_MAG0
Definition syms_elf.h:16
@ SYMS_ElfIdentifier_MAG2
Definition syms_elf.h:18
@ SYMS_ElfIdentifier_CLASS
Definition syms_elf.h:20
@ SYMS_ElfIdentifier_NIDENT
Definition syms_elf.h:25
SYMS_API SYMS_SecInfo syms_elf_section_info_from_elf_section(SYMS_ElfSection elf_section)
Definition syms_elf_parser.c:406
SYMS_API SYMS_ImportArray syms_elf_imports_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_ElfBinAccel *bin)
Definition syms_elf_parser.c:517
SYMS_API SYMS_ElfExtDebugRef syms_elf_ext_debug_ref_from_elf_section_array(SYMS_String8 file, SYMS_ElfSectionArray sections)
Definition syms_elf_parser.c:371
SYMS_API SYMS_ElfBinAccel * syms_elf_bin_accel_from_file(SYMS_Arena *arena, SYMS_String8 data, SYMS_ElfFileAccel *file_accel)
Definition syms_elf_parser.c:438
SYMS_API SYMS_String8 syms_elf_sec_name_from_elf_section(SYMS_ElfSection elf_section)
Definition syms_elf_parser.c:415
SYMS_API SYMS_ExtFileList syms_elf_ext_file_list_from_bin(SYMS_Arena *arena, SYMS_String8 file, SYMS_ElfBinAccel *bin_accel)
Definition syms_elf_parser.c:449
SYMS_API SYMS_U64 syms_elf_default_vbase_from_bin(SYMS_ElfBinAccel *bin)
Definition syms_elf_parser.c:479
SYMS_API SYMS_ElfSectionArray syms_elf_section_array_from_img_header(SYMS_Arena *arena, SYMS_String8 file, SYMS_ElfImgHeader img)
Definition syms_elf_parser.c:157
SYMS_API SYMS_ElfSection * syms_elf_sec_from_bin_name__unstable(SYMS_ElfBinAccel *bin, SYMS_String8 name)
Definition syms_elf_parser.c:500
SYMS_API SYMS_ExportArray syms_elf_exports_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_ElfBinAccel *bin)
Definition syms_elf_parser.c:700
SYMS_API SYMS_ElfImgHeader syms_elf_img_header_from_file(SYMS_String8 file)
Definition syms_elf_parser.c:12
SYMS_API SYMS_U64 syms_elf_entry_point_voff_from_bin(SYMS_ElfBinAccel *bin)
Definition syms_elf_parser.c:485
SYMS_API SYMS_Arch syms_elf_arch_from_bin(SYMS_ElfBinAccel *bin)
Definition syms_elf_parser.c:491
SYMS_API SYMS_ElfSegmentArray syms_elf_segment_array_from_img_header(SYMS_Arena *arena, SYMS_String8 file, SYMS_ElfImgHeader img)
Definition syms_elf_parser.c:342
SYMS_API SYMS_SecInfoArray syms_elf_sec_info_array_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_ElfBinAccel *bin)
Definition syms_elf_parser.c:466
SYMS_API SYMS_ElfFileAccel * syms_elf_file_accel_from_data(SYMS_Arena *arena, SYMS_String8 string)
Definition syms_elf_parser.c:424
@ SYMS_FileFormat_ELF
Definition syms_meta_base.h:97
SYMS_Arch
Definition syms_meta_base.h:6
@ SYMS_Arch_PPC64
Definition syms_meta_base.h:12
@ SYMS_Arch_ARM
Definition syms_meta_base.h:10
@ SYMS_Arch_IA64
Definition syms_meta_base.h:14
@ SYMS_Arch_ARM32
Definition syms_meta_base.h:11
@ SYMS_Arch_X64
Definition syms_meta_base.h:8
@ SYMS_Arch_X86
Definition syms_meta_base.h:9
@ SYMS_Arch_Null
Definition syms_meta_base.h:7
@ SYMS_Arch_PPC
Definition syms_meta_base.h:13
@ SYMS_ElfSectionFlag_COMPRESSED
Definition syms_meta_elf.h:225
@ SYMS_ElfSectionFlag_ALLOC
Definition syms_meta_elf.h:216
@ SYMS_ElfMachineKind_IA_64
Definition syms_meta_elf.h:74
@ SYMS_ElfMachineKind_AARCH64
Definition syms_meta_elf.h:87
@ SYMS_ElfMachineKind_X86_64
Definition syms_meta_elf.h:86
@ SYMS_ElfMachineKind_PPC64
Definition syms_meta_elf.h:56
@ SYMS_ElfMachineKind_PPC
Definition syms_meta_elf.h:55
@ SYMS_ElfMachineKind_386
Definition syms_meta_elf.h:40
@ SYMS_ElfMachineKind_ARM
Definition syms_meta_elf.h:64
@ SYMS_ElfClass_32
Definition syms_meta_elf.h:9
@ SYMS_ElfClass_64
Definition syms_meta_elf.h:10
@ SYMS_ElfSectionCode_NOBITS
Definition syms_meta_elf.h:155
@ SYMS_ElfExternalVerFlag_BASE
Definition syms_meta_elf.h:514
@ SYMS_ElfSectionIndex_UNDEF
Definition syms_meta_elf.h:193
@ SYMS_ElfSectionIndex_LO_RESERVE
Definition syms_meta_elf.h:198
@ SYMS_ElfPKind_Load
Definition syms_meta_elf.h:115
@ SYMS_ElfSymBind_GLOBAL
Definition syms_meta_elf.h:381
@ SYMS_ElfSymBind_WEAK
Definition syms_meta_elf.h:383