This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Fix the plugin search in some file systems
> No opinion. ÂIf the performance hit is only when a --plugin option is
> used, it doesn't seem too important.
It is only when it is not used and there is a bfd-plugins directory. The hit
is one stat per plugin. Since only two implementations of the plugin
API exist (LLVM and GCC's LTO), the hit is probably not noticeable.
2009-06-05 Rafael Avila de Espindola <espindola@google.com>
* plugin.c (load_plugin): Use stat and S_ISREG instead of the d_type
field of struct dirent.
> Ian
>
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/bfd/plugin.c b/bfd/plugin.c
index ca47ab6..053fdd1 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -203,11 +203,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;