Replace FSF snail mail address with URLs.
[glibc.git] / sysdeps / unix / sysv / linux / powerpc / powerpc64 / ldsodefs.h
blob14a97f36c494f3ad99ef4b428bafe67d7190a635
1 /* Run-time dynamic linker data structures for loaded ELF shared objects.
2 Copyright (C) 2005, 2006 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 <http://www.gnu.org/licenses/>. */
19 #ifndef _LDSODEFS_H
21 /* Get the real definitions. */
22 #include_next <ldsodefs.h>
24 /* Now define our stuff. */
26 static __always_inline bool
27 _dl_ppc64_is_opd_sym (const struct link_map *l, const ElfW(Sym) *sym)
29 return (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
30 && l->l_addr + sym->st_value >= (ElfW(Addr)) l->l_ld
31 && l->l_addr + sym->st_value < l->l_map_end
32 && sym->st_size != 0);
35 static __always_inline bool
36 _dl_ppc64_addr_sym_match (const struct link_map *l, const ElfW(Sym) *sym,
37 const ElfW(Sym) *matchsym, ElfW(Addr) addr)
39 ElfW(Addr) value = l->l_addr + sym->st_value;
40 if (_dl_ppc64_is_opd_sym (l, sym))
42 if (addr < value || addr >= value + 24)
44 value = *(ElfW(Addr) *) value;
45 if (addr < value || addr >= value + sym->st_size)
46 return false;
49 else if (sym->st_shndx == SHN_UNDEF || sym->st_size == 0)
51 if (addr != value)
52 return false;
54 else if (addr < value || addr >= value + sym->st_size)
55 return false;
57 if (matchsym == NULL)
58 return true;
60 ElfW(Addr) matchvalue = l->l_addr + matchsym->st_value;
61 if (_dl_ppc64_is_opd_sym (l, matchsym)
62 && (addr < matchvalue || addr > matchvalue + 24))
63 matchvalue = *(ElfW(Addr) *) matchvalue;
65 return matchvalue < value;
68 /* If this is a function symbol defined past the end of our dynamic
69 section, then it must be a function descriptor. Allow these symbols
70 to match their associated function code range as well as the
71 descriptor addresses. */
72 #undef DL_ADDR_SYM_MATCH
73 #define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \
74 _dl_ppc64_addr_sym_match (L, SYM, MATCHSYM, ADDR)
76 #endif /* ldsodefs.h */