diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2010-10-30 23:02:32 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2010-10-30 23:02:32 +0000 | 
| commit | b3cded65e92ba4d9b5e5a33fb95c4d551bda9c1b (patch) | |
| tree | 69d40fbef2c0c4ee32fe97b7a28b510f2e3c2dbc /ld/testsuite/ld-elf/dl1main.c | |
| parent | 7a815afd9b5121ee0f65dc1e1de1c0de6de97679 (diff) | |
Notes
Diffstat (limited to 'ld/testsuite/ld-elf/dl1main.c')
| -rw-r--r-- | ld/testsuite/ld-elf/dl1main.c | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/ld/testsuite/ld-elf/dl1main.c b/ld/testsuite/ld-elf/dl1main.c new file mode 100644 index 000000000000..f224e12394dd --- /dev/null +++ b/ld/testsuite/ld-elf/dl1main.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <dlfcn.h> + +int bar = -20; + +int  +main (void) +{ +  int ret = 0; +  void *handle; +  void (*fcn) (void); + +  handle = dlopen("./tmpdir/libdl1.so", RTLD_GLOBAL|RTLD_LAZY); +  if (!handle) +    { +      printf("dlopen ./tmpdir/libdl1.so: %s\n", dlerror ()); +      return 1; +    } + +  fcn = (void (*)(void)) dlsym(handle, "foo"); +  if (!fcn) +    { +      printf("dlsym foo: %s\n", dlerror ()); +      ret += 1; +    } +  else +    { +      (*fcn) (); +    } + +  dlclose (handle); +  return ret; +} | 
