diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2017-03-17 11:05:56 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2017-03-17 11:05:56 +0300 |
commit | 0635b7714a1325587078077dbafe7a2f11689ddf (patch) | |
tree | d3dcda636dddf763ff2c34858a9fda8cc2c1e785 /dyn_load.c | |
parent | 3bfeb8a9830ec93ea1054764ebb41b7e1c007830 (diff) | |
download | bdwgc-0635b7714a1325587078077dbafe7a2f11689ddf.tar.gz |
Allow HAVE_DL_ITERATE_PHDR to be defined by client (musl)
Do not redefine HAVE_DL_ITERATE_PHDR macro if already defined.
* dyn_load.c [OPENBSD>=200519] (HAVE_DL_ITERATE_PHDR): Do not define
if already defined.
* dyn_load.c [!USE_PROC_FOR_LIBRARIES && (__GLIBC__>=2
|| PLATFORM_ANDROID)] (HAVE_DL_ITERATE_PHDR): Likewise.
* dyn_load.c [!USE_PROC_FOR_LIBRARIES && HAVE_DL_ITERATE_PHDR
&& !DL_ITERATE_PHDR_STRONG] (dl_iterate_phdr): Define as weak symbol
(even if HAVE_DL_ITERATE_PHDR is defined outside this file).
Diffstat (limited to 'dyn_load.c')
-rw-r--r-- | dyn_load.c | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -81,7 +81,7 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; #if defined(OPENBSD) # include <sys/param.h> -# if OpenBSD >= 200519 +# if (OpenBSD >= 200519) && !defined(HAVE_DL_ITERATE_PHDR) # define HAVE_DL_ITERATE_PHDR # endif #endif /* OPENBSD */ @@ -413,23 +413,28 @@ GC_INNER GC_bool GC_register_main_static_data(void) #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)) \ || defined(PLATFORM_ANDROID) /* Are others OK here, too? */ -/* We have the header files for a glibc that includes dl_iterate_phdr. */ -/* It may still not be available in the library on the target system. */ -/* Thus we also treat it as a weak symbol. */ -# define HAVE_DL_ITERATE_PHDR +# ifndef HAVE_DL_ITERATE_PHDR +# define HAVE_DL_ITERATE_PHDR +# endif # ifdef PLATFORM_ANDROID /* Android headers might have no such definition for some targets. */ int dl_iterate_phdr(int (*cb)(struct dl_phdr_info *, size_t, void *), void *data); # endif -# pragma weak dl_iterate_phdr -#endif +#endif /* __GLIBC__ >= 2 || PLATFORM_ANDROID */ #if (defined(FREEBSD) && __FreeBSD__ >= 7) /* On the FreeBSD system, any target system at major version 7 shall */ - /* have dl_iterate_phdr; therefore, we need not make it weak as above. */ -# define HAVE_DL_ITERATE_PHDR + /* have dl_iterate_phdr; therefore, we need not make it weak as below. */ +# ifndef HAVE_DL_ITERATE_PHDR +# define HAVE_DL_ITERATE_PHDR +# endif # define DL_ITERATE_PHDR_STRONG +#elif defined(HAVE_DL_ITERATE_PHDR) + /* We have the header files for a glibc that includes dl_iterate_phdr.*/ + /* It may still not be available in the library on the target system. */ + /* Thus we also treat it as a weak symbol. */ +# pragma weak dl_iterate_phdr #endif #if defined(HAVE_DL_ITERATE_PHDR) |