aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2019-03-04 13:11:08 +0000
committerNick Clifton <nickc@redhat.com>2019-03-04 13:11:08 +0000
commitf5f20315116c43110c058ec9d787e20f901309f2 (patch)
treece5d79e6cfe93a08f394f5ee617e315445144afc
parent67490c6bad8c8d3fcbcbd5a3012ab5d189fd3981 (diff)
downloadgdb-f5f20315116c43110c058ec9d787e20f901309f2.zip
gdb-f5f20315116c43110c058ec9d787e20f901309f2.tar.gz
gdb-f5f20315116c43110c058ec9d787e20f901309f2.tar.bz2
Stop objcopy from attempting to copy thin archives.
PR 24281 * objcopy.c (copy_archive): Do not copy thin archives.
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/objcopy.c21
2 files changed, 26 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 6bb4384..aa33e52 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-04 Nick Clifton <nickc@redhat.com>
+
+ PR 24281
+ * objcopy.c (copy_archive): Do not copy thin archives.
+
2019-02-27 Matthew Malcomson <matthew.malcomson@arm.com>
* testsuite/lib/binutils-common.exp: Allow multiple "as" lines.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 0e17b86..330b93c 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3276,6 +3276,27 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
char *dir;
const char *filename;
+ /* PR 24281: It is not clear what should happen when copying a thin archive.
+ One part is straight forward - if the output archive is in a different
+ directory from the input archive then any relative paths in the library
+ should be adjusted to the new location. But if any transformation
+ options are active (eg strip, rename, add, etc) then the implication is
+ that these should be applied to the files pointed to by the archive.
+ But since objcopy is not destructive, this means that new files must be
+ created, and there is no guidance for the names of the new files. (Plus
+ this conflicts with one of the goals of thin libraries - only taking up
+ a minimal amount of space in the file system).
+
+ So for now we fail if an attempt is made to copy such libraries. */
+ if (ibfd->is_thin_archive)
+ {
+ status = 1;
+ bfd_set_error (bfd_error_invalid_operation);
+ bfd_nonfatal_message (NULL, ibfd, NULL,
+ _("sorry: copying thin archives is not currently supported"));
+ return;
+ }
+
/* Make a temp directory to hold the contents. */
dir = make_tempdir (bfd_get_filename (obfd));
if (dir == NULL)