|
Packit Service |
5ed93c |
/* Test unrelated dlopen after dlopen failure involving NODELETE.
|
|
Packit Service |
5ed93c |
Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
|
Packit Service |
5ed93c |
This file is part of the GNU C Library.
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
5ed93c |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
5ed93c |
License as published by the Free Software Foundation; either
|
|
Packit Service |
5ed93c |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
5ed93c |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
5ed93c |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
5ed93c |
Lesser General Public License for more details.
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
5ed93c |
License along with the GNU C Library; if not, see
|
|
Packit Service |
5ed93c |
<https://www.gnu.org/licenses/>. */
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
#include <dlfcn.h>
|
|
Packit Service |
5ed93c |
#include <errno.h>
|
|
Packit Service |
5ed93c |
#include <gnu/lib-names.h>
|
|
Packit Service |
5ed93c |
#include <stddef.h>
|
|
Packit Service |
5ed93c |
#include <stdio.h>
|
|
Packit Service |
5ed93c |
#include <string.h>
|
|
Packit Service |
5ed93c |
#include <support/check.h>
|
|
Packit Service |
5ed93c |
#include <support/xdlfcn.h>
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
static int
|
|
Packit Service |
5ed93c |
do_test (void)
|
|
Packit Service |
5ed93c |
{
|
|
Packit Service |
5ed93c |
/* This test uses libpthread as the canonical NODELETE module. If
|
|
Packit Service |
5ed93c |
libpthread is no longer NODELETE because it has been merged into
|
|
Packit Service |
5ed93c |
libc, the test needs to be updated. */
|
|
Packit Service |
5ed93c |
TEST_VERIFY (dlsym (NULL, "pthread_create") == NULL);
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
/* This is expected to fail because of the missing dependency. */
|
|
Packit Service |
5ed93c |
puts ("info: attempting to load tst-dlopenfailmod1.so");
|
|
Packit Service |
5ed93c |
TEST_VERIFY (dlopen ("tst-dlopenfailmod1.so", RTLD_LAZY) == NULL);
|
|
Packit Service |
5ed93c |
const char *message = dlerror ();
|
|
Packit Service |
5ed93c |
TEST_COMPARE_STRING (message,
|
|
Packit Service |
5ed93c |
"tst-dlopenfail-missingmod.so:"
|
|
Packit Service |
5ed93c |
" cannot open shared object file:"
|
|
Packit Service |
5ed93c |
" No such file or directory");
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
/* Open a small shared object. With a dangling GL (dl_initfirst)
|
|
Packit Service |
5ed93c |
pointer, this is likely to crash because there is no longer any
|
|
Packit Service |
5ed93c |
mapped text segment there (bug 25396). */
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
puts ("info: attempting to load tst-dlopenfailmod3.so");
|
|
Packit Service |
5ed93c |
xdlclose (xdlopen ("tst-dlopenfailmod3.so", RTLD_NOW));
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
return 0;
|
|
Packit Service |
5ed93c |
}
|
|
Packit Service |
5ed93c |
|
|
Packit Service |
5ed93c |
/* Do not perturb the dangling link map. With M_PERTURB, the link map
|
|
Packit Service |
5ed93c |
appears to have l_init_called set, so there are no constructor
|
|
Packit Service |
5ed93c |
calls and no crashes. */
|
|
Packit Service |
5ed93c |
#define TEST_NO_MALLOPT
|
|
Packit Service |
5ed93c |
#include <support/test-driver.c>
|