Don't choose plugin target in binutils/

Instead make bfd_check_format try the plugin target first when the
user hasn't supplied a target.

bfd/
	* format.c (bfd_check_format_matches): Try for a plugin target
	match first.
	* targets.c (bfd_find_target): Don't specially treat "plugin".
binutils/
	* ar.c (plugin_target): Delete.
	(open_inarch): Don't set target of archive elements.
	(replace_members): Use target rather than plugin_target when
	opening replacement or additional files.
	* arsup.c (plugin_target): Delete.  Replace all uses with NULL.
	(ar_open): Don't set element target.
	* bucomm.h (set_plugin_target): Delete.
	* nm.c (plugin_target): Delete.
	(display_archive): Don't set element target.
	(display_file): Alway use target when opening file.
	* objcopy.c (copy_archive): Don't use plugin target for output
	elements.
	* NEWS: Mention stricter target checking.
This commit is contained in:
Alan Modra
2025-08-18 18:33:54 +09:30
parent c3eb17bae4
commit 5e83077d55
8 changed files with 48 additions and 90 deletions

View File

@@ -3795,14 +3795,8 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
if (preserve_dates && stat_status == 0)
set_times (output_name, &buf);
/* Open the newly created output file and attach to our
list. We must enable the plugin target here in order to
read IR symbols for the archive map. */
const char *targ = output_target;
#if BFD_SUPPORTS_PLUGINS
if (!force_output_target)
targ = "plugin";
#endif
/* Open the newly created output file and attach to our list. */
const char *targ = force_output_target ? output_target : NULL;
output_element = bfd_openr (output_name, targ);
list->obfd = output_element;