-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added somewhat working dynamic lib/.so file loading
- Loading branch information
1 parent
175b611
commit d44e6a7
Showing
6 changed files
with
335 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef __FDLFCN_H_ | ||
#define __FDLFCN_H_ 1 | ||
|
||
#include <elf.h> | ||
|
||
typedef struct | ||
{ | ||
void* address; | ||
Elf64_Ehdr ehdr; | ||
Elf64_Shdr* shdrs; | ||
Elf64_Sym* symbols; | ||
Elf64_Rela* relocations; | ||
|
||
int symtab_index; | ||
void* text_section_data; | ||
void* data_section_data; | ||
void* rodata_section_data; | ||
|
||
Elf64_Shdr* text_section_header; | ||
Elf64_Shdr* data_section_header; | ||
Elf64_Shdr* rodata_section_header; | ||
} fdlfcn_handle; | ||
|
||
// immediately load sections into memory | ||
#define FDL_IMMEDIATE 0 | ||
|
||
fdlfcn_handle* fdlopen(void* filedata, int flags); | ||
void* fdlsym(fdlfcn_handle* handle, const char* symbol_name); | ||
int fdlclose(fdlfcn_handle* handle); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.