aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-08-26 19:07:14 +0930
committerAlan Modra <amodra@gmail.com>2025-08-27 21:45:12 +0930
commitab0e81e536b85d40569df79d1872c1e1f4dda1af (patch)
tree4be09ca6d815445eb9d4e59315b855392539a65e
parente17e65798e466913f384e7a568d991124798ecb4 (diff)
downloadbinutils-ab0e81e536b85d40569df79d1872c1e1f4dda1af.zip
binutils-ab0e81e536b85d40569df79d1872c1e1f4dda1af.tar.gz
binutils-ab0e81e536b85d40569df79d1872c1e1f4dda1af.tar.bz2
Revert part of commit 8e885fece150
After commit 5e83077d552e we no longer choose a "plugin" target in objcopy so ibfd->target_defaults can again be used to test whether the user supplied a target. PR 33230 * objcopy.c (copy_file): Revert change adding a target_defaulted variable and passing down to.. (copy_archive, copy_object): ..here. Remove target_defaulted parameter. Use ibfd->target_defaulted.
-rw-r--r--binutils/objcopy.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 51d87d6..c6fc508 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2654,8 +2654,7 @@ set_long_section_mode (bfd *output_bfd, bfd *input_bfd, enum long_section_name_h
Returns TRUE upon success, FALSE otherwise. */
static bool
-copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch,
- bool target_defaulted)
+copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
{
bfd_vma start;
long symcount;
@@ -2806,7 +2805,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch,
imach = 0;
}
if (!bfd_set_arch_mach (obfd, iarch, imach)
- && (target_defaulted
+ && (ibfd->target_defaulted
|| bfd_get_arch (ibfd) != bfd_get_arch (obfd)))
{
if (bfd_get_arch (ibfd) == bfd_arch_unknown)
@@ -3609,8 +3608,7 @@ fail:
static bool
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
bool force_output_target,
- const bfd_arch_info_type *input_arch,
- bool target_defaulted)
+ const bfd_arch_info_type *input_arch)
{
struct name_list
{
@@ -3759,8 +3757,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
ok_object = false;
if (ok_object)
{
- ok = copy_object (this_element, output_element, input_arch,
- target_defaulted);
+ ok = copy_object (this_element, output_element, input_arch);
if (!ok && bfd_get_arch (this_element) == bfd_arch_unknown)
/* Try again as an unknown object file. */
@@ -3861,8 +3858,6 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
char **core_matching;
off_t size = get_file_size (input_filename);
const char *target = input_target;
- bool target_defaulted = (!input_target
- || strcmp (input_target, "default") == 0);
if (size < 1)
{
@@ -3967,7 +3962,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
}
if (!copy_archive (ibfd, obfd, output_target, force_output_target,
- input_arch, target_defaulted))
+ input_arch))
status = 1;
return;
}
@@ -4048,7 +4043,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
if (ibfd->lto_type == lto_slim_ir_object)
ok_object = false;
if (ok_object
- ? !copy_object (ibfd, obfd, input_arch, target_defaulted)
+ ? !copy_object (ibfd, obfd, input_arch)
: !copy_unknown_file (ibfd, obfd,
in_stat->st_size, in_stat->st_mode))
status = 1;