[PATCH] Another dlclose testcase
Jakub Jelinek
jakub@redhat.com
Mon Jan 13 04:59:00 GMT 2003
On Thu, Jan 09, 2003 at 11:53:13AM +0100, Jakub Jelinek wrote:
> --- libc/elf/reldep9.c.jj 2003-01-09 13:04:10.000000000 +0100
> +++ libc/elf/reldep9.c 2003-01-09 12:51:27.000000000 +0100
> @@ -0,0 +1,16 @@
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <dlfcn.h>
> +
> +int
> +main (void)
> +{
> + void *handle = dlopen ("reldep9mod3.so", RTLD_LAZY);
> + if (handle == NULL)
> + {
> + printf ("%s\n", dlerror ());
> + exit (1);
> + }
> + dlclose (handle);
> + exit (1);
Note that in the end this exit (1) should be probably replaced with abort(),
so that it not only checks for correctness, but ensures that dlclose
unloads what it can. In this case all the l_opencount bumping of all the
reldep9mod{1,2,3}.so libraries was done only a) because of the dlopen
b) because of relocation dependencies in between those libraries.
This means that all 3 ilbraries should be surely unloadable at dlclose time.
Jakub
More information about the Libc-hacker
mailing list