binutils: properly split ar and ranlib

By not linking the exact same object file twice, in particular ranlib can
benefit quite a bit from the compiler eliminating dead code.
This commit is contained in:
Jan Beulich
2025-04-04 10:20:14 +02:00
parent 2fb3d389d8
commit 25a0668a95
5 changed files with 19 additions and 17 deletions

View File

@@ -67,7 +67,9 @@ static int mri_mode;
/* This flag distinguishes between ar and ranlib:
1 means this is 'ranlib'; 0 means this is 'ar'.
-1 means if we should use argv[0] to decide. */
#ifndef is_ranlib
extern int is_ranlib;
#endif
/* Nonzero means don't warn about creating the archive file if necessary. */
int silent_create = 0;
@@ -735,6 +737,7 @@ main (int argc, char **argv)
expandargv (&argc, &argv);
#ifndef is_ranlib
if (is_ranlib < 0)
{
const char *temp = lbasename (program_name);
@@ -745,6 +748,7 @@ main (int argc, char **argv)
else
is_ranlib = 0;
}
#endif
if (bfd_init () != BFD_INIT_MAGIC)
fatal (_("fatal error: libbfd ABI mismatch"));