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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 /* Get the real definitions. */
23 #include_next <ldsodefs.h>
25 /* Now define our stuff. */
27 static __always_inline
bool
28 _dl_ppc64_is_opd_sym (const struct link_map
*l
, const ElfW(Sym
) *sym
)
30 return (ELFW(ST_TYPE
) (sym
->st_info
) == STT_FUNC
31 && l
->l_addr
+ sym
->st_value
>= (ElfW(Addr
)) l
->l_ld
32 && l
->l_addr
+ sym
->st_value
< l
->l_map_end
33 && sym
->st_size
!= 0);
36 static __always_inline
bool
37 _dl_ppc64_addr_sym_match (const struct link_map
*l
, const ElfW(Sym
) *sym
,
38 const ElfW(Sym
) *matchsym
, ElfW(Addr
) addr
)
40 ElfW(Addr
) value
= l
->l_addr
+ sym
->st_value
;
41 if (_dl_ppc64_is_opd_sym (l
, sym
))
43 if (addr
< value
|| addr
>= value
+ 24)
45 value
= *(ElfW(Addr
) *) value
;
46 if (addr
< value
|| addr
>= value
+ sym
->st_size
)
50 else if (sym
->st_shndx
== SHN_UNDEF
|| sym
->st_size
== 0)
55 else if (addr
< value
|| addr
>= value
+ sym
->st_size
)
61 ElfW(Addr
) matchvalue
= l
->l_addr
+ matchsym
->st_value
;
62 if (_dl_ppc64_is_opd_sym (l
, matchsym
)
63 && (addr
< matchvalue
|| addr
> matchvalue
+ 24))
64 matchvalue
= *(ElfW(Addr
) *) matchvalue
;
66 return matchvalue
< value
;
69 /* If this is a function symbol defined past the end of our dynamic
70 section, then it must be a function descriptor. Allow these symbols
71 to match their associated function code range as well as the
72 descriptor addresses. */
73 #undef DL_ADDR_SYM_MATCH
74 #define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \
75 _dl_ppc64_addr_sym_match (L, SYM, MATCHSYM, ADDR)
77 #endif /* ldsodefs.h */