]> git.ipfire.org Git - thirdparty/glibc.git/blob - elf/tst-sonamemove-link.c
Fix bad pointer / leak in regex code
[thirdparty/glibc.git] / elf / tst-sonamemove-link.c
1 /* Check that a versioned symbol can move from one library to another.
2 Copyright (C) 2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19 /* At link time, moved_function is bound to the symbol version
20 SONAME_MOVE in tst-sonamemove-runmod1.so, using the
21 tst-sonamemove-linkmod1.so stub object.
22
23 At run time, the process loads the real tst-sonamemove-runmod1.so,
24 which depends on tst-sonamemove-runmod2.so.
25 tst-sonamemove-runmod1.so does not define moved_function, but
26 tst-sonamemove-runmod2.so does.
27
28 The net effect is that the versioned symbol
29 moved_function@SONAME_MOVE moved from the soname
30 tst-sonamemove-linkmod1.so at link time to the soname
31 tst-sonamemove-linkmod2.so at run time. */
32 void moved_function (void);
33
34 static int
35 do_test (void)
36 {
37 moved_function ();
38 return 0;
39 }
40
41 #include <support/test-driver.c>