strip: Treat "default" output_target as unspecified

Treat output target as unspecified if it is set to "default".

binutils/

	PR binutils/33230
	* objcopy.c (copy_file): Treat "default" output_target as
	unspecified.

binutils/testsuite/

	PR binutils/33230
	* binutils-all/x86-64/x86-64.exp (run_pr33230_test): New.
	Run binutils/33230 tests with readelf if supported.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
This commit is contained in:
H.J. Lu
2025-07-30 20:34:46 -07:00
parent c7c272f06d
commit 3ac83564eb
2 changed files with 60 additions and 22 deletions

View File

@@ -3953,7 +3953,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
/* bfd_get_target does not return the correct value until
bfd_check_format succeeds. */
if (output_target == NULL)
if (output_target == NULL
|| strcmp (output_target, "default") == 0)
{
output_target = bfd_get_target (ibfd);
force_output_target = false;
@@ -4008,7 +4009,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
/* bfd_get_target does not return the correct value until
bfd_check_format succeeds. */
if (output_target == NULL)
if (output_target == NULL
|| strcmp (output_target, "default") == 0)
output_target = bfd_get_target (ibfd);
if (ofd >= 0)