1 extern int printf (const char *, ...); 2 3 extern int library_func1 (void); 4 extern int library_func2 (void); 5 extern int global; 6 7 int 8 main (void) 9 { 10 int res = -1; 11 12 res += library_func1 (); 13 res += library_func2 (); 14 15 switch (res) 16 { 17 case 0: 18 if (global) 19 printf ("ifunc working correctly\n"); 20 else 21 { 22 printf ("wrong value returned by library_func2\n"); 23 res = -1; 24 } 25 break; 26 27 case 1: 28 if (global) 29 printf ("wrong value returned by library_func2\n"); 30 else 31 { 32 printf ("ifunc working correctly\n"); 33 res = 0; 34 } 35 break; 36 37 case 4: 38 printf ("non-ifunc testcase\n"); 39 break; 40 41 default: 42 printf ("ifunc function not evaluated at run-time, res = %x\n", res); 43 break; 44 } 45 return res; 46 } 47