public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Don’t insert white space in ‘orig_option_with_args_text’ for OPT_l
@ 2012-03-09 15:38 Ludovic Courtès
  2012-03-09 17:28 ` [PATCH] Don't insert white space in 'orig_option_with_args_text' " Joseph S. Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2012-03-09 15:38 UTC (permalink / raw)
  To: gcc-patches


[-- Attachment #1.1: Type: text/plain, Size: 1051 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: Type: text/x-patch, Size: 630 bytes --]

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);

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-29  8:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09 15:38 [PATCH] Don’t insert white space in ‘orig_option_with_args_text’ for OPT_l Ludovic Courtès
2012-03-09 17:28 ` [PATCH] Don't insert white space in 'orig_option_with_args_text' " Joseph S. Myers
2012-03-12 11:02   ` Ludovic Courtès
2012-03-12 12:41     ` Joseph S. Myers
2012-03-13 10:12       ` Ludovic Courtès
2012-03-29  8:38         ` [PATCH, ping #1] " Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).