initial commit
[glibc.git] / sysdeps / mips / elf_machine_sym_no_match.h
1 /* MIPS-specific handling of undefined symbols.
2 Copyright (C) 2008-2022 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 <https://www.gnu.org/licenses/>. */
18
19 #ifndef _ELF_MACHINE_SYM_NO_MATCH_H
20 #define _ELF_MACHINE_SYM_NO_MATCH_H
21
22 #include <link.h>
23 #include <stdbool.h>
24
25 /* The semantics of zero/non-zero values of undefined symbols differs
26 depending on whether the non-PIC ABI is in use. Under the non-PIC
27 ABI, a non-zero value indicates that there is an address reference
28 to the symbol and thus it must always be resolved (except when
29 resolving a jump slot relocation) to the PLT entry whose address is
30 provided as the symbol's value; a zero value indicates that this
31 canonical-address behaviour is not required. Yet under the classic
32 MIPS psABI, a zero value indicates that there is an address
33 reference to the function and the dynamic linker must resolve the
34 symbol immediately upon loading. To avoid conflict, symbols for
35 which the dynamic linker must assume the non-PIC ABI semantics are
36 marked with the STO_MIPS_PLT flag. */
37 static inline bool
38 elf_machine_sym_no_match (const ElfW(Sym) *sym)
39 {
40 return sym->st_shndx == SHN_UNDEF && !(sym->st_other & STO_MIPS_PLT);
41 }
42
43 #endif /* _ELF_MACHINE_SYM_NO_MATCH_H */