From 0bf402d505d293fd9ceaa6bf7ca7bd4d910fd545 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 11 Jan 2013 14:36:36 +0000 Subject: 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. --- gold/plugin.cc | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'gold/plugin.cc') 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 . // This file is part of gold. @@ -29,9 +29,39 @@ #include #ifdef ENABLE_PLUGINS +#ifdef HAVE_DLFCN_H #include +#elif defined (HAVE_WINDOWS_H) +#include +#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( + GetProcAddress(static_cast(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" -- cgit v1.2.3