From 4d2982a8c62b09a16ba1e9c4913c262f11557017 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 8 Nov 2020 15:04:00 +0000 Subject: [PATCH] ar: fix libdeps to avoid unnecessary dependency on plugin support Also move __.LIBDEP entry to head of archive instead of tail. --- binutils/ar.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/binutils/ar.c b/binutils/ar.c index 56c758cc1a..d886c3b720 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -866,7 +866,7 @@ main (int argc, char **argv) /* Create a bfd to contain the dependencies. It inherits its type from arch, but we must set the type to "binary" otherwise bfd_bwrite() will fail. After writing, we - must set the type back to "plugin" otherwise adding it to the + must set the type back to default otherwise adding it to the archive will fail. */ libdeps_bfd = bfd_create (LIBDEPS, arch); if (libdeps_bfd == NULL) @@ -887,18 +887,18 @@ main (int argc, char **argv) if (! bfd_make_readable (libdeps_bfd)) fatal (_("Cannot make libdeps object readable.")); - if (bfd_find_target ("plugin", libdeps_bfd) == NULL) + if (bfd_find_target (plugin_target, libdeps_bfd) == NULL) fatal (_("Cannot reset libdeps record type.")); - /* Append our libdeps record to the list of files + /* Prepend our libdeps record to the list of files being operated on. */ new_files = xmalloc ((file_count + 2) * sizeof (char *)); + new_files[0] = LIBDEPS; for (i = 0; i < file_count; i++) - new_files[i] = files[i]; - new_files[i++] = LIBDEPS; - file_count = i; + new_files[i+1] = files[i]; + file_count = i+1; files = new_files; - files[i] = NULL; + files[file_count] = NULL; } switch (operation) -- 2.20.1