diff --git a/src/rvprof_symbols.c b/src/rvprof_symbols.c new file mode 100644 index 0000000..a597c35 --- /dev/null +++ b/src/rvprof_symbols.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include +#include +#include "rvprof_internal.h" + +// thread-local storage for function names +__thread char g_tmp_func_name[128]; + +// base offset for PIE +static uintptr_t g_base_address_offset = 0; +static int g_base_address_calculated = 0; + + +// base address calculatiion +static void calculate_base_address(void* known_runtime_addr, uintptr_t known_elf_addr){ + if (g_base_address_calculated) return; + + uintptr_t runtime_addr = (uintptr_t)known_runtime_addr; + if (runtime_addr > known_elf_addr){ + g_base_address_offset = runtime_addr - known_elf_addr; + } + g_base_address_calculated = 1; +} + +// compare function for symbol table quicksort +// TODO \ No newline at end of file