All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: fix -enable-debug with newer toolchains
@ 2012-06-06  9:03 Avi Kivity
  2012-06-06  9:32 ` Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Avi Kivity @ 2012-06-06  9:03 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

Fedora 17's toolchain wants optimization enabled for _FORTIFY_SOURCE;
so disable _FORTIFY_SOURCE when debugging.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 configure |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index 1f338f8..88d9c5b 100755
--- a/configure
+++ b/configure
@@ -255,7 +255,6 @@ QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
-QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
 if test "$debug_info" = "yes"; then
     CFLAGS="-g $CFLAGS"
@@ -2851,7 +2850,7 @@ fi
 # After here, no more $cc or $ld runs
 
 if test "$debug" = "no" ; then
-  CFLAGS="-O2 $CFLAGS"
+  CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
 fi
 
 # Consult white-list to determine whether to enable werror
-- 
1.7.10.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: fix -enable-debug with newer toolchains
  2012-06-06  9:03 [Qemu-devel] [PATCH] configure: fix -enable-debug with newer toolchains Avi Kivity
@ 2012-06-06  9:32 ` Peter Maydell
  2012-06-12 19:46 ` Eduardo Habkost
  2012-06-20 13:06 ` Anthony Liguori
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2012-06-06  9:32 UTC (permalink / raw)
  To: Avi Kivity; +Cc: qemu-devel, Anthony Liguori

On 6 June 2012 10:03, Avi Kivity <avi@redhat.com> wrote:
> Fedora 17's toolchain wants optimization enabled for _FORTIFY_SOURCE;
> so disable _FORTIFY_SOURCE when debugging.

Well, that sucks, but it seems to be a deliberate change in
upstream glibc to make it warn now :-(  I guess everybody
in the world will have to fix their makefiles...

> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  configure |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 1f338f8..88d9c5b 100755
> --- a/configure
> +++ b/configure
> @@ -255,7 +255,6 @@ QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
>  QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
>  QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
>  QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
> -QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
>  QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
>  if test "$debug_info" = "yes"; then
>     CFLAGS="-g $CFLAGS"
> @@ -2851,7 +2850,7 @@ fi
>  # After here, no more $cc or $ld runs
>
>  if test "$debug" = "no" ; then
> -  CFLAGS="-O2 $CFLAGS"
> +  CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
>  fi

It feels a bit odd to have the FORTIFY_SOURCE define in CFLAGS rather
than QEMU_CFLAGS, but I think it should behave correctly so I think
it's right.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: fix -enable-debug with newer toolchains
  2012-06-06  9:03 [Qemu-devel] [PATCH] configure: fix -enable-debug with newer toolchains Avi Kivity
  2012-06-06  9:32 ` Peter Maydell
@ 2012-06-12 19:46 ` Eduardo Habkost
  2012-06-20 13:06 ` Anthony Liguori
  2 siblings, 0 replies; 4+ messages in thread
From: Eduardo Habkost @ 2012-06-12 19:46 UTC (permalink / raw)
  To: Avi Kivity; +Cc: qemu-devel, Anthony Liguori

On Wed, Jun 06, 2012 at 12:03:18PM +0300, Avi Kivity wrote:
> Fedora 17's toolchain wants optimization enabled for _FORTIFY_SOURCE;
> so disable _FORTIFY_SOURCE when debugging.
> 
> Signed-off-by: Avi Kivity <avi@redhat.com>

I was bitten by this problem too. The patch fixes it for me.

Tested-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

The patch changes behavior a bit, by moving -D_FORTIFY_SOURCE to CFLAGS
instead of QEMU_CFLAGS, but it sounds like a good idea to keep the -O
option and -D_FORTIFY_SOURCE close together (anybody overriding/removing
-O on CFLAGS on the make command-line would need to take care of
-D_FORTIFY_SOURCE as well).


> ---
>  configure |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index 1f338f8..88d9c5b 100755
> --- a/configure
> +++ b/configure
> @@ -255,7 +255,6 @@ QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
>  QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
>  QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
>  QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
> -QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
>  QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
>  if test "$debug_info" = "yes"; then
>      CFLAGS="-g $CFLAGS"
> @@ -2851,7 +2850,7 @@ fi
>  # After here, no more $cc or $ld runs
>  
>  if test "$debug" = "no" ; then
> -  CFLAGS="-O2 $CFLAGS"
> +  CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
>  fi
>  
>  # Consult white-list to determine whether to enable werror
> -- 
> 1.7.10.1
> 

-- 
Eduardo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: fix -enable-debug with newer toolchains
  2012-06-06  9:03 [Qemu-devel] [PATCH] configure: fix -enable-debug with newer toolchains Avi Kivity
  2012-06-06  9:32 ` Peter Maydell
  2012-06-12 19:46 ` Eduardo Habkost
@ 2012-06-20 13:06 ` Anthony Liguori
  2 siblings, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2012-06-20 13:06 UTC (permalink / raw)
  To: Avi Kivity; +Cc: qemu-devel

On 06/06/2012 04:03 AM, Avi Kivity wrote:
> Fedora 17's toolchain wants optimization enabled for _FORTIFY_SOURCE;
> so disable _FORTIFY_SOURCE when debugging.
>
> Signed-off-by: Avi Kivity<avi@redhat.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   configure |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 1f338f8..88d9c5b 100755
> --- a/configure
> +++ b/configure
> @@ -255,7 +255,6 @@ QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
>   QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
>   QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
>   QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
> -QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
>   QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
>   if test "$debug_info" = "yes"; then
>       CFLAGS="-g $CFLAGS"
> @@ -2851,7 +2850,7 @@ fi
>   # After here, no more $cc or $ld runs
>
>   if test "$debug" = "no" ; then
> -  CFLAGS="-O2 $CFLAGS"
> +  CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
>   fi
>
>   # Consult white-list to determine whether to enable werror

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-20 13:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-06  9:03 [Qemu-devel] [PATCH] configure: fix -enable-debug with newer toolchains Avi Kivity
2012-06-06  9:32 ` Peter Maydell
2012-06-12 19:46 ` Eduardo Habkost
2012-06-20 13:06 ` Anthony Liguori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.