Detect ld.so and libc.so version inconsistency during startup
[glibc.git] / elf / libc-early-init.h
blobac8c204bc7b1fbfee2ea8a215f113cb53a4d494b
1 /* Early initialization of libc.so.
2 Copyright (C) 2020-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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 <https://www.gnu.org/licenses/>. */
19 #ifndef _LIBC_EARLY_INIT_H
20 #define _LIBC_EARLY_INIT_H
22 #include <libc_early_init_name.h>
24 struct link_map;
26 /* In the shared case, this function is defined in libc.so and invoked
27 from ld.so (or on the fist static dlopen) after complete relocation
28 of a new loaded libc.so, but before user-defined ELF constructors
29 run. In the static case, this function is called directly from the
30 startup code. If INITIAL is true, the libc being initialized is
31 the libc for the main program. INITIAL is false for libcs loaded
32 for audit modules, dlmopen, and static dlopen. */
33 void __libc_early_init (_Bool initial)
34 #ifdef SHARED
35 /* Redirect to the actual implementation name. */
36 __asm__ (LIBC_EARLY_INIT_NAME_STRING)
37 #endif
40 /* Attempts to find the appropriately named __libc_early_init function
41 in LIBC_MAP. On lookup failure, an exception is signaled,
42 indicating an ld.so/libc.so mismatch. */
43 __typeof (__libc_early_init) *_dl_lookup_libc_early_init (struct link_map *
44 libc_map)
45 attribute_hidden;
47 #endif /* _LIBC_EARLY_INIT_H */