Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Development (http://www.linux-archive.org/gentoo-development/)
-   -   RFC: Example autoconf code for enabling -Wl,--as-needed from upstream configure script (http://www.linux-archive.org/gentoo-development/409787-rfc-example-autoconf-code-enabling-wl-needed-upstream-configure-script.html)

Samuli Suominen 08-07-2010 03:19 PM

RFC: Example autoconf code for enabling -Wl,--as-needed from upstream configure script
 
On 08/07/2010 05:58 PM, Alexis Ballier wrote:
> On Saturday 07 August 2010 17:45:02 Samuli Suominen wrote:
>> Could use eyepair or two to doublecheck the example code in:
>>
>> [1] http://bugs.gentoo.org/attachment.cgi?id=241779
>> [2] http://bugs.gentoo.org/show_bug.cgi?id=331527
>
> You should use AC_TRY_LINK or something similar to check for toolchain
> support. Hardcoding a given set of strings matching the version is generally
> not a good way of writing a check; if you check something, check it for real.
>
> Also if you pass -Wl,--as-needed to the compiler that's what you should check
> rather than if the supposed linker supports --as-needed; I suppose AC_TRY_LINK
> will do that.

I tend to agree but have one concern:

What if some non-GNU ld's are accepting the syntax of -Wl,--as-needed
but is in fact doing something entirely different?

I just remember one of our prefix devs, not long ago, saying that
happens. I think it was on this ML on different thread but sorry, can't
find the post now...

Note that flag-o-matic.eclass's check in function no-as-needed() is
checking for GNU as well.

Alexis Ballier 08-07-2010 03:25 PM

RFC: Example autoconf code for enabling -Wl,--as-needed from upstream configure script
 
On Saturday 07 August 2010 18:19:30 Samuli Suominen wrote:
> On 08/07/2010 05:58 PM, Alexis Ballier wrote:
> > On Saturday 07 August 2010 17:45:02 Samuli Suominen wrote:
> >> Could use eyepair or two to doublecheck the example code in:
> >>
> >> [1] http://bugs.gentoo.org/attachment.cgi?id=241779
> >> [2] http://bugs.gentoo.org/show_bug.cgi?id=331527
> >
> > You should use AC_TRY_LINK or something similar to check for toolchain
> > support. Hardcoding a given set of strings matching the version is
> > generally not a good way of writing a check; if you check something,
> > check it for real.
> >
> > Also if you pass -Wl,--as-needed to the compiler that's what you should
> > check rather than if the supposed linker supports --as-needed; I suppose
> > AC_TRY_LINK will do that.
>
> I tend to agree but have one concern:
>
> What if some non-GNU ld's are accepting the syntax of -Wl,--as-needed
> but is in fact doing something entirely different?
>
> I just remember one of our prefix devs, not long ago, saying that
> happens. I think it was on this ML on different thread but sorry, can't
> find the post now...
>
> Note that flag-o-matic.eclass's check in function no-as-needed() is
> checking for GNU as well.

you can check for both if you prefer, the main problem I see in the original
check is that its not checking at all if as-needed works and appends a flag to
gcc while it checks only if ld accepts the flag

A.

Mike Frysinger 08-07-2010 10:07 PM

RFC: Example autoconf code for enabling -Wl,--as-needed from upstream configure script
 
On Saturday, August 07, 2010 10:45:02 Samuli Suominen wrote:
> Could use eyepair or two to doublecheck the example code in:

how about you let someone else deal with it:
http://www.gnu.org/software/autoconf-archive/ax_check_linker_flags.html
-mike

Samuli Suominen 08-09-2010 09:47 PM

RFC: Example autoconf code for enabling -Wl,--as-needed from upstream configure script
 
On 08/08/2010 01:07 AM, Mike Frysinger wrote:
> On Saturday, August 07, 2010 10:45:02 Samuli Suominen wrote:
>> Could use eyepair or two to doublecheck the example code in:
>
> how about you let someone else deal with it:
> http://www.gnu.org/software/autoconf-archive/ax_check_linker_flags.html
> -mike

thanks, didn't know about that macro. will make use of it in the bug.


All times are GMT. The time now is 11:34 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.