Blame elf/tst-nodelete2.c

Packit 6c4009
#include "../dlfcn/dlfcn.h"
Packit 6c4009
#include <stdio.h>
Packit 6c4009
#include <stdlib.h>
Packit 6c4009
#include <gnu/lib-names.h>
Packit 6c4009
Packit 6c4009
static int
Packit 6c4009
do_test (void)
Packit 6c4009
{
Packit 6c4009
  int result = 0;
Packit 6c4009
Packit 6c4009
  printf ("\nOpening pthread library.\n");
Packit 6c4009
  void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY);
Packit 6c4009
Packit 6c4009
  /* This is a test for correct DF_1_NODELETE clearing when dlopen failure
Packit 6c4009
     happens.  We should clear DF_1_NODELETE for failed library only, because
Packit 6c4009
     doing this for others (e.g. libpthread) might cause them to be unloaded,
Packit 6c4009
     that may lead to some global references (e.g. __rtld_lock_unlock) to be
Packit 6c4009
     broken.  The dlopen should fail because of undefined symbols in shared
Packit 6c4009
     library, that cause DF_1_NODELETE to be cleared.  For libpthread, this
Packit 6c4009
     flag should be set, because if not, SIGSEGV will happen in dlclose.  */
Packit 6c4009
  if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL)
Packit 6c4009
    {
Packit 6c4009
      printf ("Unique symbols test failed\n");
Packit 6c4009
      result = 1;
Packit 6c4009
    }
Packit 6c4009
Packit 6c4009
  if (pthread)
Packit 6c4009
    dlclose (pthread);
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>