summaryrefslogtreecommitdiffstats
path: root/binutils-2.21/bfd
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2013-02-06 13:10:38 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2013-02-06 15:03:41 +0800
commit84f9060f4a7e1114ddaba10e92a59c166b7aa280 (patch)
treef21d0c415f338ac886a003c229ce6d25954eea46 /binutils-2.21/bfd
parenta1562c183b55e6766b4a3ba5148f742b7be0f276 (diff)
downloadtoolchain_binutils-84f9060f4a7e1114ddaba10e92a59c166b7aa280.tar.gz
toolchain_binutils-84f9060f4a7e1114ddaba10e92a59c166b7aa280.tar.bz2
toolchain_binutils-84f9060f4a7e1114ddaba10e92a59c166b7aa280.zip
Backport fixes for binutils-2.21/bfd plugin
---------------------------- revision 1.15 date: 2012/03/20 19:24:32; author: ktietz; state: Exp; lines: +37 -0 PR ld/12742 * configure.in (AC_CHECK_HEADERS): Test for windows.h and dlfcn.h. * plugin.c: Guard include of dlfcn.h if HAVE_DLFCN_H is defined. Add windows.h header include if HAVE_WINDOWS_H is defined. (dlerror): New static function if windows variant is used instead of dlfcn.h. (dlclose): Likewise. (dlopen): Likewise. (dlsym): Likewise. * configure: Regenerated. * config.in: Regenerated. ---------------------------- revision 1.295 date: 2012/10/13 14:17:10; author: hjl; state: Exp; lines: +2 -1 Replace -ldl with @lt_cv_dlopen_libs@ * Makefile.am (LIBDL): Replace -ldl with @lt_cv_dlopen_libs@. * configure.in (lt_cv_dlopen_libs): AC_SUBST. * Makefile.in: Regenerated. * configure: Likewise. Change-Id: I1d7f9545ce7f3de26062df50067067365eb2b13d
Diffstat (limited to 'binutils-2.21/bfd')
-rw-r--r--binutils-2.21/bfd/Makefile.am2
-rw-r--r--binutils-2.21/bfd/Makefile.in3
-rw-r--r--binutils-2.21/bfd/config.in3
-rwxr-xr-xbinutils-2.21/bfd/configure17
-rw-r--r--binutils-2.21/bfd/configure.in4
-rw-r--r--binutils-2.21/bfd/plugin.c37
6 files changed, 64 insertions, 2 deletions
diff --git a/binutils-2.21/bfd/Makefile.am b/binutils-2.21/bfd/Makefile.am
index bf5dea4c..7ff41fc2 100644
--- a/binutils-2.21/bfd/Makefile.am
+++ b/binutils-2.21/bfd/Makefile.am
@@ -35,7 +35,7 @@ AM_CFLAGS = $(WARN_CFLAGS)
AM_CPPFLAGS = -DBINDIR='"$(bindir)"'
if PLUGINS
bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
-LIBDL = -ldl
+LIBDL = @lt_cv_dlopen_libs@
endif
# bfd.h goes here, for now
diff --git a/binutils-2.21/bfd/Makefile.in b/binutils-2.21/bfd/Makefile.in
index b591ca67..d45a8652 100644
--- a/binutils-2.21/bfd/Makefile.in
+++ b/binutils-2.21/bfd/Makefile.in
@@ -293,6 +293,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
+lt_cv_dlopen_libs = @lt_cv_dlopen_libs@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -336,7 +337,7 @@ libbfd_la_LDFLAGS = $(am__append_1) -release `cat libtool-soversion` \
@INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la
AM_CFLAGS = $(WARN_CFLAGS)
AM_CPPFLAGS = -DBINDIR='"$(bindir)"'
-@PLUGINS_TRUE@LIBDL = -ldl
+@PLUGINS_TRUE@LIBDL = @lt_cv_dlopen_libs@
# bfd.h goes here, for now
BFD_H = bfd.h
diff --git a/binutils-2.21/bfd/config.in b/binutils-2.21/bfd/config.in
index b0b97a27..b85b3fa6 100644
--- a/binutils-2.21/bfd/config.in
+++ b/binutils-2.21/bfd/config.in
@@ -233,6 +233,9 @@
/* Define if <sys/procfs.h> has win32_pstatus_t. */
#undef HAVE_WIN32_PSTATUS_T
+/* 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
diff --git a/binutils-2.21/bfd/configure b/binutils-2.21/bfd/configure
index 7a25b7f8..e34f4b11 100755
--- a/binutils-2.21/bfd/configure
+++ b/binutils-2.21/bfd/configure
@@ -606,6 +606,7 @@ havevecs
tdefaults
bfd_ufile_ptr
bfd_file_ptr
+lt_cv_dlopen_libs
supports_plugins
bfd_default_target_size
bfd_machines
@@ -13516,6 +13517,22 @@ fi
fi
+
+for ac_header in windows.h dlfcn.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether string.h and strings.h may both be included" >&5
$as_echo_n "checking whether string.h and strings.h may both be included... " >&6; }
if test "${gcc_cv_header_string+set}" = set; then :
diff --git a/binutils-2.21/bfd/configure.in b/binutils-2.21/bfd/configure.in
index fce1dd7c..ee150207 100644
--- a/binutils-2.21/bfd/configure.in
+++ b/binutils-2.21/bfd/configure.in
@@ -190,6 +190,9 @@ AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h sys/stat.h)
GCC_HEADER_STDINT(bfd_stdint.h)
AC_HEADER_TIME
AC_HEADER_DIRENT
+
+AC_CHECK_HEADERS(windows.h dlfcn.h)
+
ACX_HEADER_STRING
AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno)
AC_CHECK_FUNCS(strtoull)
@@ -1054,6 +1057,7 @@ else
supports_plugins=0
fi
AC_SUBST(supports_plugins)
+AC_SUBST(lt_cv_dlopen_libs)
# Determine the host dependant file_ptr a.k.a. off_t type. In order
# prefer: off64_t - if ftello64 and fseeko64, off_t - if ftello and
diff --git a/binutils-2.21/bfd/plugin.c b/binutils-2.21/bfd/plugin.c
index a46bf905..7d46a62e 100644
--- a/binutils-2.21/bfd/plugin.c
+++ b/binutils-2.21/bfd/plugin.c
@@ -25,7 +25,13 @@
#if BFD_SUPPORTS_PLUGINS
#include <assert.h>
+#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
#include <stdarg.h>
#include "plugin-api.h"
#include "sysdep.h"
@@ -34,6 +40,37 @@
#include "libiberty.h"
#include <dirent.h>
+#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 GetProcAddress (handle, name);
+}
+
+static int ATTRIBUTE_UNUSED
+dlclose (void *handle)
+{
+ FreeLibrary (handle);
+ return 0;
+}
+
+static const char *
+dlerror (void)
+{
+ return "Unable to load DLL.";
+}
+
+#endif /* !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H) */
+
#define bfd_plugin_close_and_cleanup _bfd_generic_close_and_cleanup
#define bfd_plugin_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define bfd_plugin_new_section_hook _bfd_generic_new_section_hook