autoconf
[Top][All Lists]
Advanced

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

Re: Passing -fno-lto by default?


From: Thomas Jahns
Subject: Re: Passing -fno-lto by default?
Date: Thu, 06 Feb 2014 17:30:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10

On 02/06/14 16:48, Markus Trippelsdorf wrote:
> When using gcc with Link Time Optimization (-flto) enabled there are
> certain configuration tests that always fail. For example the following
> test taken from Firefox's configure.in:
>   ac_cv_visibility_default=no
>   if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s 
> >/dev/null 2>&1; then
>     if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
>       ac_cv_visibility_default=yes
> ...
> which greps the assembler output, will not succeed with -flto (because
> it produces GIMPLE output in special sections).

this is broken on so many levels: 1. it totally relies on gcc which is a nice,
if not the nicest, compiler but the scope of autotools is a bit broader, 2. it
relies on the compiler being able to produce assembly equivalents which is
probably possible for any compiler but very far from portable 3. it relies on
the assembly following a particular symbol convention which is probably far from
universal. With cases like this I propose to ask what the intended purpose was
in the first place and look for a saner approach. I can see that JIT software
has special needs but I can see no good way to approach this in a framework
aimed at virtualizing build environments.

> Now my question is if it wouldn't be desirable to have autoconf pass the
> -fno-lto flag automatically by default (instead of requiring each
> project to add it by hand when needed)?

I'm very much opposed to autoconf adding arbitrary compiler flags, especially
those which remove desirable features. Doing so "only" intermediately means the
configure tests essentially run with another environment putting their validity
unnecessarily into question.

My recommendation would be to put some mechanism into your configure.ac that
substitutes/adds to CFLAGS after the configure tests and before AC_OUTPUT and
which is controlled solely by the users. I have this in several of my projects
because profiling/tracing tools frequently must be used as compiler wrappers but
are not up to pass the tests or need extra flags that cannot be used in the 
tests.

Thomas

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

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