summaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2013-01-11 14:36:36 +0000
committerIan Lance Taylor <ian@airs.com>2013-01-11 14:36:36 +0000
commit0bf402d505d293fd9ceaa6bf7ca7bd4d910fd545 (patch)
tree9d92a8f7030fe7448d65f6e1e46461c584dbf8db /gold/plugin.cc
parent02be4619f1326faebdf539a45539ba83e689470c (diff)
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.
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index c39e11ecf9..9176e066ef 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -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.
@@ -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"