Blame elf/tst-nodelete.cc

Packit 6c4009
#include "../dlfcn/dlfcn.h"
Packit 6c4009
#include <stdio.h>
Packit 6c4009
#include <stdlib.h>
Packit 6c4009
Packit 6c4009
static int
Packit 6c4009
do_test (void)
Packit 6c4009
{
Packit 6c4009
  int result = 0;
Packit 6c4009
Packit 6c4009
  /* This is a test for correct handling of dlopen failures for library that
Packit 6c4009
     is loaded with RTLD_NODELETE flag.  The first dlopen should fail because
Packit 6c4009
     of undefined symbols in shared library.  The second dlopen then verifies
Packit 6c4009
     that library was properly unloaded.  */
Packit 6c4009
  if (dlopen ("tst-nodelete-rtldmod.so", RTLD_NOW | RTLD_NODELETE) != NULL
Packit 6c4009
      || dlopen ("tst-nodelete-rtldmod.so", RTLD_LAZY | RTLD_NOLOAD) != NULL)
Packit 6c4009
    {
Packit 6c4009
      printf ("RTLD_NODELETE test failed\n");
Packit 6c4009
      result = 1;
Packit 6c4009
    }
Packit 6c4009
Packit 6c4009
  /* This is a test for correct handling of dlopen failures for library that
Packit 6c4009
     is linked with '-z nodelete' option and hence has DF_1_NODELETE flag.
Packit 6c4009
     The first dlopen should fail because of undefined symbols in shared
Packit 6c4009
     library.  The second dlopen then verifies that library was properly
Packit 6c4009
     unloaded.  */
Packit 6c4009
  if (dlopen ("tst-nodelete-zmod.so", RTLD_NOW) != NULL
Packit 6c4009
      || dlopen ("tst-nodelete-zmod.so", RTLD_LAZY | RTLD_NOLOAD) != NULL)
Packit 6c4009
    {
Packit 6c4009
      printf ("-z nodelete test failed\n");
Packit 6c4009
      result = 1;
Packit 6c4009
    }
Packit 6c4009
Packit 6c4009
   /* This is a test for correct handling of dlopen failures for library
Packit 6c4009
     with unique symbols.  The first dlopen should fail because of undefined
Packit 6c4009
     symbols in shared library.  The second dlopen then verifies that library
Packit 6c4009
     was properly unloaded.  */
Packit 6c4009
  if (dlopen ("tst-nodelete-uniquemod.so", RTLD_NOW) != NULL
Packit 6c4009
      || dlopen ("tst-nodelete-uniquemod.so", RTLD_LAZY | RTLD_NOLOAD) != NULL)
Packit 6c4009
    {
Packit 6c4009
      printf ("Unique symbols test failed\n");
Packit 6c4009
      result = 1;
Packit 6c4009
    }
Packit 6c4009
Packit 6c4009
  if (result == 0)
Packit 6c4009
    printf ("SUCCESS\n");
Packit 6c4009
Packit 6c4009
  return result;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
#include <support/test-driver.c>