* [Qemu-devel] [PATCH] Add options to disable build with debug symbols and override optimization flags.
@ 2011-09-07 2:59 Brad
2011-09-07 7:09 ` Stefan Hajnoczi
2011-09-07 10:46 ` Juan Quintela
0 siblings, 2 replies; 3+ messages in thread
From: Brad @ 2011-09-07 2:59 UTC (permalink / raw)
To: qemu-devel
Add --disable-debug-symbols to disable building with debug
symbols and --optflags to override the optimization flags
passed to the compiler.
---
configure | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index c3044c7..c7948b6 100755
--- a/configure
+++ b/configure
@@ -77,6 +77,7 @@ path_of() {
# default parameters
source_path=`dirname "$0"`
cpu=""
+optflags="-O2"
interp_prefix="/usr/gnemul/qemu-%M"
static="no"
sparc_cpu=""
@@ -136,6 +137,7 @@ kvm="no"
gprof="no"
debug_tcg="no"
debug_mon="no"
+debug_symbols="yes"
debug="no"
strip_opt="yes"
bigendian="no"
@@ -232,13 +234,11 @@ sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
# default flags for all hosts
QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
-CFLAGS="-g $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"
-LDFLAGS="-g $LDFLAGS"
# make source path absolute
source_path=`cd "$source_path"; pwd`
@@ -518,6 +518,8 @@ for opt do
;;
--cc=*)
;;
+ --optflags=*) optflags="$optarg"
+ ;;
--host-cc=*) host_cc="$optarg"
;;
--make=*) make="$optarg"
@@ -588,6 +590,10 @@ for opt do
;;
--disable-debug-mon) debug_mon="no"
;;
+ --enable-debug-symbols) debug_symbols="yes"
+ ;;
+ --disable-debug-symbols) debug_symbols="no"
+ ;;
--enable-debug)
# Enable debugging options that aren't excessively noisy
debug_tcg="yes"
@@ -937,6 +943,7 @@ echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
echo " --cc=CC use C compiler CC [$cc]"
echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
echo " build time"
+echo " --optflags=FLAGS override optimization compiler flags [$optflags]"
echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
echo " --make=MAKE use specified make [$make]"
@@ -2569,8 +2576,13 @@ fi
# End of CC checks
# After here, no more $cc or $ld runs
+if test "$debug_symbols" = "yes" ; then
+ CFLAGS="-g $CFLAGS"
+ LDFLAGS="-g $LDFLAGS"
+fi
+
if test "$debug" = "no" ; then
- CFLAGS="-O2 $CFLAGS"
+ CFLAGS="$optflags $CFLAGS"
fi
# Consult white-list to determine whether to enable werror
--
1.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Add options to disable build with debug symbols and override optimization flags.
2011-09-07 2:59 [Qemu-devel] [PATCH] Add options to disable build with debug symbols and override optimization flags Brad
@ 2011-09-07 7:09 ` Stefan Hajnoczi
2011-09-07 10:46 ` Juan Quintela
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2011-09-07 7:09 UTC (permalink / raw)
To: Brad; +Cc: qemu-devel
On Wed, Sep 7, 2011 at 3:59 AM, Brad <brad@comstyle.com> wrote:
> Add --disable-debug-symbols to disable building with debug
> symbols and --optflags to override the optimization flags
> passed to the compiler.
>
> ---
> configure | 18 +++++++++++++++---
> 1 files changed, 15 insertions(+), 3 deletions(-)
QEMU builds with debug symbols. But during make install the binary is
stripped unless you specify --disable-strip. What is the need for
--disable-debug-symbols?
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Add options to disable build with debug symbols and override optimization flags.
2011-09-07 2:59 [Qemu-devel] [PATCH] Add options to disable build with debug symbols and override optimization flags Brad
2011-09-07 7:09 ` Stefan Hajnoczi
@ 2011-09-07 10:46 ` Juan Quintela
1 sibling, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2011-09-07 10:46 UTC (permalink / raw)
To: Brad; +Cc: qemu-devel
Brad <brad@comstyle.com> wrote:
> Add --disable-debug-symbols to disable building with debug
> symbols and --optflags to override the optimization flags
> passed to the compiler.
> # default flags for all hosts
> QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
> -CFLAGS="-g $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"
> -LDFLAGS="-g $LDFLAGS"
I can understand this part.
>
> # make source path absolute
> source_path=`cd "$source_path"; pwd`
> @@ -518,6 +518,8 @@ for opt do
> ;;
> --cc=*)
> ;;
> + --optflags=*) optflags="$optarg"
> + ;;
> --host-cc=*) host_cc="$optarg"
> ;;
> --make=*) make="$optarg"
No, please. We already have --extra-cflags, --extra-ldflags, no need
for another one.
I haven't tested, but my understanding is that just using:
--extra-cflags="-O0"
to your configure line should fix the "-O2" issue, no?
My understanding is that:
gcc -O2 .... -O0 .....
is understood as -O0, no? Whatever you pass in --extra-cflags is put at
the end of the command line (otherwise, it is a bug somewhere).
> @@ -588,6 +590,10 @@ for opt do
> ;;
> --disable-debug-mon) debug_mon="no"
> ;;
> + --enable-debug-symbols) debug_symbols="yes"
> + ;;
> + --disable-debug-symbols) debug_symbols="no"
> + ;;
> --enable-debug)
> # Enable debugging options that aren't excessively noisy
> debug_tcg="yes
Not really sure if we should add this under the --enable-debug option.
But I can agree with this option.
Later, Juan.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-07 10:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-07 2:59 [Qemu-devel] [PATCH] Add options to disable build with debug symbols and override optimization flags Brad
2011-09-07 7:09 ` Stefan Hajnoczi
2011-09-07 10:46 ` Juan Quintela
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.