diff options
Diffstat (limited to 'elf/initfirst.c')
-rw-r--r-- | elf/initfirst.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/elf/initfirst.c b/elf/initfirst.c new file mode 100644 index 0000000000..5ca83d21bc --- /dev/null +++ b/elf/initfirst.c @@ -0,0 +1,22 @@ +#include <dlfcn.h> +#include <stdio.h> + +int +main (void) +{ + void *h = dlopen ("firstobj.so", RTLD_LAZY); + void *f; + if (! h) + { + printf ("cannot find firstobj.so: %s\n", dlerror ()); + return 1; + } + f = dlsym (h, "foo"); + if (! f) + { + printf ("cannot find symbol foo: %s\n", dlerror ()); + return 2; + } + ((void (*) (void)) f) (); + return 0; +} |