Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: Example autoconf code for enabling -Wl,--as-needed from upstream configure script
Date: Sat, 07 Aug 2010 15:25:45
Message-Id: 201008071825.26765.aballier@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: Example autoconf code for enabling -Wl,--as-needed from upstream configure script by Samuli Suominen
1 On Saturday 07 August 2010 18:19:30 Samuli Suominen wrote:
2 > On 08/07/2010 05:58 PM, Alexis Ballier wrote:
3 > > On Saturday 07 August 2010 17:45:02 Samuli Suominen wrote:
4 > >> Could use eyepair or two to doublecheck the example code in:
5 > >>
6 > >> [1] http://bugs.gentoo.org/attachment.cgi?id=241779
7 > >> [2] http://bugs.gentoo.org/show_bug.cgi?id=331527
8 > >
9 > > You should use AC_TRY_LINK or something similar to check for toolchain
10 > > support. Hardcoding a given set of strings matching the version is
11 > > generally not a good way of writing a check; if you check something,
12 > > check it for real.
13 > >
14 > > Also if you pass -Wl,--as-needed to the compiler that's what you should
15 > > check rather than if the supposed linker supports --as-needed; I suppose
16 > > AC_TRY_LINK will do that.
17 >
18 > I tend to agree but have one concern:
19 >
20 > What if some non-GNU ld's are accepting the syntax of -Wl,--as-needed
21 > but is in fact doing something entirely different?
22 >
23 > I just remember one of our prefix devs, not long ago, saying that
24 > happens. I think it was on this ML on different thread but sorry, can't
25 > find the post now...
26 >
27 > Note that flag-o-matic.eclass's check in function no-as-needed() is
28 > checking for GNU as well.
29
30 you can check for both if you prefer, the main problem I see in the original
31 check is that its not checking at all if as-needed works and appends a flag to
32 gcc while it checks only if ld accepts the flag
33
34 A.