Ignore:
Timestamp:
Feb 21, 2023, 4:24:34 PM (3 years ago)
Author:
caparson <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
257a8f5, ce44c5f
Parents:
1180175 (diff), 9a533ba (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/interpose.cfa

    r1180175 r640b3df  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan  5 22:23:57 2023
    13 // Update Count     : 180
     12// Last Modified On : Sun Feb 19 17:09:16 2023
     13// Update Count     : 183
    1414//
    1515
     
    4545        union { generic_fptr_t fptr; void * ptr; } originalFunc;
    4646
    47         #if defined( _GNU_SOURCE )
    48                 if ( version ) {
    49                         originalFunc.ptr = dlvsym( library, symbol, version );
    50                 } else {
    51                         originalFunc.ptr = dlsym( library, symbol );
    52                 }
    53         #else
    54                 originalFunc.ptr = dlsym( library, symbol );
    55         #endif // _GNU_SOURCE
    56 
     47        originalFunc.ptr = dlsym( library, symbol );
    5748        error = dlerror();
    5849        if ( error ) abort( "interpose_symbol : internal error, %s\n", error );
     
    6253
    6354static generic_fptr_t interpose_symbol( const char symbol[], const char version[] ) {
    64         const char * error;
    65 
    6655        static void * library;
    6756        static void * pthread_library;
     57
    6858        if ( ! library ) {
    69                 #if defined( RTLD_NEXT )
    70                         library = RTLD_NEXT;
    71                 #else
    72                         // missing RTLD_NEXT => must hard-code library name, assuming libstdc++
    73                         library = dlopen( "libc.so.6", RTLD_LAZY );
    74                         error = dlerror();
    75                         if ( error ) {
    76                                 abort( "interpose_symbol : failed to open libc, %s\n", error );
    77                         }
    78                 #endif
     59                library = dlopen( "libc.so.6", RTLD_LAZY );
     60                const char * error = dlerror();
     61                if ( error ) {
     62                        abort( "interpose_symbol : failed to open libc, %s\n", error );
     63                } // if
    7964        } // if
    8065        if ( ! pthread_library ) {
    81                 #if defined( RTLD_NEXT )
    82                         pthread_library = RTLD_NEXT;
    83                 #else
    84                         // missing RTLD_NEXT => must hard-code library name, assuming libstdc++
    85                         pthread_library = dlopen( "libpthread.so", RTLD_LAZY );
    86                         error = dlerror();
    87                         if ( error ) {
    88                                 abort( "interpose_symbol : failed to open libpthread, %s\n", error );
    89                         }
    90                 #endif
     66                pthread_library = dlopen( "libpthread.so", RTLD_LAZY );
     67                const char * error = dlerror();
     68                if ( error ) {
     69                        abort( "interpose_symbol : failed to open libpthread, %s\n", error );
     70                } // if
    9171        } // if
    9272
Note: See TracChangeset for help on using the changeset viewer.