1 #include <stdio.h> 2 3 4 extern int successful_rtld_next_test (void); 5 extern void *failing_rtld_next_use (void); 6 7 8 static int do_test(void)9do_test (void) 10 { 11 int result; 12 void *addr; 13 14 /* First try call a function which uses RTLD_NEXT and calls that 15 function. */ 16 result = successful_rtld_next_test (); 17 if (result == 42) 18 { 19 puts ("RTLD_NEXT seems to work for existing functions"); 20 result = 0; 21 } 22 else 23 { 24 printf ("Heh? `successful_rtld_next_test' returned %d\n", result); 25 result = 1; 26 } 27 28 /* Next try a function which tries to get a function with RTLD_NEXT 29 but that fails. This dlsym() call should return a NULL pointer 30 and do nothing else. */ 31 addr = failing_rtld_next_use (); 32 if (addr == NULL) 33 puts ("dlsym returned NULL for non-existing function. Good"); 34 else 35 { 36 puts ("dlsym found something !?"); 37 result = 1; 38 } 39 40 return result; 41 } 42 43 #include <support/test-driver.c> 44