qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] configure: disable FORTIFY_SOURCE under clan


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2] configure: disable FORTIFY_SOURCE under clang
Date: Mon, 9 Nov 2015 11:03:14 +0000

On 3 November 2015 at 20:43, John Snow <address@hidden> wrote:
> Some versions of clang may have difficulty compiling glibc headers when
> -D_FORTIFY_SOURCE is used. For example, Clang++ 3.5.0-9.fc22 cannot
> compile glibc's stdio headers when -D_FORTIFY_SOURCE=2 is used. This
> manifests currently as build failures with clang and any arm target.
>
> According to LLVM dev Richard Smith, clang does not target or support
> FORTIFY_SOURCE + glibc, and it should not be relied on.
> "It's still an unsupported combination, and while it might compile, some
> of the checks are unlikely to work because they require a frontend
> inliner to be useful"
>
> See: http://lists.llvm.org/pipermail/cfe-dev/2015-November/045846.html
>
> Conclusion: disable fortify-source if we appear to be using clang instead
> of testing for compile success or failure, which may be incidental or not
> indicative of proper support of the feature.

>  ##########################################
>  # End of CC checks
>  # After here, no more $cc or $ld runs
> @@ -4442,7 +4457,7 @@ fi
>  if test "$gcov" = "yes" ; then
>    CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
>    LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
> -elif test "$debug" = "no" ; then
> +elif test "$fortify_source" = "yes" ; then
>    CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
>  fi

This change means that a non-debug build with clang will no longer
pass -O2 in the CFLAGS, so you get an unoptimized build...

You need to handle fortify_source=yes and debug=no separately.

thanks
-- PMM



reply via email to

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