diff gcc/gcc-ar.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/gcc-ar.c	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/gcc-ar.c	Thu Oct 25 07:37:49 2018 +0900
@@ -1,5 +1,5 @@
 /* Wrapper for ar/ranlib/nm to pass the LTO plugin.
-   Copyright (C) 2011-2017 Free Software Foundation, Inc.
+   Copyright (C) 2011-2018 Free Software Foundation, Inc.
    Contributed by Andi Kleen.
 
 This file is part of GCC.
@@ -126,7 +126,9 @@
 main (int ac, char **av)
 {
   const char *exe_name;
+#if HAVE_LTO_PLUGIN > 0
   char *plugin;
+#endif
   int k, status, err;
   const char *err_msg;
   const char **nargv;
@@ -177,7 +179,7 @@
 	  break;
 	}
 
-
+#if HAVE_LTO_PLUGIN > 0
   /* Find the GCC LTO plugin */
   plugin = find_a_file (&target_path, LTOPLUGINSONAME, R_OK);
   if (!plugin)
@@ -185,6 +187,7 @@
       fprintf (stderr, "%s: Cannot find plugin '%s'\n", av[0], LTOPLUGINSONAME);
       exit (1);
     }
+#endif
 
   /* Find the wrapped binutils program.  */
   exe_name = find_a_file (&target_path, PERSONALITY, X_OK);
@@ -203,9 +206,11 @@
 	}
     }
 
-  /* Create new command line with plugin */
+  /* Create new command line with plugin - if we have one, otherwise just
+     copy the command through.  */
   nargv = XCNEWVEC (const char *, ac + 4);
   nargv[0] = exe_name;
+#if HAVE_LTO_PLUGIN > 0
   nargv[1] = "--plugin";
   nargv[2] = plugin;
   if (is_ar && av[1] && av[1][0] != '-')
@@ -213,6 +218,13 @@
   for (k = 1; k < ac; k++)
     nargv[2 + k] = av[k];
   nargv[2 + k] = NULL;
+#else
+  if (is_ar && av[1] && av[1][0] != '-')
+    av[1] = concat ("-", av[1], NULL);
+  for (k = 1; k < ac; k++)
+    nargv[k] = av[k];
+  nargv[k] = NULL;
+#endif
 
   /* Run utility */
   /* ??? the const is misplaced in pex_one's argv? */