daily update
[binutils-gdb.git] / bfd / plugin.c
index ca47ab620f25af9b44eeb676bd7567c7df988c20..91bbfd1ff3caaa5dc3096b91b82aef6927bfe66d 100644 (file)
    MA 02110-1301, USA.  */
 
 #include "config.h"
+#include "bfd.h"
+
+#if BFD_SUPPORTS_PLUGINS
+
 #include <assert.h>
 #include <dlfcn.h>
 #include <stdarg.h>
@@ -64,6 +68,7 @@
 #define bfd_plugin_bfd_discard_group                  bfd_generic_discard_group
 #define bfd_plugin_section_already_linked             _bfd_generic_section_already_linked
 #define bfd_plugin_bfd_define_common_symbol           bfd_generic_define_common_symbol
+#define bfd_plugin_bfd_copy_link_hash_symbol_type     _bfd_generic_copy_link_hash_symbol_type
 
 static enum ld_plugin_status
 message (int level ATTRIBUTE_UNUSED,
@@ -203,11 +208,11 @@ load_plugin (void)
   while ((ent = readdir (d)))
     {
       char *full_name;
-      if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
-       continue;
+      struct stat s;
 
       full_name = concat (p, "/", ent->d_name, NULL);
-      found = try_load_plugin (full_name);
+      if (stat(full_name, &s) == 0 && S_ISREG (s.st_mode))
+       found = try_load_plugin (full_name);
       free (full_name);
       if (found)
        break;
@@ -235,7 +240,7 @@ bfd_plugin_object_p (bfd *abfd)
 
   if (abfd->iostream)
     {
-      file.fd = fileno (abfd->iostream);
+      file.fd = fileno ((FILE *) abfd->iostream);
       file.offset = 0;
       file.filesize = 0; /*FIXME*/
     }
@@ -243,7 +248,7 @@ bfd_plugin_object_p (bfd *abfd)
     {
       bfd *archive = abfd->my_archive;
       BFD_ASSERT (archive);
-      file.fd = fileno (archive->iostream);
+      file.fd = fileno ((FILE *) archive->iostream);
       file.offset = abfd->origin;
       file.filesize = arelt_size (abfd);
 
@@ -415,11 +420,11 @@ bfd_plugin_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
 static asymbol *
 bfd_plugin_make_empty_symbol (bfd *abfd)
 {
-  asymbol *new = bfd_zalloc (abfd, sizeof (asymbol));
-  if (new == NULL)
-    return new;
-  new->the_bfd = abfd;
-  return new;
+  asymbol *new_symbol = bfd_zalloc (abfd, sizeof (asymbol));
+  if (new_symbol == NULL)
+    return new_symbol;
+  new_symbol->the_bfd = abfd;
+  return new_symbol;
 }
 
 static int
@@ -492,3 +497,4 @@ const bfd_target plugin_vec =
 
   NULL                         /* backend_data.  */
 };
+#endif /* BFD_SUPPORTS_PLUGIN */