* 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-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.
## 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
LIBIBERTY = ../libiberty/libiberty.a
if PLUGINS
-LIBDL = -ldl
+LIBDL = @DLOPEN_LIBS@
endif
if THREADS
@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
DATADIRNAME = @DATADIRNAME@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLOPEN_LIBS = @DLOPEN_LIBS@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
-DTOOLLIBDIR="\"$(tooldir)/lib\"" @INCINTL@
LIBIBERTY = ../libiberty/libiberty.a
-@PLUGINS_TRUE@LIBDL = -ldl
+@PLUGINS_TRUE@LIBDL = @DLOPEN_LIBS@
@THREADS_TRUE@THREADSLIB = -lpthread
AM_YFLAGS = -d
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
MAINTAINER_MODE_TRUE
HAVE_PUBNAMES_FALSE
HAVE_PUBNAMES_TRUE
+DLOPEN_LIBS
CXXCPP
HAVE_ZLIB_FALSE
HAVE_ZLIB_TRUE
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`
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
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])
// 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"
DATADIRNAME = @DATADIRNAME@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLOPEN_LIBS = @DLOPEN_LIBS@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@