diff options
Diffstat (limited to 'binutils-2.21/gold')
-rw-r--r-- | binutils-2.21/gold/Makefile.am | 2 | ||||
-rw-r--r-- | binutils-2.21/gold/Makefile.in | 3 | ||||
-rw-r--r-- | binutils-2.21/gold/config.in | 6 | ||||
-rwxr-xr-x | binutils-2.21/gold/configure | 30 | ||||
-rw-r--r-- | binutils-2.21/gold/configure.ac | 7 | ||||
-rw-r--r-- | binutils-2.21/gold/plugin.cc | 30 | ||||
-rw-r--r-- | binutils-2.21/gold/testsuite/Makefile.in | 3 |
7 files changed, 79 insertions, 2 deletions
diff --git a/binutils-2.21/gold/Makefile.am b/binutils-2.21/gold/Makefile.am index c1c3588..a8daef6 100644 --- a/binutils-2.21/gold/Makefile.am +++ b/binutils-2.21/gold/Makefile.am @@ -20,7 +20,7 @@ AM_CPPFLAGS = \ LIBIBERTY = ../libiberty/libiberty.a if PLUGINS -LIBDL = -ldl +LIBDL = @DLOPEN_LIBS@ endif if THREADS diff --git a/binutils-2.21/gold/Makefile.in b/binutils-2.21/gold/Makefile.in index aad0f3a..63369ea 100644 --- a/binutils-2.21/gold/Makefile.in +++ b/binutils-2.21/gold/Makefile.in @@ -246,6 +246,7 @@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLOPEN_LIBS = @DLOPEN_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -371,7 +372,7 @@ AM_CPPFLAGS = \ @INCINTL@ LIBIBERTY = ../libiberty/libiberty.a -@PLUGINS_TRUE@LIBDL = -ldl +@PLUGINS_TRUE@LIBDL = @DLOPEN_LIBS@ @THREADS_TRUE@THREADSLIB = -lpthread AM_YFLAGS = -d diff --git a/binutils-2.21/gold/config.in b/binutils-2.21/gold/config.in index 8611376..c96189d 100644 --- a/binutils-2.21/gold/config.in +++ b/binutils-2.21/gold/config.in @@ -66,6 +66,9 @@ don't. */ #undef HAVE_DECL_VSNPRINTF +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + /* Define to 1 if you have the <ext/hash_map> header file. */ #undef HAVE_EXT_HASH_MAP @@ -162,6 +165,9 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the <windows.h> header file. */ +#undef HAVE_WINDOWS_H + /* Define to 1 if you have the <zlib.h> header file. */ #undef HAVE_ZLIB_H diff --git a/binutils-2.21/gold/configure b/binutils-2.21/gold/configure index 56a6116..ec510d2 100755 --- a/binutils-2.21/gold/configure +++ b/binutils-2.21/gold/configure @@ -594,6 +594,7 @@ LTLIBOBJS MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +DLOPEN_LIBS CXXCPP HAVE_ZLIB_FALSE HAVE_ZLIB_TRUE @@ -6941,6 +6942,35 @@ fi done + +for ac_header in windows.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" +if test "x$ac_cv_header_windows_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WINDOWS_H 1 +_ACEOF + +fi + +done + +for ac_header in dlfcn.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" +if test "x$ac_cv_header_dlfcn_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + DLOPEN_LIBS="-ldl" +else + DLOPEN_LIBS="" +fi + +done + + + for ac_func in mallinfo posix_fallocate readv sysconf times do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` diff --git a/binutils-2.21/gold/configure.ac b/binutils-2.21/gold/configure.ac index 1bceb1e..41d3552 100644 --- a/binutils-2.21/gold/configure.ac +++ b/binutils-2.21/gold/configure.ac @@ -445,6 +445,13 @@ AC_LANG_PUSH(C++) AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map) AC_CHECK_HEADERS(ext/hash_map ext/hash_set) AC_CHECK_HEADERS(byteswap.h) + +dnl When plugins enabled dynamic loader interface is required. Check headers +dnl which may provide this interface. In case of dlfcn.h add libdl to link. +AC_CHECK_HEADERS(windows.h) +AC_CHECK_HEADERS(dlfcn.h, [DLOPEN_LIBS="-ldl"], [DLOPEN_LIBS=""]) +AC_SUBST(DLOPEN_LIBS) + AC_CHECK_FUNCS(mallinfo posix_fallocate readv sysconf times) AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem]) diff --git a/binutils-2.21/gold/plugin.cc b/binutils-2.21/gold/plugin.cc index 8ce152c..aab0410 100644 --- a/binutils-2.21/gold/plugin.cc +++ b/binutils-2.21/gold/plugin.cc @@ -29,9 +29,39 @@ #include <vector> #ifdef ENABLE_PLUGINS +#ifdef HAVE_DLFCN_H #include <dlfcn.h> +#elif defined (HAVE_WINDOWS_H) +#include <windows.h> +#else +#error Unknown how to handle dynamic-load-libraries. #endif +#if !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H) + +#define RTLD_NOW 0 /* Dummy value. */ +static void * +dlopen(const char *file, int mode ATTRIBUTE_UNUSED) +{ + return LoadLibrary(file); +} + +static void * +dlsym(void *handle, const char *name) +{ + return reinterpret_cast<void *>( + GetProcAddress(static_cast<HMODULE>(handle),name)); +} + +static const char * +dlerror(void) +{ + return "unable to load dll"; +} + +#endif /* !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H) */ +#endif /* ENABLE_PLUGINS */ + #include "parameters.h" #include "errors.h" #include "fileread.h" diff --git a/binutils-2.21/gold/testsuite/Makefile.in b/binutils-2.21/gold/testsuite/Makefile.in index 4b1cd54..77d4351 100644 --- a/binutils-2.21/gold/testsuite/Makefile.in +++ b/binutils-2.21/gold/testsuite/Makefile.in @@ -1750,6 +1750,7 @@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLOPEN_LIBS = @DLOPEN_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -1757,6 +1758,8 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GENCAT = @GENCAT@ GMSGFMT = @GMSGFMT@ +GOLD_LDADD = @GOLD_LDADD@ +GOLD_LDFLAGS = @GOLD_LDFLAGS@ GREP = @GREP@ INCINTL = @INCINTL@ INSTALL = @INSTALL@ |