diff mbox

Don’t insert white space in ‘orig_option_with_args_text’ for OPT_l

Message ID 87ipidvl7h.fsf@inria.fr
State New
Headers show

Commit Message

Ludovic =?iso-8859-1?Q?Court=E8s?= March 9, 2012, 3:38 p.m. UTC
Hi,

This patch changes ‘generate_option’ to not insert any white spaces
after ‘-l’.

This fixes a problem introduced in GCC 4.6 (r163459) whereby
‘gfortran -v’ would emit erroneous strings like this:

  Driving: […] -l gfortran -l m -shared-libgcc […]

Note the space after ‘-l’.

(In turn, that would confuse Libtool’s ‘_LT_SYS_HIDDEN_LIBDEPS’ macro,
which would determine something like this:

  postdeps="[…] -L/nix/store/wnzgsfhmb3ys5ssfgpcpwjnmdzn717mk-gfortran-4.6.3/lib -l -l […]"

eventually leading to a link command-line like this:

  libtool: link: gfortran -shared […] -l -L/nix/store/blsdhiik2lk4zmz3hbzf77g6hcrq7ckx-gfortran-wrapper-4.6.3/bin […]

leading to an error like:

  ld: cannot find -l-L/nix/store/blsdhiik2lk4zmz3hbzf77g6hcrq7ckx-gfortran-wrapper-4.6.3/bin

Ouch!)

Thanks,
Ludo’.

2012-03-09  Ludovic Courtès  <ludovic.courtes@inria.fr>

	* gcc/opts-common.c (generate_option): Don't insert white space in
	`canonical_option' when OPT_INDEX is OPT_l.
diff mbox

Patch

diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 354bce0..60ec02d 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -931,6 +931,12 @@  generate_option (size_t opt_index, const char *arg, int value,
       break;
 
     case 2:
+      if (opt_index == OPT_l)
+	/* Don't insert any white spaces between `-l' and its argument.  */
+	decoded->orig_option_with_args_text
+	  = concat (decoded->canonical_option[0],
+		    decoded->canonical_option[1], NULL);
+      else
       decoded->orig_option_with_args_text
 	= concat (decoded->canonical_option[0], " ",
 		  decoded->canonical_option[1], NULL);