1 /* Dummy audit library for test-audit-threads.
3 Copyright (C) 2018-2019 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
26 /* We must use a dummy LD_AUDIT module to force the dynamic loader to
27 *not* update the real PLT, and instead use a cached value for the
28 lazy resolution result. It is the update of that cached value that
29 we are testing for correctness by doing this. */
31 /* Library to be audited. */
32 #define LIB "tst-audit-threads-mod2.so"
33 /* CALLNUM is the number of retNum functions. */
36 #define CONCATX(a, b) __CONCAT (a, b)
38 static int previous
= 0;
41 la_version (unsigned int ver
)
47 la_objopen (struct link_map
*map
, Lmid_t lmid
, uintptr_t *cookie
)
49 return LA_FLG_BINDTO
| LA_FLG_BINDFROM
;
53 CONCATX(la_symbind
, __ELF_NATIVE_CLASS
) (ElfW(Sym
) *sym
,
60 const char * retnum
= "retNum";
61 char * num
= strstr (symname
, retnum
);
63 /* Validate if the symbols are getting called in the correct order.
64 This code is here to verify binutils does not optimize out the PLT
65 entries that require the symbol binding. */
69 assert (n
>= previous
);
70 assert (n
<= CALLNUM
);