1 /* Make sure dlopen/dlclose are not marked as leaf functions.
3 Copyright (C) 2013-2014 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Mike Frysinger <vapier@gentoo.org>
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
21 /* The bug-dl-leaf.c file will call our lib_main directly. We do this to
22 keep things simple -- no need to use --export-dynamic with the linker
23 or build the main ELF as a PIE.
25 The lib_main func will modify some of its state while dlopening and
26 dlclosing the bug-dl-leaf-lib-cb.so library. The constructors and
27 destructors in that library will call back into this library to also
28 muck with state (the check_val_xxx funcs).
30 If dlclose/dlopen are marked as "leaf" functions, then with newer
31 versions of gcc, the state modification won't work correctly. */
37 static int called
= 0;
39 void check_val_init (void)
45 void check_val_fini (void)
56 /* Make sure the constructor sees the updated val. */
58 hdl
= dlopen ("bug-dl-leaf-lib-cb.so", RTLD_GLOBAL
| RTLD_LAZY
);
63 /* Make sure the destructor sees the updated val. */