Blame elf/tst-tls18.c

Packit 6c4009
#include <dlfcn.h>
Packit 6c4009
#include <stdlib.h>
Packit 6c4009
#include <stdio.h>
Packit 6c4009
Packit 6c4009
static int
Packit 6c4009
do_test (void)
Packit 6c4009
{
Packit 6c4009
  char modname[sizeof "tst-tlsmod18aXX.so"];
Packit 6c4009
  void *h[20];
Packit 6c4009
  for (int i = 0; i < 20; i++)
Packit 6c4009
    {
Packit 6c4009
      snprintf (modname, sizeof modname, "tst-tlsmod18a%d.so", i);
Packit 6c4009
      h[i] = dlopen (modname, RTLD_LAZY);
Packit 6c4009
      if (h[i] == NULL)
Packit 6c4009
	{
Packit 6c4009
	  printf ("unexpectedly failed to open %s", modname);
Packit 6c4009
	  exit (1);
Packit 6c4009
	}
Packit 6c4009
    }
Packit 6c4009
Packit 6c4009
  for (int i = 0; i < 20; i++)
Packit 6c4009
    {
Packit 6c4009
      int (*fp) (void) = (int (*) (void)) dlsym (h[i], "test");
Packit 6c4009
      if (fp == NULL)
Packit 6c4009
	{
Packit 6c4009
	  printf ("cannot find test in tst-tlsmod18a%d.so", i);
Packit 6c4009
	  exit (1);
Packit 6c4009
	}
Packit 6c4009
Packit 6c4009
      if (fp ())
Packit 6c4009
	exit (1);
Packit 6c4009
    }
Packit 6c4009
Packit 6c4009
  return 0;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
#include <support/test-driver.c>