aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2025-04-04 10:19:51 +0200
committerJan Beulich <jbeulich@suse.com>2025-04-04 10:19:51 +0200
commit2fb3d389d83f0ea1ac9a8d346884ffdb41e4fbb8 (patch)
tree1972f07c46481ec75f0a2358d217393d31888e17 /binutils/objcopy.c
parentc619da1a22fcc67654b6c7860272aa2ce5deadaa (diff)
downloadbinutils-2fb3d389d83f0ea1ac9a8d346884ffdb41e4fbb8.zip
binutils-2fb3d389d83f0ea1ac9a8d346884ffdb41e4fbb8.tar.gz
binutils-2fb3d389d83f0ea1ac9a8d346884ffdb41e4fbb8.tar.bz2
binutils: properly split objcopy and strip
By not linking the exact same object file twice, in particular strip can benefit quite a bit from the compiler eliminating dead code.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 572f22c..1cc4fe4 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -533,7 +533,9 @@ extern char *program_name;
/* This flag distinguishes between strip and objcopy:
1 means this is 'strip'; 0 means this is 'objcopy'.
-1 means if we should use argv[0] to decide. */
+#ifndef is_strip
extern int is_strip;
+#endif
/* The maximum length of an S record. This variable is defined in srec.c
and can be modified by the --srec-len parameter. */
@@ -6222,6 +6224,7 @@ main (int argc, char *argv[])
fatal (_("fatal error: libbfd ABI mismatch"));
set_default_bfd_target ();
+#ifndef is_strip
if (is_strip < 0)
{
int i = strlen (program_name);
@@ -6235,6 +6238,7 @@ main (int argc, char *argv[])
#endif
is_strip = (i >= 5 && FILENAME_CMP (program_name + i - 5, "strip") == 0);
}
+#endif /* is_strip */
create_symbol_htabs ();
xatexit (delete_symbol_htabs);