]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix mingw gold build with plugins enabled
authorIan Lance Taylor <ian@airs.com>
Fri, 11 Jan 2013 14:36:36 +0000 (14:36 +0000)
committerIan Lance Taylor <ian@airs.com>
Fri, 11 Jan 2013 14:36:36 +0000 (14:36 +0000)
* Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
* configure.ac: Export DLOPEN_LIBS and add headers check.
* plugin.cc: Handle non-dlfcn case.
* Makefile.in: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* testsuite/Makefile.in: Regenerate.

gold/ChangeLog
gold/Makefile.am
gold/Makefile.in
gold/config.in
gold/configure
gold/configure.ac
gold/plugin.cc
gold/testsuite/Makefile.in

index 72271fa3ea15d4933af73dbe306d5d118fa67a68..916250d26c048483de7e4a5485bf1075a1638928 100644 (file)
@@ -1,3 +1,14 @@
+2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
+
+       Fix mingw gold build with plugins enabled
+       * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
+       * configure.ac: Export DLOPEN_LIBS and add headers check.
+       * plugin.cc: Handle non-dlfcn case.
+       * Makefile.in: Regenerate.
+       * config.in: Regenerate.
+       * configure: Regenerate.
+       * testsuite/Makefile.in: Regenerate.
+
 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
 
        * output.h (sort_attached_input_sections): Change to be public.
index df8dcb52017a6e7f6ebaf181030f6ccaceb65c0f..f6ced44c7e990d00918414a38c1f8982600aba2b 100644 (file)
@@ -1,6 +1,7 @@
 ## Process this file with automake to generate Makefile.in
 #
-#   Copyright 2012 Free Software Foundation
+#  Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
+#  Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -37,7 +38,7 @@ AM_CPPFLAGS = \
 LIBIBERTY = ../libiberty/libiberty.a
 
 if PLUGINS
-LIBDL = -ldl
+LIBDL = @DLOPEN_LIBS@
 endif
 
 if THREADS
index 216532a5d2a1dc62229d8ac5c746e7b329be9cd4..f12832b17df363117c21117fe0b5c6e9fa4b7668 100644 (file)
@@ -16,7 +16,8 @@
 @SET_MAKE@
 
 #
-#   Copyright 2012 Free Software Foundation
+#  Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
+#  Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -272,6 +273,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@
@@ -398,7 +400,7 @@ AM_CPPFLAGS = \
        -DTOOLLIBDIR="\"$(tooldir)/lib\"" @INCINTL@
 
 LIBIBERTY = ../libiberty/libiberty.a
-@PLUGINS_TRUE@LIBDL = -ldl
+@PLUGINS_TRUE@LIBDL = @DLOPEN_LIBS@
 @THREADS_TRUE@THREADSLIB = -lpthread
 AM_YFLAGS = -d
 
index 42252bf5a523c62de0599e58c0bd065c4141e417..d46fd75748490e35e04a60c51ee8639070a349dc 100644 (file)
@@ -73,6 +73,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
 
 /* 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
 
index 9e1ee273069b74a48f66eb444e40cf426fa9e65f..7e58cdfd5282abd4795be8038c4e84deacad8920 100755 (executable)
@@ -596,6 +596,7 @@ MAINTAINER_MODE_FALSE
 MAINTAINER_MODE_TRUE
 HAVE_PUBNAMES_FALSE
 HAVE_PUBNAMES_TRUE
+DLOPEN_LIBS
 CXXCPP
 HAVE_ZLIB_FALSE
 HAVE_ZLIB_TRUE
@@ -7139,6 +7140,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 fallocate readv sysconf times
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
index 804a474a9b64c966af86dad74ec1bc5d6f9b6082..b03c09de0d9468abb5c362002694f4bed403f086 100644 (file)
@@ -1,6 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl
-dnl   Copyright 2012 Free Software Foundation
+dnl   Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
+dnl   Free Software Foundation, Inc.
 dnl
 dnl This file is free software; you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
@@ -505,6 +506,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 fallocate readv sysconf times)
 AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem])
 
index c39e11ecf9548cae2b86d4264081273d61099616..9176e066efc4ff7570dbf7aaf26a7d2c5c021fc1 100644 (file)
@@ -1,6 +1,6 @@
 // plugin.cc -- plugin manager for gold      -*- C++ -*-
 
-// Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
 // Written by Cary Coutant <ccoutant@google.com>.
 
 // This file is part of gold.
 #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"
index 6e22934f93e8d80012cbc6b6b4da2122832ef853..b2eb352ded84bc283e2fad89c21c56de04d2b791 100644 (file)
@@ -1878,6 +1878,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@