Fix implib test failures
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / dl1main.c
CommitLineData
55255dae
L
1#include <stdio.h>
2#include <dlfcn.h>
3
4int bar = -20;
5
6int
7main (void)
8{
9 int ret = 0;
10 void *handle;
11 void (*fcn) (void);
12
13 handle = dlopen("./tmpdir/libdl1.so", RTLD_GLOBAL|RTLD_LAZY);
14 if (!handle)
15 {
f7a46012 16 printf("dlopen ./tmpdir/libdl1.so: %s\n", dlerror ());
55255dae
L
17 return 1;
18 }
19
20 fcn = (void (*)(void)) dlsym(handle, "foo");
21 if (!fcn)
22 {
23 printf("dlsym foo: %s\n", dlerror ());
24 ret += 1;
25 }
26 else
27 {
28 (*fcn) ();
29 }
30
31 dlclose (handle);
32 return ret;
33}
This page took 1.783065 seconds and 4 git commands to generate.