]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Restore ability of strip to accept -o command line switch
authorNick Clifton <nickc@redhat.com>
Wed, 27 Jun 2001 16:45:43 +0000 (16:45 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 27 Jun 2001 16:45:43 +0000 (16:45 +0000)
binutils/ChangeLog
binutils/objcopy.c

index aefa36e625129b2bc715a12878dd05deceba30ce..d6a6f0737553f8101cd83e844c338af9daf933f6 100644 (file)
@@ -1,3 +1,7 @@
+2001-06-27  Nick Clifton  <nickc@cambridge.redhat.com>
+
+       * objcopy.c (strip_main): Accept -o command line switch.
+
 2001-06-11  Alan Modra  <amodra@bigpond.net.au>
 
        Merge from mainline.
index cd3e9aff1736e36ebe44dc2c8145d12850bf1a36..e6e2e98d0e9f8be64fbdfd05ba5ed04a2e438213 100644 (file)
@@ -240,6 +240,7 @@ static struct option strip_options[] =
   {"keep-symbol", required_argument, 0, 'K'},
   {"output-format", required_argument, 0, 'O'},        /* Obsolete */
   {"output-target", required_argument, 0, 'O'},
+  {"output-file", required_argument, 0, 'o'},
   {"preserve-dates", no_argument, 0, 'p'},
   {"remove-section", required_argument, 0, 'R'},
   {"strip-all", no_argument, 0, 's'},
@@ -772,7 +773,7 @@ filter_symbols (abfd, obfd, osyms, isyms, symcount)
           even if relocatable is false.  External users of the
           library containing the $idata section may reference these
           symbols.  */
-         keep = 1;
+       keep = 1;
       else if ((flags & BSF_GLOBAL) != 0       /* Global symbol.  */
               || (flags & BSF_WEAK) != 0
               || bfd_is_und_section (bfd_get_section (sym))
@@ -782,6 +783,10 @@ filter_symbols (abfd, obfd, osyms, isyms, symcount)
        keep = (strip_symbols != STRIP_DEBUG
                && strip_symbols != STRIP_UNNEEDED
                && ! convert_debugging);
+      else if (bfd_get_section (sym)->comdat)
+       /* COMDAT sections store special information in local
+          symbols, so we cannot risk stripping any of them.  */
+       keep = 1;
       else                     /* Local symbol.  */
        keep = (strip_symbols != STRIP_UNNEEDED
                && (discard_locals != LOCALS_ALL
@@ -1835,7 +1840,7 @@ strip_main (argc, argv)
   struct section_list *p;
   char *output_file = NULL;
 
-  while ((c = getopt_long (argc, argv, "b:i:I:j:K:N:s:O:d:F:L:G:R:SpgxXVvW:",
+  while ((c = getopt_long (argc, argv, "I:O:F:K:N:R:o:sSpdgxXVv",
                           strip_options, (int *) 0)) != EOF)
     {
       switch (c)
@@ -1967,7 +1972,7 @@ copy_main (argc, argv)
   struct section_list *p;
   struct stat statbuf;
 
-  while ((c = getopt_long (argc, argv, "b:i:I:j:K:N:s:O:d:F:L:R:SpgxXVvW:",
+  while ((c = getopt_long (argc, argv, "b:i:I:j:K:N:s:O:d:F:L:G:R:SpgxXVvW:",
                           copy_options, (int *) 0)) != EOF)
     {
       switch (c)
@@ -2360,10 +2365,8 @@ copy_main (argc, argv)
     output_target = input_target;
 
   if (preserve_dates)
-    {
-      if (stat (input_filename, &statbuf) < 0)
-       fatal (_("Cannot stat: %s: %s"), input_filename, strerror (errno));
-    }
+    if (stat (input_filename, & statbuf) < 0)
+      fatal (_("Cannot stat: %s: %s"), input_filename, strerror (errno));
 
   /* If there is no destination file then create a temp and rename
      the result into the input.  */