Changeset 67db067 for src/libcfa


Ignore:
Timestamp:
May 4, 2018, 5:22:07 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

clean up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/interpose.c

    r7c45c42 r67db067  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May  1 15:05:35 2018
    13 // Update Count     : 83
     12// Last Modified On : Fri May  4 14:35:13 2018
     13// Update Count     : 97
    1414//
    1515
    1616#include <stdarg.h>
    1717#include <stddef.h>
    18 
    19 extern "C" {
    2018#include <stdio.h>
    2119#include <string.h>
    22 #include <dlfcn.h>
    2320#include <unistd.h>
    2421#define __USE_GNU
    2522#include <signal.h>
    2623#undef __USE_GNU
     24extern "C" {
     25#include <dlfcn.h>
    2726#include <execinfo.h>
    2827}
     
    3736//=============================================================================================
    3837
    39 typedef void (*generic_fptr_t)(void);
    40 generic_fptr_t interpose_symbol( const char* symbol, const char *version ) {
     38typedef void (* generic_fptr_t)(void);
     39generic_fptr_t interpose_symbol( const char * symbol, const char * version ) {
    4140        const char * error;
    4241
     
    5554        } // if
    5655
    57         union { generic_fptr_t fptr; void* ptr; } originalFunc;
     56        union { generic_fptr_t fptr; void * ptr; } originalFunc;
    5857
    5958        #if defined( _GNU_SOURCE )
     
    7372}
    7473
    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
    9178//=============================================================================================
    9279
Note: See TracChangeset for help on using the changeset viewer.