Changeset c910709


Ignore:
Timestamp:
Feb 19, 2023, 5:41:53 PM (14 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
0bcd707, f883ef1
Parents:
3494ca9
Message:

remove use of _GNU_SOURCE and RTLD_NEXT to provide alternate means for interposing

Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/interpose.cfa

    r3494ca9 rc910709  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan  9 08:44:03 2023
    13 // Update Count     : 182
     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 );
     
    6657
    6758        if ( ! library ) {
    68                 #if defined( RTLD_NEXT )
    69                         library = RTLD_NEXT;
    70                 #else
    71                         // missing RTLD_NEXT => must hard-code library name, assuming libstdc++
    72                         library = dlopen( "libc.so.6", RTLD_LAZY );
    73                         const char * error = dlerror();
    74                         if ( error ) {
    75                                 abort( "interpose_symbol : failed to open libc, %s\n", error );
    76                         }
    77                 #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
    7864        } // if
    7965        if ( ! pthread_library ) {
    80                 #if defined( RTLD_NEXT )
    81                         pthread_library = RTLD_NEXT;
    82                 #else
    83                         // missing RTLD_NEXT => must hard-code library name, assuming libstdc++
    84                         pthread_library = dlopen( "libpthread.so", RTLD_LAZY );
    85                         const char * error = dlerror();
    86                         if ( error ) {
    87                                 abort( "interpose_symbol : failed to open libpthread, %s\n", error );
    88                         }
    89                 #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
    9071        } // if
    9172
  • libcfa/src/interpose_thread.cfa

    r3494ca9 rc910709  
    4141        static void * library;
    4242        if ( ! library ) {
    43                 #if defined( RTLD_NEXT )
    44                         library = RTLD_NEXT;
    45                 #else
    46                         // missing RTLD_NEXT => must hard-code library name, assuming libstdc++
    47                         library = dlopen( "libpthread.so", RTLD_LAZY );
    48                         const char * error = dlerror();
    49                         if ( error ) {
    50                                 abort( "interpose_symbol : failed to open libpthread, %s\n", error );
    51                         }
    52                 #endif
     43                library = dlopen( "libpthread.so", RTLD_LAZY );
     44                const char * error = dlerror();
     45                if ( error ) {
     46                        abort( "interpose_symbol : failed to open libpthread, %s\n", error );
     47                }
    5348        } // if
    5449
Note: See TracChangeset for help on using the changeset viewer.