diff options
author | Howard Chu <hyc@symas.com> | 2020-11-17 14:00:08 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-11-17 14:00:08 +0000 |
commit | 0833984dda29c0b363785edb54a2e1cbdf0d129e (patch) | |
tree | 3b15f58038bfc8808ee68ae157020c8fde9419ad /binutils | |
parent | 4e0e019fa8eda9b7ffe0615133f55e9b0b882fa1 (diff) | |
download | gdb-0833984dda29c0b363785edb54a2e1cbdf0d129e.zip gdb-0833984dda29c0b363785edb54a2e1cbdf0d129e.tar.gz gdb-0833984dda29c0b363785edb54a2e1cbdf0d129e.tar.bz2 |
Place the libdeps record in the second archive slot.
* ar.c (main): Place the libdeps record in the second archive
slot.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/ar.c | 19 |
2 files changed, 16 insertions, 8 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 6770c9b..2124c59 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2020-11-17 Howard Chu <hyc@symas.com> + + * ar.c (main): Place the libdeps record in the second archive + slot. + 2020-11-13 Nick Clifton <nickc@redhat.com> PR 26829 diff --git a/binutils/ar.c b/binutils/ar.c index 537b139..7d279d6 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -890,13 +890,16 @@ main (int argc, char **argv) if (bfd_find_target (plugin_target, libdeps_bfd) == NULL) fatal (_("Cannot reset libdeps record type.")); - /* Append our libdeps record to the list of files - being operated on. */ + /* Insert our libdeps record in 2nd slot of the list of files + being operated on. We shouldn't use 1st slot, but we want + to avoid having to search all the way to the end of an + archive with a large number of members at link time. */ new_files = xmalloc ((file_count + 2) * sizeof (char *)); - for (i = 0; i < file_count; i++) - new_files[i] = files[i]; - new_files[i++] = LIBDEPS; - file_count = i; + new_files[0] = files[0]; + new_files[1] = LIBDEPS; + for (i = 1; i < file_count; i++) + new_files[i+1] = files[i]; + file_count = ++i; files = new_files; files[i] = NULL; } @@ -1135,7 +1138,7 @@ open_output_file (bfd * abfd) output_filename, base); output_filename = base; } - + if (output_dir) { size_t len = strlen (output_dir); @@ -1152,7 +1155,7 @@ open_output_file (bfd * abfd) if (verbose) printf ("x - %s\n", output_filename); - + FILE * ostream = fopen (output_filename, FOPEN_WB); if (ostream == NULL) { |