new plugin bfd_target breaks gdb with --enable-targets=all

Rafael Espindola espindola@google.com
Wed May 27 09:42:00 GMT 2009


> The below fixes the issue here, since program_name is declared as:
>
>  extern char *program_name __attribute__ ((weak));
>
> ... and gdb doesn't define `program_name' since 1990.  Seems
> wrong to require all libbfd clients to do so now.

The fix looks correct to me. It was a thinko declaring the variable
weak but not checking the address. Sorry about that.

> (using weak in libbfd cries out hack to me, but well)

It is. Since the plugin target already has the bfd_plugin_set_plugin
function, it would probably be better for it to have a
bfd_plugin_set_program_name. Would you prefer that solution?

> It looks like something else is still wrong, because otherwise,
> should gdb be building plugin.c at all if the user doesn't
> specify --enable-plugins?

The plugin is just a strange target. That is why it is included in
--enable-targets=all.

> Maybe the check for empty string should be removed too, dunno
> if that was intended.

The check for program_name being NULL? It was a mistake, but it is
better to keep it for the case of a program that defines program_name
but never sets it.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047



More information about the Binutils mailing list