]>
Commit | Line | Data |
---|---|---|
a2b08ee5 | 1 | /* Locate the shared object symbol nearest a given address. |
b168057a | 2 | Copyright (C) 1996-2015 Free Software Foundation, Inc. |
afd4eb37 | 3 | This file is part of the GNU C Library. |
a2b934be | 4 | |
afd4eb37 | 5 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
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. | |
a2b934be | 9 | |
afd4eb37 UD |
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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
a2b934be | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
a2b934be | 18 | |
a2b934be | 19 | #include <dlfcn.h> |
a2b934be | 20 | |
9b42a0b3 | 21 | #if !defined SHARED && IS_IN (libdl) |
5f21997b | 22 | |
a2b934be | 23 | int |
a2b08ee5 | 24 | dladdr (const void *address, Dl_info *info) |
a2b934be | 25 | { |
5f21997b UD |
26 | return __dladdr (address, info); |
27 | } | |
28 | ||
29 | #else | |
30 | ||
31 | int | |
32 | __dladdr (const void *address, Dl_info *info) | |
33 | { | |
34 | # ifdef SHARED | |
a1ffb40e | 35 | if (__glibc_unlikely (_dlfcn_hook != NULL)) |
5f21997b UD |
36 | return _dlfcn_hook->dladdr (address, info); |
37 | # endif | |
8dd56993 | 38 | return _dl_addr (address, info, NULL, NULL); |
a2b934be | 39 | } |
5f21997b UD |
40 | # ifdef SHARED |
41 | strong_alias (__dladdr, dladdr) | |
42 | # endif | |
43 | #endif |