* fap-loader: load all code and data sections * fap-loader: relocate all code and data sections * fap-loader: remove old elf loader * fap-loader: new jmp call relocation * openocd: resume on detach * fap-loader: trampoline for big jumps * fap-loader: rename cache * fap-loader: init_array support * fap-loader: untangled flipper_application into separate entities * fap-loader: fix debug * fap-loader: optimize section container * fap-loader: optimize key for section container * fap-loader: disable debug log * documentation * F7: bump api symbols version * Lib: cleanup elf_file.c Co-authored-by: あく <alleteam@gmail.com>
		
			
				
	
	
		
			46 lines
		
	
	
		
			874 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			874 B
		
	
	
	
		
			C
		
	
	
	
	
	
#pragma once
 | 
						|
#include "elf_file.h"
 | 
						|
#include <m-dict.h>
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
DICT_DEF2(AddressCache, int, M_DEFAULT_OPLIST, Elf32_Addr, M_DEFAULT_OPLIST)
 | 
						|
 | 
						|
/**
 | 
						|
 * Callable elf entry type
 | 
						|
 */
 | 
						|
typedef int32_t(entry_t)(void*);
 | 
						|
 | 
						|
typedef struct {
 | 
						|
    void* data;
 | 
						|
    uint16_t sec_idx;
 | 
						|
    uint16_t rel_sec_idx;
 | 
						|
    Elf32_Word size;
 | 
						|
} ELFSection;
 | 
						|
 | 
						|
DICT_DEF2(ELFSectionDict, const char*, M_CSTR_OPLIST, ELFSection, M_POD_OPLIST)
 | 
						|
 | 
						|
struct ELFFile {
 | 
						|
    size_t sections_count;
 | 
						|
    off_t section_table;
 | 
						|
    off_t section_table_strings;
 | 
						|
 | 
						|
    size_t symbol_count;
 | 
						|
    off_t symbol_table;
 | 
						|
    off_t symbol_table_strings;
 | 
						|
    off_t entry;
 | 
						|
    ELFSectionDict_t sections;
 | 
						|
 | 
						|
    AddressCache_t relocation_cache;
 | 
						|
    AddressCache_t trampoline_cache;
 | 
						|
 | 
						|
    File* fd;
 | 
						|
    const ElfApiInterface* api_interface;
 | 
						|
    ELFDebugLinkInfo debug_link_info;
 | 
						|
};
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif |