Fix: Null pointer dereference in ldlex.l
[binutils-gdb.git] / gdb / testsuite / gdb.base / jit-elf-dlmain.c
blob03b8d3cc284a570941b4651b4d4acd48d680cee1
1 #include <dlfcn.h>
2 #include <stdio.h>
4 int main (int argc, char *argv[])
6 /* jit_libname is updated by jit-so.exp */
7 const char *jit_libname = "jit-dlmain-so.so";
8 void *h;
9 int (*p_main) (int, char **);
11 h = NULL; /* break here before-dlopen */
12 h = dlopen (jit_libname, RTLD_LAZY);
13 if (h == NULL) return 1;
15 p_main = dlsym (h, "jit_dl_main");
16 if (p_main == NULL) return 2;
18 h = h; /* break here after-dlopen */
19 return (*p_main) (argc, argv);