]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
strip: Just admit we don't support stripping ar archives for now.
authorMark Wielaard <mjw@redhat.com>
Tue, 9 Jun 2015 14:26:16 +0000 (16:26 +0200)
committerMark Wielaard <mjw@redhat.com>
Wed, 10 Jun 2015 12:14:57 +0000 (14:14 +0200)
We try to handle (in-place) stripping of ar archives, but since elf_clone
doesn't really support cloning ar members and we don't handle reducing
the size of the members, moving the offsets of other members. This causes
crashes or writing garbage. Better to just admit that for now we don't
support stripping archives. Call error when we see an ELF_K_AR file.

https://bugzilla.redhat.com/show_bug.cgi?id=766156
https://lists.fedorahosted.org/pipermail/elfutils-devel/2009-August/000567.html

Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/strip.c

index 59d87c8d43d559611cbd0320191f28790f49d765..35c68c78b356aaf7a90edfad73d9ab1505e10465 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-09  Mark Wielaard  <mjw@redhat.com>
+
+       * strip.c (handle_ar): Mark as unused.
+       (process_file): Produce an error when trying to handle an ar.
+
 2015-05-30  Mark Wielaard  <mjw@redhat.com>
 
        * elfcmp.c (main): Only call memcmp when d_size != 0.
index d63b6a822f583aadd99dba5ab35139e7541e385d..5e69334bf0e92422ecf8577bbdf7775d821bb26a 100644 (file)
@@ -113,7 +113,7 @@ static int handle_elf (int fd, Elf *elf, const char *prefix,
 
 /* Handle all files contained in the archive.  */
 static int handle_ar (int fd, Elf *elf, const char *prefix, const char *fname,
-                     struct timespec tvp[2]);
+                     struct timespec tvp[2]) __attribute__ ((unused));
 
 static int debug_fd = -1;
 static char *tmp_debug_fname = NULL;
@@ -374,7 +374,17 @@ process_file (const char *fname)
          result = 1;
        }
       else
-       result = handle_ar (fd, elf, NULL, fname, preserve_dates ? tv : NULL);
+       {
+         /* We would like to support ar archives, but currently it just
+            doesn't work at all since we call elf_clone on the members
+            which doesn't really support ar members.
+            result = handle_ar (fd, elf, NULL, fname,
+                                preserve_dates ? tv : NULL);
+          */
+         error (0, 0, gettext ("%s: no support for stripping archive"),
+                fname);
+         result = 1;
+       }
       break;
 
     default: