This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFC 3/5] xtensa: support dynconfig on windows
- From: Max Filippov <jcmvbkbc at gmail dot com>
- To: binutils at sourceware dot org, gdb-patches at sourceware dot org
- Cc: Sterling Augustine <augustine dot sterling at gmail dot com>, David Weatherford <weath at cadence dot com>, Maxim Grigoriev <maxim2405 at gmail dot com>, Woody LaRue <larue at cadence dot com>, Max Filippov <jcmvbkbc at gmail dot com>
- Date: Mon, 22 May 2017 14:12:31 -0700
- Subject: [RFC 3/5] xtensa: support dynconfig on windows
- Authentication-results: sourceware.org; auth=none
- References: <1495487553-19078-1-git-send-email-jcmvbkbc@gmail.com>
2017-05-22 Max Filippov <jcmvbkbc@gmail.com>
bfd/
* xtensa-config.c (windows.h): New #include'd header.
(RTLD_LAZY): New macro definition.
(dlopen, dlsym, dlclose, dlerror): New functions.
---
bfd/xtensa-config.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/bfd/xtensa-config.c b/bfd/xtensa-config.c
index fdbcca4..3e12e26 100644
--- a/bfd/xtensa-config.c
+++ b/bfd/xtensa-config.c
@@ -3,6 +3,8 @@
#if defined (HAVE_DLFCN_H)
#include <dlfcn.h>
+#elif defined (HAVE_WINDOWS_H)
+#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
@@ -12,6 +14,37 @@
static struct xtensa_config xtensa_defconfig = XTENSA_CONFIG_INITIALIZER;
+#if !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H)
+
+#define RTLD_LAZY 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) */
+
void *xtensa_load_config (const char *name ATTRIBUTE_UNUSED, void *def)
{
static int init;
--
2.1.4