* collect2.c (main): Handle --no-demangle and --demangle flags.
authorPer Bothner <per@bothner.com>
Tue, 13 Jul 2004 17:19:14 +0000 (10:19 -0700)
committerPer Bothner <bothner@gcc.gnu.org>
Tue, 13 Jul 2004 17:19:14 +0000 (10:19 -0700)
From-SVN: r84631

gcc/ChangeLog
gcc/collect2.c

index 5e87e5e3907d1b03a9f67285c72c8d87a53328a4..67fcce1e06916a4606cd93dc25d7f13f0a2ec172 100644 (file)
@@ -1,3 +1,7 @@
+2004-07-13  Per Bothner  <per@bothner.com>
+
+       * collect2.c (main):  Handle --no-demangle and --demangle flags.
+
 2004-07-13  Sebastian Pop  <pop@cri.ensmp.fr>
 
        * Makefile.in (OBJS-common): Add tree-data-ref.o.
index 79f7885e6e7562feddd8a35031101b3b0e9de106..2edbea84b0ea7713e8086708bbef2723af1e35d1 100644 (file)
@@ -185,6 +185,7 @@ enum pass {
 int vflag;                             /* true if -v */
 static int rflag;                      /* true if -r */
 static int strip_flag;                 /* true if -s */
+static const char *demangle_flag;
 #ifdef COLLECT_EXPORT_LIST
 static int export_flag;                 /* true if -bE */
 static int aix64_flag;                 /* true if -b64 */
@@ -1070,8 +1071,10 @@ main (int argc, char **argv)
 
   first_file = 1;
 #ifdef HAVE_LD_DEMANGLE
-  if (!no_demangle)
-    *ld1++ = *ld2++ = "--demangle";
+  if (!demangle_flag && !no_demangle)
+    demangle_flag = "--demangle";
+  if (demangle_flag)
+    *ld1++ = *ld2++ = demangle_flag;
 #endif
   while ((arg = *++argv) != (char *) 0)
     {
@@ -1167,6 +1170,34 @@ main (int argc, char **argv)
              if (arg[2] == '\0')
                vflag = 1;
              break;
+
+           case '-':
+             if (strcmp (arg, "--no-demangle") == 0)
+               {
+                 demangle_flag = arg;
+                 no_demangle = 1;
+                 ld1--;
+                 ld2--;
+               }
+             else if (strncmp (arg, "--demangle", 10) == 0)
+               {
+                 demangle_flag = arg;
+                 no_demangle = 0;
+#ifndef HAVE_LD_DEMANGLE
+                 if (arg[10] == '=')
+                   {
+                     enum demangling_styles style
+                       = cplus_demangle_name_to_style (arg+11);
+                     if (style == unknown_demangling)
+                       error ("unknown demangling style '%s'", arg+11);
+                     else
+                       current_demangling_style = style;
+                   }
+#endif
+                 ld1--;
+                 ld2--;
+               }
+             break;
            }
        }
       else if ((p = strrchr (arg, '.')) != (char *) 0