libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_PROG_LD


From: John David Anglin
Subject: Re: AC_PROG_LD
Date: Fri, 20 Dec 2002 16:29:22 -0500 (EST)

Robert,

I have submitted a gcc PR (9031) on the issue.

There is a problem with the macro:

# gcc -v -print-prog-name=ld
Reading specs from /opt/gnu64/lib/gcc-lib/hppa64-hp-hpux11.11/3.3/specs
/usr/ccs/bin/ld

Then, during configure
checking for ld used by GCC... ld

The ld used by gcc is /usr/ccs/bin/ld and it is never overridden by
what's in LD.

libtool uses gcc for linking and we need to ensure that appropriate
linker options are passed to the gcc linker.  Thus, the libtool
configuration process needs to determine the linker used by gcc
and its type in order to correctly set options for it.  It should
ignore what's in LD unless it sometimes uses it for linking as well.
Do you you see this as a viable approach?

I'm not arguing about your not wanting to clobber LD.  If there
was a way to override the LD default in Cygnus configure, a user
would have to always define LD to the gcc linker if the linker
used by gcc wasn't ld.  This isn't obvious, so I think it's the
wrong approach.

> John,
> 
> So long as Cygnus configure doesn't clobber your LD setting
> you should be able to run AC_PROG_LD before.  I refuse to
> clobber LD, this isn't supposed to happen so a better approach
> would be to fix Cygnus configure so that it won't clobber LD
> rather than teaching Libtool to re-clobber it.  It isn't often
> I have a strong opinion about a patch, but this qualifies.
> 
> HTH,
> 
> Robert
> 
> -----Original Message-----
> From: John David Anglin [mailto:address@hidden
> Sent: Friday, December 20, 2002 1:33 PM
> To: address@hidden
> Cc: address@hidden
> Subject: Re: AC_PROG_LD
> 
> 
> Robert,
> 
> I am not setting LD explicitly.  LD is set by Cygnus configure.
> Currently, Cygnus configure doesn't allow you to override the
> default that it sets for LD.  If the ld used by gcc is not ld,
> AC_PROG_LD doesn't set LD, and libtool uses the wrong linker.
> Cygnus configure has no way of knowing that libtool needs the
> ld used by gcc.
> 
> > John,
> > 
> > After careful consideration, I've decided to reject this patch.
> > To control "configure" users can set many variables, CC, CXX, SED
> > and LD.  Any checks that might set these variables has to test
> > to see if the user, or perhaps a top-level configure.ac macro,
> > has explicitly set it.  Breaking this for any of these shell variables
> > would change expected behavior.  As I see the problem you're running
> > into,
> > it is caused by incorrectly setting $LD explicitly.  I would suggest
> 
> > 
> > HTH,
> > 
> > Robert
> > 
> > John David Anglin wrote:
> > > 
> > > The toplevel configure scripts in binutils and gcc define LD=ld in
> native
> > > (non-canadian cross) builds.  This causes the AC_PROG_LD to select the
> > > default value of ld.  As result, packages are misconfigured if the
> linker
> > > used by GCC is not ld.  In the case of binutils, this causes a build
> > > error linking libbfd due to incorrect linker options being selected by
> > > libtool.
> > > 
> > > The enclosed patch changes the behavior of AC_PROG_LD to choose the GCC
> > > linker when it encounters the default value of "ld".  The other possible
> > > fix is to not define LD in the toplevel configure script.  However, as
> > > this is used for many different packages, I think there are
> circumstances
> > > when libtool is not being used that require a default value for LD.
> > > 
> > > Dave
> > > --
> > > J. David Anglin                                  address@hidden
> > > National Research Council of Canada              (613) 990-0752 (FAX:
> 952-6605)
> > > 
> > > 2002-12-17  John David Anglin  <address@hidden>
> > > 
> > >         * libtool.m4 (AC_PROG_LD): Use ld used by GCC when LD is set to
> "ld".
> > > 
> > > Index: libtool.m4
> > > ===================================================================
> > > RCS file: /home/cvs/libtool/libtool.m4,v
> > > retrieving revision 1.280
> > > diff -u -3 -p -r1.280 libtool.m4
> > > --- libtool.m4  11 Dec 2002 19:44:59 -0000      1.280
> > > +++ libtool.m4  17 Dec 2002 18:56:42 -0000
> > > @@ -1875,7 +1875,9 @@ if test "$GCC" = yes; then
> > >        while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> > >         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> > >        done
> > > -      test -z "$LD" && LD="$ac_prog"
> > > +      if test -z "$LD" || test "$LD" = ld; then
> > > +       LD="$ac_prog"
> > > +      fi
> > >        ;;
> > >    "")
> > >      # If it fails, then pretend we aren't using GCC.
> > > 
> > > _______________________________________________
> > > Libtool-patches mailing list
> > > address@hidden
> > > http://mail.gnu.org/mailman/listinfo/libtool-patches
> > 
> 
> 
> -- 
> J. David Anglin                                  address@hidden
> National Research Council of Canada              (613) 990-0752 (FAX:
> 952-6605)
> 
> 
> _______________________________________________
> Libtool-patches mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/libtool-patches
> 
> ------_=_NextPart_001_01C2A866.6BCE06B0
> Content-Type: text/html
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <HTML>
> <HEAD>
> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
> <TITLE>RE: AC_PROG_LD</TITLE>
> </HEAD>
> <BODY>
> 
> <P><FONT SIZE=2>John,</FONT>
> </P>
> 
> <P><FONT SIZE=2>So long as Cygnus configure doesn't clobber your LD 
> setting</FONT>
> <BR><FONT SIZE=2>you should be able to run AC_PROG_LD before.&nbsp; I refuse 
> to</FONT>
> <BR><FONT SIZE=2>clobber LD, this isn't supposed to happen so a better 
> approach</FONT>
> <BR><FONT SIZE=2>would be to fix Cygnus configure so that it won't clobber 
> LD</FONT>
> <BR><FONT SIZE=2>rather than teaching Libtool to re-clobber it.&nbsp; It 
> isn't often</FONT>
> <BR><FONT SIZE=2>I have a strong opinion about a patch, but this 
> qualifies.</FONT>
> </P>
> 
> <P><FONT SIZE=2>HTH,</FONT>
> </P>
> 
> <P><FONT SIZE=2>Robert</FONT>
> </P>
> 
> <P><FONT SIZE=2>-----Original Message-----</FONT>
> <BR><FONT SIZE=2>From: John David Anglin [<A 
> HREF="mailto:address@hidden";>mailto:address@hidden</A>]</FONT>
> <BR><FONT SIZE=2>Sent: Friday, December 20, 2002 1:33 PM</FONT>
> <BR><FONT SIZE=2>To: address@hidden</FONT>
> <BR><FONT SIZE=2>Cc: address@hidden</FONT>
> <BR><FONT SIZE=2>Subject: Re: AC_PROG_LD</FONT>
> </P>
> <BR>
> 
> <P><FONT SIZE=2>Robert,</FONT>
> </P>
> 
> <P><FONT SIZE=2>I am not setting LD explicitly.&nbsp; LD is set by Cygnus 
> configure.</FONT>
> <BR><FONT SIZE=2>Currently, Cygnus configure doesn't allow you to override 
> the</FONT>
> <BR><FONT SIZE=2>default that it sets for LD.&nbsp; If the ld used by gcc is 
> not ld,</FONT>
> <BR><FONT SIZE=2>AC_PROG_LD doesn't set LD, and libtool uses the wrong 
> linker.</FONT>
> <BR><FONT SIZE=2>Cygnus configure has no way of knowing that libtool needs 
> the</FONT>
> <BR><FONT SIZE=2>ld used by gcc.</FONT>
> </P>
> 
> <P><FONT SIZE=2>&gt; John,</FONT>
> <BR><FONT SIZE=2>&gt; </FONT>
> <BR><FONT SIZE=2>&gt; After careful consideration, I've decided to reject 
> this patch.</FONT>
> <BR><FONT SIZE=2>&gt; To control &quot;configure&quot; users can set many 
> variables, CC, CXX, SED</FONT>
> <BR><FONT SIZE=2>&gt; and LD.&nbsp; Any checks that might set these variables 
> has to test</FONT>
> <BR><FONT SIZE=2>&gt; to see if the user, or perhaps a top-level configure.ac 
> macro,</FONT>
> <BR><FONT SIZE=2>&gt; has explicitly set it.&nbsp; Breaking this for any of 
> these shell variables</FONT>
> <BR><FONT SIZE=2>&gt; would change expected behavior.&nbsp; As I see the 
> problem you're running</FONT>
> <BR><FONT SIZE=2>&gt; into,</FONT>
> <BR><FONT SIZE=2>&gt; it is caused by incorrectly setting $LD 
> explicitly.&nbsp; I would suggest</FONT>
> </P>
> 
> <P><FONT SIZE=2>&gt; </FONT>
> <BR><FONT SIZE=2>&gt; HTH,</FONT>
> <BR><FONT SIZE=2>&gt; </FONT>
> <BR><FONT SIZE=2>&gt; Robert</FONT>
> <BR><FONT SIZE=2>&gt; </FONT>
> <BR><FONT SIZE=2>&gt; John David Anglin wrote:</FONT>
> <BR><FONT SIZE=2>&gt; &gt; </FONT>
> <BR><FONT SIZE=2>&gt; &gt; The toplevel configure scripts in binutils and gcc 
> define LD=ld in native</FONT>
> <BR><FONT SIZE=2>&gt; &gt; (non-canadian cross) builds.&nbsp; This causes the 
> AC_PROG_LD to select the</FONT>
> <BR><FONT SIZE=2>&gt; &gt; default value of ld.&nbsp; As result, packages are 
> misconfigured if the linker</FONT>
> <BR><FONT SIZE=2>&gt; &gt; used by GCC is not ld.&nbsp; In the case of 
> binutils, this causes a build</FONT>
> <BR><FONT SIZE=2>&gt; &gt; error linking libbfd due to incorrect linker 
> options being selected by</FONT>
> <BR><FONT SIZE=2>&gt; &gt; libtool.</FONT>
> <BR><FONT SIZE=2>&gt; &gt; </FONT>
> <BR><FONT SIZE=2>&gt; &gt; The enclosed patch changes the behavior of 
> AC_PROG_LD to choose the GCC</FONT>
> <BR><FONT SIZE=2>&gt; &gt; linker when it encounters the default value of 
> &quot;ld&quot;.&nbsp; The other possible</FONT>
> <BR><FONT SIZE=2>&gt; &gt; fix is to not define LD in the toplevel configure 
> script.&nbsp; However, as</FONT>
> <BR><FONT SIZE=2>&gt; &gt; this is used for many different packages, I think 
> there are circumstances</FONT>
> <BR><FONT SIZE=2>&gt; &gt; when libtool is not being used that require a 
> default value for LD.</FONT>
> <BR><FONT SIZE=2>&gt; &gt; </FONT>
> <BR><FONT SIZE=2>&gt; &gt; Dave</FONT>
> <BR><FONT SIZE=2>&gt; &gt; --</FONT>
> <BR><FONT SIZE=2>&gt; &gt; J. David 
> Anglin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  address@hidden</FONT>
> <BR><FONT SIZE=2>&gt; &gt; National Research Council of 
> Canada&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  (613) 990-0752 (FAX: 952-6605)</FONT>
> <BR><FONT SIZE=2>&gt; &gt; </FONT>
> <BR><FONT SIZE=2>&gt; &gt; 2002-12-17&nbsp; John David Anglin&nbsp; 
> &lt;address@hidden&gt;</FONT>
> <BR><FONT SIZE=2>&gt; &gt; </FONT>
> <BR><FONT SIZE=2>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * 
> libtool.m4 (AC_PROG_LD): Use ld used by GCC when LD is set to 
> &quot;ld&quot;.</FONT>
> <BR><FONT SIZE=2>&gt; &gt; </FONT>
> <BR><FONT SIZE=2>&gt; &gt; Index: libtool.m4</FONT>
> <BR><FONT SIZE=2>&gt; &gt; 
> ===================================================================</FONT>
> <BR><FONT SIZE=2>&gt; &gt; RCS file: /home/cvs/libtool/libtool.m4,v</FONT>
> <BR><FONT SIZE=2>&gt; &gt; retrieving revision 1.280</FONT>
> <BR><FONT SIZE=2>&gt; &gt; diff -u -3 -p -r1.280 libtool.m4</FONT>
> <BR><FONT SIZE=2>&gt; &gt; --- libtool.m4&nbsp; 11 Dec 2002 19:44:59 
> -0000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.280</FONT>
> <BR><FONT SIZE=2>&gt; &gt; +++ libtool.m4&nbsp; 17 Dec 2002 18:56:42 
> -0000</FONT>
> <BR><FONT SIZE=2>&gt; &gt; @@ -1875,7 +1875,9 @@ if test &quot;$GCC&quot; = 
> yes; then</FONT>
> <BR><FONT SIZE=2>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while 
> echo $ac_prog | grep &quot;$re_direlt&quot; &gt; /dev/null 2&gt;&amp;1; 
> do</FONT>
> <BR><FONT SIZE=2>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> ac_prog=`echo $ac_prog| sed &quot;s%$re_direlt%/%&quot;`</FONT>
> <BR><FONT SIZE=2>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> done</FONT>
> <BR><FONT SIZE=2>&gt; &gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test -z 
> &quot;$LD&quot; &amp;&amp; LD=&quot;$ac_prog&quot;</FONT>
> <BR><FONT SIZE=2>&gt; &gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if test -z 
> &quot;$LD&quot; || test &quot;$LD&quot; = ld; then</FONT>
> <BR><FONT SIZE=2>&gt; &gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> LD=&quot;$ac_prog&quot;</FONT>
> <BR><FONT SIZE=2>&gt; &gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi</FONT>
> <BR><FONT SIZE=2>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;</FONT>
> <BR><FONT SIZE=2>&gt; &gt;&nbsp;&nbsp;&nbsp; &quot;&quot;)</FONT>
> <BR><FONT SIZE=2>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # If it fails, then 
> pretend we aren't using GCC.</FONT>
> <BR><FONT SIZE=2>&gt; &gt; </FONT>
> <BR><FONT SIZE=2>&gt; &gt; 
> _______________________________________________</FONT>
> <BR><FONT SIZE=2>&gt; &gt; Libtool-patches mailing list</FONT>
> <BR><FONT SIZE=2>&gt; &gt; address@hidden</FONT>
> <BR><FONT SIZE=2>&gt; &gt; <A 
> HREF="http://mail.gnu.org/mailman/listinfo/libtool-patches"; 
> TARGET="_blank">http://mail.gnu.org/mailman/listinfo/libtool-patches</A></FONT>
> <BR><FONT SIZE=2>&gt; </FONT>
> </P>
> <BR>
> 
> <P><FONT SIZE=2>-- </FONT>
> <BR><FONT SIZE=2>J. David 
> Anglin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  address@hidden</FONT>
> <BR><FONT SIZE=2>National Research Council of 
> Canada&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  (613) 990-0752 (FAX: 952-6605)</FONT>
> </P>
> <BR>
> 
> <P><FONT SIZE=2>_______________________________________________</FONT>
> <BR><FONT SIZE=2>Libtool-patches mailing list</FONT>
> <BR><FONT SIZE=2>address@hidden</FONT>
> <BR><FONT SIZE=2><A 
> HREF="http://mail.gnu.org/mailman/listinfo/libtool-patches"; 
> TARGET="_blank">http://mail.gnu.org/mailman/listinfo/libtool-patches</A></FONT>
> </P>
> 
> </BODY>
> </HTML>
> ------_=_NextPart_001_01C2A866.6BCE06B0--
> 


-- 
J. David Anglin                                  address@hidden
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]