mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 19:50:13 +08:00
Silence warnings about incompatible plugins.
I have been looking at a Fedora bug report[1] from a user who was receiving warning messages from the BFD library about incompatible plugins. It turns out that they had both 32-bit and 64-bit versions of the same plugin installed, and the BFD library was attempting to load all of them. After thinking about it for a while, it seemed to me that the simplest solution was to not warn about incompatible plugins whilst attempting to create a list of viable plugins. [1]: https://bugzilla.redhat.com/show_bug.cgi?id=1836618 * plugin.c (try_load_plugin): Suppress the error message about being unable to open a plugin if creating a list of viable plugins.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2020-06-19 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* plugin.c (try_load_plugin): Suppress the error message about
|
||||||
|
being unable to open a plugin if creating a list of viable
|
||||||
|
plugins.
|
||||||
|
|
||||||
2020-06-16 Alan Modra <amodra@gmail.com>
|
2020-06-16 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* aout-tic30.c: Delete file.
|
* aout-tic30.c: Delete file.
|
||||||
|
36
bfd/plugin.c
36
bfd/plugin.c
@ -249,17 +249,18 @@ try_claim (bfd *abfd)
|
|||||||
return claimed;
|
return claimed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static bfd_boolean
|
||||||
try_load_plugin (const char *pname,
|
try_load_plugin (const char * pname,
|
||||||
struct plugin_list_entry *plugin_list_iter,
|
struct plugin_list_entry * plugin_list_iter,
|
||||||
bfd *abfd, bfd_boolean build_list_p)
|
bfd * abfd,
|
||||||
|
bfd_boolean build_list_p)
|
||||||
{
|
{
|
||||||
void *plugin_handle;
|
void *plugin_handle;
|
||||||
struct ld_plugin_tv tv[5];
|
struct ld_plugin_tv tv[5];
|
||||||
int i;
|
int i;
|
||||||
ld_plugin_onload onload;
|
ld_plugin_onload onload;
|
||||||
enum ld_plugin_status status;
|
enum ld_plugin_status status;
|
||||||
int result = 0;
|
bfd_boolean result = FALSE;
|
||||||
|
|
||||||
/* NB: Each object is independent. Reuse the previous plugin from
|
/* NB: Each object is independent. Reuse the previous plugin from
|
||||||
the last run will lead to wrong result. */
|
the last run will lead to wrong result. */
|
||||||
@ -273,15 +274,20 @@ try_load_plugin (const char *pname,
|
|||||||
plugin_handle = dlopen (pname, RTLD_NOW);
|
plugin_handle = dlopen (pname, RTLD_NOW);
|
||||||
if (!plugin_handle)
|
if (!plugin_handle)
|
||||||
{
|
{
|
||||||
_bfd_error_handler ("Failed to load plugin '%s', reason: %s\n",
|
/* If we are building a list of viable plugins, then
|
||||||
pname, dlerror ());
|
we do not bother the user with the details of any
|
||||||
return 0;
|
plugins that cannot be loaded. */
|
||||||
|
if (! build_list_p)
|
||||||
|
_bfd_error_handler ("Failed to load plugin '%s', reason: %s\n",
|
||||||
|
pname, dlerror ());
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin_list_iter == NULL)
|
if (plugin_list_iter == NULL)
|
||||||
{
|
{
|
||||||
size_t length_plugin_name = strlen (pname) + 1;
|
size_t length_plugin_name = strlen (pname) + 1;
|
||||||
char *plugin_name = bfd_malloc (length_plugin_name);
|
char *plugin_name = bfd_malloc (length_plugin_name);
|
||||||
|
|
||||||
if (plugin_name == NULL)
|
if (plugin_name == NULL)
|
||||||
goto short_circuit;
|
goto short_circuit;
|
||||||
plugin_list_iter = bfd_malloc (sizeof *plugin_list_iter);
|
plugin_list_iter = bfd_malloc (sizeof *plugin_list_iter);
|
||||||
@ -342,7 +348,7 @@ try_load_plugin (const char *pname,
|
|||||||
goto short_circuit;
|
goto short_circuit;
|
||||||
|
|
||||||
abfd->plugin_format = bfd_plugin_yes;
|
abfd->plugin_format = bfd_plugin_yes;
|
||||||
result = 1;
|
result = TRUE;
|
||||||
|
|
||||||
short_circuit:
|
short_circuit:
|
||||||
dlclose (plugin_handle);
|
dlclose (plugin_handle);
|
||||||
@ -446,7 +452,7 @@ build_plugin_list (bfd *abfd)
|
|||||||
|
|
||||||
full_name = concat (plugin_dir, "/", ent->d_name, NULL);
|
full_name = concat (plugin_dir, "/", ent->d_name, NULL);
|
||||||
if (stat (full_name, &st) == 0 && S_ISREG (st.st_mode))
|
if (stat (full_name, &st) == 0 && S_ISREG (st.st_mode))
|
||||||
try_load_plugin (full_name, NULL, abfd, TRUE);
|
(void) try_load_plugin (full_name, NULL, abfd, TRUE);
|
||||||
free (full_name);
|
free (full_name);
|
||||||
}
|
}
|
||||||
closedir (d);
|
closedir (d);
|
||||||
@ -458,7 +464,7 @@ build_plugin_list (bfd *abfd)
|
|||||||
has_plugin_list = plugin_list != NULL;
|
has_plugin_list = plugin_list != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static bfd_boolean
|
||||||
load_plugin (bfd *abfd)
|
load_plugin (bfd *abfd)
|
||||||
{
|
{
|
||||||
struct plugin_list_entry *plugin_list_iter;
|
struct plugin_list_entry *plugin_list_iter;
|
||||||
@ -467,17 +473,17 @@ load_plugin (bfd *abfd)
|
|||||||
return try_load_plugin (plugin_name, plugin_list, abfd, FALSE);
|
return try_load_plugin (plugin_name, plugin_list, abfd, FALSE);
|
||||||
|
|
||||||
if (plugin_program_name == NULL)
|
if (plugin_program_name == NULL)
|
||||||
return 0;
|
return FALSE;
|
||||||
|
|
||||||
build_plugin_list (abfd);
|
build_plugin_list (abfd);
|
||||||
|
|
||||||
for (plugin_list_iter = plugin_list;
|
for (plugin_list_iter = plugin_list;
|
||||||
plugin_list_iter;
|
plugin_list_iter;
|
||||||
plugin_list_iter = plugin_list_iter->next)
|
plugin_list_iter = plugin_list_iter->next)
|
||||||
if (try_load_plugin (NULL, plugin_list_iter, abfd, FALSE))
|
if (try_load_plugin (NULL, plugin_list_iter, abfd,FALSE))
|
||||||
return 1;
|
return TRUE;
|
||||||
|
|
||||||
return 0;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user