From 2fb3d389d83f0ea1ac9a8d346884ffdb41e4fbb8 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 4 Apr 2025 10:19:51 +0200 Subject: 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. --- binutils/objcopy.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'binutils/objcopy.c') 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); -- cgit v1.1