Mercurial > pub > dyncall > dyncall
comparison dynload/dynload_syms_mach-o.c @ 645:6a8aac9b2bcf
- removal of `autovar` macro detection lib:
* was a good idea, but never fully pushed through, so code was duplicating most of dyncall_macros.h
* didn't find any outside use and plans to make it a standalone lib never materialized
* so basically removing code to avoid code duplication that risks to never stay in sync
author | Tassilo Philipp |
---|---|
date | Mon, 05 Feb 2024 16:43:59 +0100 |
parents | 61c485f8cc06 |
children |
comparison
equal
deleted
inserted
replaced
644:f13444192ceb | 645:6a8aac9b2bcf |
---|---|
32 | 32 |
33 */ | 33 */ |
34 | 34 |
35 #include "dynload.h" | 35 #include "dynload.h" |
36 #include "dynload_alloc.h" | 36 #include "dynload_alloc.h" |
37 #include "../autovar/autovar_ARCH.h" | 37 #include "../dyncall/dyncall_macros.h" |
38 #include "../autovar/autovar_OS.h" | |
39 | 38 |
40 #include <mach-o/dyld.h> | 39 #include <mach-o/dyld.h> |
41 #include <mach-o/nlist.h> | 40 #include <mach-o/nlist.h> |
42 #include <dlfcn.h> | 41 #include <dlfcn.h> |
43 #include <string.h> | 42 #include <string.h> |
44 | 43 |
45 #if defined(ARCH_X64) || defined(ARCH_PPC64) || defined(ARCH_ARM64) /*@@@ use dyncall_macros.h*/ | 44 #if defined(DC__Arch_AMD64) || defined(DC__Arch_PPC64) || defined(DC__Arch_ARM64) |
46 #define MACH_HEADER_TYPE mach_header_64 | 45 #define MACH_HEADER_TYPE mach_header_64 |
47 #define MACH_HEADER_MAGIC_NR MH_MAGIC_64 | 46 #define MACH_HEADER_MAGIC_NR MH_MAGIC_64 |
48 #define SEGMEND_COMMAND_ID LC_SEGMENT_64 | 47 #define SEGMEND_COMMAND_ID LC_SEGMENT_64 |
49 #define SEGMENT_COMMAND segment_command_64 | 48 #define SEGMENT_COMMAND segment_command_64 |
50 #define NLIST_TYPE nlist_64 | 49 #define NLIST_TYPE nlist_64 |
226 | 225 |
227 /*TODO skip more symbols based on nl->n_desc and nl->n_type ? */ | 226 /*TODO skip more symbols based on nl->n_desc and nl->n_type ? */ |
228 | 227 |
229 /* Return name - handles lookup of indirect names. */ | 228 /* Return name - handles lookup of indirect names. */ |
230 return &pSyms->pStringTable[(t == N_INDR ? nl->n_value : nl->n_un.n_strx) | 229 return &pSyms->pStringTable[(t == N_INDR ? nl->n_value : nl->n_un.n_strx) |
231 #if defined(OS_Darwin) | 230 #if defined(DC__OS_Darwin) |
232 + 1 /* Skip '_'-prefix */ | 231 + 1 /* Skip '_'-prefix */ |
233 #endif | 232 #endif |
234 ]; | 233 ]; |
235 #endif | 234 #endif |
236 } | 235 } |