Changeset 67db067
- Timestamp:
- May 4, 2018, 5:22:07 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- c02f761
- Parents:
- 7c45c42
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/interpose.c
r7c45c42 r67db067 10 10 // Created On : Wed Mar 29 16:10:31 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 1 15:05:35201813 // Update Count : 8312 // Last Modified On : Fri May 4 14:35:13 2018 13 // Update Count : 97 14 14 // 15 15 16 16 #include <stdarg.h> 17 17 #include <stddef.h> 18 19 extern "C" {20 18 #include <stdio.h> 21 19 #include <string.h> 22 #include <dlfcn.h>23 20 #include <unistd.h> 24 21 #define __USE_GNU 25 22 #include <signal.h> 26 23 #undef __USE_GNU 24 extern "C" { 25 #include <dlfcn.h> 27 26 #include <execinfo.h> 28 27 } … … 37 36 //============================================================================================= 38 37 39 typedef void (* generic_fptr_t)(void);40 generic_fptr_t interpose_symbol( const char * symbol, const char *version ) {38 typedef void (* generic_fptr_t)(void); 39 generic_fptr_t interpose_symbol( const char * symbol, const char * version ) { 41 40 const char * error; 42 41 … … 55 54 } // if 56 55 57 union { generic_fptr_t fptr; void * ptr; } originalFunc;56 union { generic_fptr_t fptr; void * ptr; } originalFunc; 58 57 59 58 #if defined( _GNU_SOURCE ) … … 73 72 } 74 73 75 forall(dtype T) 76 static inline void ptr_from_symbol( T** symbol_ptr, const char * symbol_name, const char * version) { 77 union { 78 generic_fptr_t gp; 79 T* tp; 80 } u; 81 82 u.gp = interpose_symbol( symbol_name, version ); 83 84 *symbol_ptr = u.tp; 85 } 86 87 #define INTERPOSE_LIBC( x, ver ) ptr_from_symbol( (void**)&__cabi_libc.x, #x, ver) 88 89 //============================================================================================= 90 // Terminating Signals logic 74 #define INTERPOSE_LIBC( x, ver ) __cabi_libc.x = (typeof(__cabi_libc.x))interpose_symbol( #x, ver ) 75 76 //============================================================================================= 77 // Interposition Startup logic 91 78 //============================================================================================= 92 79
Note: See TracChangeset
for help on using the changeset viewer.