kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

09_ifunc.c (397B)


      1 /* Exercises STT_GNU_IFUNC: a function whose implementation is selected
      2  * by a runtime resolver.  The symbol must survive the roundtrip with
      3  * type=IFUNC and the resolver name preserved in the relocation. */
      4 
      5 static int impl_a(void) { return 42; }
      6 
      7 static void* resolve(void) { return impl_a; }
      8 
      9 int ifunc_fn(void) __attribute__((ifunc("resolve")));
     10 
     11 int call_ifunc(void) { return ifunc_fn(); }