autoconf
[Top][All Lists]
Advanced

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

Re: Autoconf does not like "-D_FORTIFY_SOURCE=2 -O2"


From: Zack Weinberg
Subject: Re: Autoconf does not like "-D_FORTIFY_SOURCE=2 -O2"
Date: Wed, 8 May 2013 10:00:41 -0400

On Wed, May 8, 2013 at 1:17 AM, Allan McRae <address@hidden> wrote:
> Our distribution packages are compiled with:
>
> CPPFLAGS="-D_FORTIFY_SOURCE=2"
> CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector
> --param=ssp-buffer-size=4"
>
> So when both CPPFLAGS and CFLAGS are passed there is no issue.

I think the quick fix from your end is to move -D_FORTIFY_SOURCE to
CFLAGS (and presumably also CXXFLAGS).  Despite being a -D switch its
*effect* is much more like an -m or -f switch, so I don't think this
is even technically wrong, and it'll have the results you need.

> I have not looked into this in great detail yet, but it seems some
> configure scripts have this in them:
>
> ac_cpp='$CPP $CPPFLAGS'
>
> and this is used to test for header presence.  Note I said some
> configure scripts - I have not figured out why others do not use
> CPPFLAGS in this test.

The low-hanging fruit here is AC_CHECK_HEADER, which currently by
default does a "double check" for the presence of a header, one of
them using only CPPFLAGS.  Some extra-diligent projects have switched
over to doing only a compile check.  I have patches mostly written
that will make the default be compile-only.  However, anyone that
deliberately uses AC_PREPROC_IFELSE or similar will still have the
problem.

>>> recent versions of glibc produces a
>>> warning when it compiles apps with _FORTIFY_SOURCE but without -O2
>>
>> That's a real problem, which will break lots of things.
>> Fix that, and your Autoconf issue will go away.
>
> I don't agree that the glibc warning is an issue.  Unless you use
> -Werror (bad) or check for any warning rather than a specific one.

Autoconf can't check for specific warnings because it has no way of
knowing how the compiler in use will react to any given (potential)
problem.

I note that Debian has patched this warning out of their (just now
appeared in unstable) glibc 2.17.  See
http://anonscm.debian.org/viewvc/pkg-glibc/glibc-package/trunk/debian/patches/any/local-revert-bz13979.diff?revision=5553&view=markup

zw



reply via email to

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