Index: Makefile.am =================================================================== RCS file: /cvs/src/src/gold/Makefile.am,v retrieving revision 1.69 diff -u -r1.69 Makefile.am --- Makefile.am 17 Dec 2012 16:56:02 -0000 1.69 +++ Makefile.am 11 Jan 2013 14:24:35 -0000 @@ -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 @@ LIBIBERTY = ../libiberty/libiberty.a if PLUGINS -LIBDL = -ldl +LIBDL = @DLOPEN_LIBS@ endif if THREADS Index: configure.ac =================================================================== RCS file: /cvs/src/src/gold/configure.ac,v retrieving revision 1.83 diff -u -r1.83 configure.ac --- configure.ac 7 Jan 2013 19:55:41 -0000 1.83 +++ configure.ac 11 Jan 2013 14:24:36 -0000 @@ -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_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: plugin.cc =================================================================== RCS file: /cvs/src/src/gold/plugin.cc,v retrieving revision 1.55 diff -u -r1.55 plugin.cc --- plugin.cc 24 Aug 2012 18:35:34 -0000 1.55 +++ plugin.cc 11 Jan 2013 14:24:36 -0000 @@ -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" cvs diff: Diffing po cvs diff: Diffing testsuite Index: testsuite/Makefile.in =================================================================== RCS file: /cvs/src/src/gold/testsuite/Makefile.in,v retrieving revision 1.215 diff -u -r1.215 Makefile.in --- testsuite/Makefile.in 10 Jan 2013 00:18:15 -0000 1.215 +++ testsuite/Makefile.in 11 Jan 2013 14:24:36 -0000 @@ -1878,6 +1878,7 @@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLOPEN_LIBS = @DLOPEN_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@