Comments
Patch
@@ -392,6 +392,9 @@ i[34567]86-*-*)
if test "x$enable_cld" = xyes; then
tm_defines="${tm_defines} USE_IX86_CLD=1"
fi
+ if test "x$enable_frame_pointer" = xyes; then
+ tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1"
+ fi
tm_file="vxworks-dummy.h ${tm_file}"
;;
x86_64-*-*)
@@ -399,6 +402,9 @@ x86_64-*-*)
if test "x$enable_cld" = xyes; then
tm_defines="${tm_defines} USE_IX86_CLD=1"
fi
+ if test "x$enable_frame_pointer" = xyes; then
+ tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1"
+ fi
tm_file="vxworks-dummy.h ${tm_file}"
;;
esac
@@ -2839,28 +2839,6 @@ override_options (bool main_args_p)
if (TARGET_MACHO && TARGET_64BIT)
flag_pic = 2;
- /* Set the default values for switches whose default depends on TARGET_64BIT
- in case they weren't overwritten by command line options. */
- if (TARGET_64BIT)
- {
- /* Mach-O doesn't support omitting the frame pointer for now. */
- if (flag_omit_frame_pointer == 2)
- flag_omit_frame_pointer = (TARGET_MACHO ? 0 : 1);
- if (flag_asynchronous_unwind_tables == 2)
- flag_asynchronous_unwind_tables = 1;
- if (flag_pcc_struct_return == 2)
- flag_pcc_struct_return = 0;
- }
- else
- {
- if (flag_omit_frame_pointer == 2)
- flag_omit_frame_pointer = 0;
- if (flag_asynchronous_unwind_tables == 2)
- flag_asynchronous_unwind_tables = 0;
- if (flag_pcc_struct_return == 2)
- flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
- }
-
/* Need to check -mtune=generic first. */
if (ix86_tune_string)
{
@@ -3148,6 +3126,34 @@ override_options (bool main_args_p)
for (i = 0; i < X86_TUNE_LAST; ++i)
ix86_tune_features[i] = !!(initial_ix86_tune_features[i] & ix86_tune_mask);
+#ifndef USE_IX86_FRAME_POINTER
+#define USE_IX86_FRAME_POINTER 0
+#endif
+
+ /* Set the default values for switches whose default depends on TARGET_64BIT
+ in case they weren't overwritten by command line options. */
+ if (TARGET_64BIT)
+ {
+ /* Mach-O doesn't support omitting the frame pointer for now. */
+ if (flag_omit_frame_pointer == 2)
+ flag_omit_frame_pointer = (TARGET_MACHO ? 0 : 1);
+ if (flag_asynchronous_unwind_tables == 2)
+ flag_asynchronous_unwind_tables = 1;
+ if (flag_pcc_struct_return == 2)
+ flag_pcc_struct_return = 0;
+ }
+ else
+ {
+ /* Mach-O doesn't support omitting the frame pointer for now. */
+ if (flag_omit_frame_pointer == 2)
+ flag_omit_frame_pointer =
+ (TARGET_MACHO ? 0 : !(USE_IX86_FRAME_POINTER || optimize_size));
+ if (flag_asynchronous_unwind_tables == 2)
+ flag_asynchronous_unwind_tables = !USE_IX86_FRAME_POINTER;
+ if (flag_pcc_struct_return == 2)
+ flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
+ }
+
if (optimize_size)
ix86_cost = &ix86_size_cost;
else
@@ -3430,7 +3436,8 @@ override_options (bool main_args_p)
prefix, suffix, sw);
}
- if ((x86_accumulate_outgoing_args & ix86_tune_mask)
+ if ((!USE_IX86_FRAME_POINTER
+ || (x86_accumulate_outgoing_args & ix86_tune_mask))
&& !(target_flags_explicit & MASK_ACCUMULATE_OUTGOING_ARGS)
&& !optimize_size)
target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
@@ -897,6 +897,7 @@ with_system_libunwind
enable_secureplt
enable_leading_mingw64_underscores
enable_cld
+enable_frame_pointer
enable_win32_registry
enable_static
with_pic
@@ -1596,6 +1597,7 @@ Optional Features:
--enable-leading-mingw64-underscores
Enable leading underscores on 64 bit mingw targets
--enable-cld enable -mcld by default for 32bit x86
+ --enable-frame-pointer enable -fno-omit-frame-pointer by default for 32bit x86
--disable-win32-registry
disable lookup of installation paths in the
Registry on Windows hosts
@@ -10707,6 +10709,24 @@ else
fi
+# Check whether --enable-frame-pointer was given.
+if test "${enable_frame_pointer+set}" = set; then :
+ enableval=$enable_frame_pointer;
+else
+
+case $target_os in
+linux*)
+ # Enable -fomit-frame-pointer by default for Linux.
+ enable_frame_pointer=no
+ ;;
+*)
+ enable_frame_pointer=yes
+ ;;
+esac
+
+fi
+
+
# Windows32 Registry support for specifying GCC installation paths.
# Check whether --enable-win32-registry was given.
if test "${enable_win32_registry+set}" = set; then :
@@ -17108,7 +17128,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17111 "configure"
+#line 17131 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17214,7 +17234,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17217 "configure"
+#line 17237 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -1580,6 +1580,20 @@ AC_ARG_ENABLE(cld,
[ --enable-cld enable -mcld by default for 32bit x86], [],
[enable_cld=no])
+AC_ARG_ENABLE(frame-pointer,
+[ --enable-frame-pointer enable -fno-omit-frame-pointer by default for 32bit x86], [],
+[
+case $target_os in
+linux*)
+ # Enable -fomit-frame-pointer by default for Linux.
+ enable_frame_pointer=no
+ ;;
+*)
+ enable_frame_pointer=yes
+ ;;
+esac
+])
+
# Windows32 Registry support for specifying GCC installation paths.
AC_ARG_ENABLE(win32-registry,
[ --disable-win32-registry
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
-/* { dg-options "-O2 -fomit-frame-pointer -mpush-args -mno-accumulate-outgoing-args" } */
+/* { dg-options "-O2 -fomit-frame-pointer -fno-asynchronous-unwind-tables -mpush-args -mno-accumulate-outgoing-args" } */
void abort (void);
@@ -1,6 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
-/* { dg-options "-O2 -fomit-frame-pointer -mpush-args -mno-accumulate-outgoing-args -m128bit-long-double" } */
+/* { dg-options "-O2 -fomit-frame-pointer -fno-asynchronous-unwind-tables -mpush-args -mno-accumulate-outgoing-args -m128bit-long-double" } */
void abort (void);
@@ -1,7 +1,7 @@
/* { dg-do run { target *-*-linux* } } */
/* { dg-require-effective-target ilp32 } */
/* { dg-require-effective-target sse2 } */
-/* { dg-options "-O2 -fomit-frame-pointer -msse2 -mpush-args -mno-accumulate-outgoing-args" } */
+/* { dg-options "-O2 -fomit-frame-pointer -fno-asynchronous-unwind-tables -msse2 -mpush-args -mno-accumulate-outgoing-args" } */
#include "sse2-check.h"
Hi, Here are patches to backport turning on -fomit-frame-pointer by default for 32bit Linux/x86 to ix86/gcc-4_4-branch and ix86/gcc-4_5-branch. H.J. gcc/ 2010-08-12 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline 2010-08-12 H.J. Lu <hongjiu.lu@intel.com> Uros Bizjak <ubizjak@gmail.com> * config.gcc: Handle --enable-frame-pointer. * configure.ac: Add --enable-frame-pointer. * configure: Regenerated. * config/i386/i386.c (USE_IX86_FRAME_POINTER): Default to 0. (override_options): If not configured with --enable-frame-pointer, enable -fomit-frame-pointer (but not for TARGET_MACHO or when optimizing for size), -fasynchronous-unwind-tables and -maccumulate-outgoing-args by default. gcc/testsuite/ 2010-08-12 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline 2010-08-12 Uros Bizjak <ubizjak@gmail.com> * gcc.target/i386/pr40906-1.c: Add -fno-asynchronous-unwind-tables to dg-options. * gcc.target/i386/pr40906-2.c: Ditto. * gcc.target/i386/pr40906-3.c: Ditto. gcc/ 2010-08-12 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline 2010-08-12 H.J. Lu <hongjiu.lu@intel.com> Uros Bizjak <ubizjak@gmail.com> * config.gcc: Handle --enable-frame-pointer. * configure.ac: Add --enable-frame-pointer. * configure: Regenerated. * config/i386/i386.c (USE_IX86_FRAME_POINTER): Default to 0. (override_options): If not configured with --enable-frame-pointer, enable -fomit-frame-pointer (but not for TARGET_MACHO or when optimizing for size), -fasynchronous-unwind-tables and -maccumulate-outgoing-args by default. gcc/testsuite/ 2010-08-12 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline 2010-08-12 Uros Bizjak <ubizjak@gmail.com> * gcc.target/i386/pr40906-1.c: Add -fno-asynchronous-unwind-tables to dg-options. * gcc.target/i386/pr40906-2.c: Ditto. * gcc.target/i386/pr40906-3.c: Ditto. diff --git a/gcc/config.gcc b/gcc/config.gcc index c4460f4..9027287 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -389,12 +389,18 @@ i[34567]86-*-*) if test "x$enable_cld" = xyes; then tm_defines="${tm_defines} USE_IX86_CLD=1" fi + if test "x$enable_frame_pointer" = xyes; then + tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1" + fi ;; x86_64-*-*) tm_file="i386/biarch64.h ${tm_file}" if test "x$enable_cld" = xyes; then tm_defines="${tm_defines} USE_IX86_CLD=1" fi + if test "x$enable_frame_pointer" = xyes; then + tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1" + fi ;; esac diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 045f79c..9cdae52 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2723,28 +2723,6 @@ override_options (bool main_args_p) if (TARGET_MACHO && TARGET_64BIT) flag_pic = 2; - /* Set the default values for switches whose default depends on TARGET_64BIT - in case they weren't overwritten by command line options. */ - if (TARGET_64BIT) - { - /* Mach-O doesn't support omitting the frame pointer for now. */ - if (flag_omit_frame_pointer == 2) - flag_omit_frame_pointer = (TARGET_MACHO ? 0 : 1); - if (flag_asynchronous_unwind_tables == 2) - flag_asynchronous_unwind_tables = 1; - if (flag_pcc_struct_return == 2) - flag_pcc_struct_return = 0; - } - else - { - if (flag_omit_frame_pointer == 2) - flag_omit_frame_pointer = 0; - if (flag_asynchronous_unwind_tables == 2) - flag_asynchronous_unwind_tables = 0; - if (flag_pcc_struct_return == 2) - flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN; - } - /* Need to check -mtune=generic first. */ if (ix86_tune_string) { @@ -3019,6 +2997,34 @@ override_options (bool main_args_p) for (i = 0; i < X86_TUNE_LAST; ++i) ix86_tune_features[i] = !!(initial_ix86_tune_features[i] & ix86_tune_mask); +#ifndef USE_IX86_FRAME_POINTER +#define USE_IX86_FRAME_POINTER 0 +#endif + + /* Set the default values for switches whose default depends on TARGET_64BIT + in case they weren't overwritten by command line options. */ + if (TARGET_64BIT) + { + /* Mach-O doesn't support omitting the frame pointer for now. */ + if (flag_omit_frame_pointer == 2) + flag_omit_frame_pointer = (TARGET_MACHO ? 0 : 1); + if (flag_asynchronous_unwind_tables == 2) + flag_asynchronous_unwind_tables = 1; + if (flag_pcc_struct_return == 2) + flag_pcc_struct_return = 0; + } + else + { + /* Mach-O doesn't support omitting the frame pointer for now. */ + if (flag_omit_frame_pointer == 2) + flag_omit_frame_pointer = + (TARGET_MACHO ? 0 : !(USE_IX86_FRAME_POINTER || optimize_size)); + if (flag_asynchronous_unwind_tables == 2) + flag_asynchronous_unwind_tables = !USE_IX86_FRAME_POINTER; + if (flag_pcc_struct_return == 2) + flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN; + } + if (optimize_size) ix86_cost = &ix86_size_cost; else @@ -3303,7 +3309,8 @@ override_options (bool main_args_p) prefix, suffix, sw); } - if ((x86_accumulate_outgoing_args & ix86_tune_mask) + if ((!USE_IX86_FRAME_POINTER + || (x86_accumulate_outgoing_args & ix86_tune_mask)) && !(target_flags_explicit & MASK_ACCUMULATE_OUTGOING_ARGS) && !optimize_size) target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS; diff --git a/gcc/configure b/gcc/configure index 64cdd91..db36205 100755 --- a/gcc/configure +++ b/gcc/configure @@ -1064,6 +1064,7 @@ Optional Features: arrange to use setjmp/longjmp exception handling --enable-secureplt enable -msecure-plt by default for PowerPC --enable-cld enable -mcld by default for 32bit x86 + --enable-frame-pointer enable -fno-omit-frame-pointer by default for 32bit x86 --disable-win32-registry disable lookup of installation paths in the Registry on Windows hosts @@ -13678,6 +13679,24 @@ else enable_cld=no fi; +# Check whether --enable-frame-pointer or --disable-frame-pointer was given. +if test "${enable_frame_pointer+set}" = set; then + enableval="$enable_frame_pointer" + +else + +case $target_os in +linux*) + # Enable -fomit-frame-pointer by default for Linux. + enable_frame_pointer=no + ;; +*) + enable_frame_pointer=yes + ;; +esac + +fi; + # Windows32 Registry support for specifying GCC installation paths. # Check whether --enable-win32-registry or --disable-win32-registry was given. if test "${enable_win32_registry+set}" = set; then @@ -14509,13 +14528,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:14512: $ac_compile\"" >&5) + (eval echo "\"\$as_me:14531: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:14515: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:14534: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:14518: output\"" >&5) + (eval echo "\"\$as_me:14537: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -15672,7 +15691,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 15675 "configure"' > conftest.$ac_ext + echo '#line 15694 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -16971,11 +16990,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16974: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16993: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16978: \$? = $ac_status" >&5 + echo "$as_me:16997: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17310,11 +17329,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17313: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17332: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17317: \$? = $ac_status" >&5 + echo "$as_me:17336: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17415,11 +17434,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17418: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17437: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17422: \$? = $ac_status" >&5 + echo "$as_me:17441: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17470,11 +17489,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17473: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17492: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17477: \$? = $ac_status" >&5 + echo "$as_me:17496: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20282,7 +20301,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 20285 "configure" +#line 20304 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -20378,7 +20397,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 20381 "configure" +#line 20400 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 01b6c56..a1078d2 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1527,6 +1527,20 @@ AC_ARG_ENABLE(cld, [ --enable-cld enable -mcld by default for 32bit x86], [], [enable_cld=no]) +AC_ARG_ENABLE(frame-pointer, +[ --enable-frame-pointer enable -fno-omit-frame-pointer by default for 32bit x86], [], +[ +case $target_os in +linux*) + # Enable -fomit-frame-pointer by default for Linux. + enable_frame_pointer=no + ;; +*) + enable_frame_pointer=yes + ;; +esac +]) + # Windows32 Registry support for specifying GCC installation paths. AC_ARG_ENABLE(win32-registry, [ --disable-win32-registry diff --git a/gcc/testsuite/gcc.target/i386/pr40906-1.c b/gcc/testsuite/gcc.target/i386/pr40906-1.c index c14bbfa..77e7c9b 100644 --- a/gcc/testsuite/gcc.target/i386/pr40906-1.c +++ b/gcc/testsuite/gcc.target/i386/pr40906-1.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O2 -fomit-frame-pointer -mpush-args -mno-accumulate-outgoing-args" } */ +/* { dg-options "-O2 -fomit-frame-pointer -fno-asynchronous-unwind-tables -mpush-args -mno-accumulate-outgoing-args" } */ void abort (void); diff --git a/gcc/testsuite/gcc.target/i386/pr40906-2.c b/gcc/testsuite/gcc.target/i386/pr40906-2.c index 66e146b..535141a 100644 --- a/gcc/testsuite/gcc.target/i386/pr40906-2.c +++ b/gcc/testsuite/gcc.target/i386/pr40906-2.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O2 -fomit-frame-pointer -mpush-args -mno-accumulate-outgoing-args -m128bit-long-double" } */ +/* { dg-options "-O2 -fomit-frame-pointer -fno-asynchronous-unwind-tables -mpush-args -mno-accumulate-outgoing-args -m128bit-long-double" } */ void abort (void); diff --git a/gcc/testsuite/gcc.target/i386/pr40906-3.c b/gcc/testsuite/gcc.target/i386/pr40906-3.c index e976805..d83833f 100644 --- a/gcc/testsuite/gcc.target/i386/pr40906-3.c +++ b/gcc/testsuite/gcc.target/i386/pr40906-3.c @@ -1,7 +1,7 @@ /* { dg-do run { target *-*-linux* } } */ /* { dg-require-effective-target ilp32 } */ /* { dg-require-effective-target sse2 } */ -/* { dg-options "-O2 -fomit-frame-pointer -msse2 -mpush-args -mno-accumulate-outgoing-args" } */ +/* { dg-options "-O2 -fomit-frame-pointer -fno-asynchronous-unwind-tables -msse2 -mpush-args -mno-accumulate-outgoing-args" } */ #include "sse2-check.h"