Changeset 4809


Ignore:
Timestamp:
Apr 17, 2012, 1:02:42 AM (8 years ago)
Author:
Sam Hocevar
Message:

Fix a weird problem with lib6 versioned symbols.

Location:
zzuf/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/configure.ac

    r4683 r4809  
    179179AC_DEFINE_UNQUOTED(ATTRIBUTE_PRINTF(x,y), $ac_v_attribute_printf, [Define to the __printf__ attribute if present])
    180180
     181AC_CHECK_LIB(dl, dladdr,
     182 [AC_DEFINE(HAVE_DLADDR, 1, Define to 1 if you have the `dladdr' function.)])
     183
    181184AC_CHECK_LIB(m, log, [MATH_LIBS="-lm"])
    182185AC_SUBST(MATH_LIBS)
  • zzuf/trunk/msvc/config.h

    r4683 r4809  
    2929#define HAVE_CREATEFILEA 1
    3030#define HAVE_CREATEFILEW 1
     31/* #undef HAVE_DLADDR */
    3132/* #undef HAVE_DLFCN_H */
    3233#define HAVE_DUP 1
  • zzuf/trunk/src/libzzuf/lib-fd.c

    r4375 r4809  
    2121#include "config.h"
    2222
    23 /* Need this for RTLD_NEXT */
    24 #define _GNU_SOURCE
    2523/* Use this to get lseek64() on glibc systems */
    2624#define _LARGEFILE64_SOURCE
  • zzuf/trunk/src/libzzuf/lib-load.h

    r4672 r4809  
    3030                 * the linker to load us fully. */ \
    3131                _zz_init(); \
    32                 ORIG(x) = dlsym(RTLD_NEXT, STR(x)); \
     32                extern void *_zz_dl_lib; \
     33                ORIG(x) = dlsym(_zz_dl_lib, STR(x)); \
    3334            } \
    3435            if(!ORIG(x)) \
  • zzuf/trunk/src/libzzuf/lib-mem.c

    r4373 r4809  
    1717#include "config.h"
    1818
    19 /* Need this for RTLD_NEXT */
     19/* Need this for off64_t */
    2020#define _GNU_SOURCE
    2121/* Need this for MAP_ANON and valloc() on FreeBSD (together with cdefs.h) */
  • zzuf/trunk/src/libzzuf/sys.c

    r4672 r4809  
    1717#include "config.h"
    1818
     19/* Need this for RTLD_NEXT */
     20#define _GNU_SOURCE
     21
    1922#if defined HAVE_STDINT_H
    2023#   include <stdint.h>
    2124#elif defined HAVE_INTTYPES_H
    2225#   include <inttypes.h>
     26#endif
     27
     28#ifdef HAVE_DLFCN_H
     29#   include <dlfcn.h>
    2330#endif
    2431
     
    3542#include "sys.h"
    3643#include "lib-load.h"
     44
     45#if defined HAVE_DLFCN_H
     46void *_zz_dl_lib = RTLD_NEXT;
     47#endif
    3748
    3849#if defined HAVE_WINDOWS_H
     
    7889    }
    7990    CloseHandle(list);
     91#elif defined HAVE_DLFCN_H
     92    /* If glibc is recent enough, we use dladdr() to get its address. This
     93     * way we are sure that the symbols we load are the most recent version,
     94     * or we may get weird problems. We choose fileno as a random symbol to
     95     * get, because we know we don't divert it. */
     96#   if HAVE_DLADDR
     97    Dl_info di;
     98    if (dladdr(&fileno, &di) != 0)
     99    {
     100        void *lib = dlopen(di.dli_fname, RTLD_NOW);
     101        if (lib)
     102            _zz_dl_lib = lib;
     103    }
     104#   endif
    80105#else
    81106    /* Nothing to do on our platform */
Note: See TracChangeset for help on using the changeset viewer.