diff mbox series

[i386] : Fix PR89221, --enable-frame-pointer does not work as intended

Message ID CAFULd4azfke8hZNTVJKkFVOeg8oX9Hh5+fOiTye0RDzQ=f15wA@mail.gmail.com
State New
Headers show
Series [i386] : Fix PR89221, --enable-frame-pointer does not work as intended | expand

Commit Message

Uros Bizjak Feb. 8, 2019, 12:24 p.m. UTC
Hello!

Attached patch fixes --enable-frame-pointer handling, and this way
makes a couple of defines in config/i386/sol2.h obsolete.

2019-02-08  Uroš Bizjak  <ubizjak@gmail.com>

    PR target/89221
    * config.gcc (i[34567]86-*-*, x86_64-*-*): Move tests for enable_cld
    and enable_frame_pointer ...
    * configure.ac: ... here.  Update help strings for --enable-cld and
    --enable-frame-pointer.
    (x86_64_*-*): Use USE_X86_64_FRAME_POINTER define.
    * configure: Regenerate.
    * config/i386/sol2.h (USE_IX86_FRAME_POINTER): Remove.
    (USE_X86_64_FRAME_POINTER): Ditto.

Bootstrapped non x86_64-linux-gnu. Rainer, can you please test the
patch on solaris2 target?

Uros.
diff mbox series

Patch

Index: config/i386/sol2.h
===================================================================
--- config/i386/sol2.h	(revision 268670)
+++ config/i386/sol2.h	(working copy)
@@ -248,9 +248,6 @@ 
 #define ASAN_REJECT_SPEC \
   DEF_ARCH64_SPEC("%e:-fsanitize=address is not supported in this configuration")
 
-#define USE_IX86_FRAME_POINTER 1
-#define USE_X86_64_FRAME_POINTER 1
-
 #undef NO_PROFILE_COUNTERS
 
 #undef MCOUNT_NAME
Index: config.gcc
===================================================================
--- config.gcc	(revision 268670)
+++ config.gcc	(working copy)
@@ -604,12 +604,6 @@ 
 		echo "This target does not support --with-abi."
 		exit 1
 	fi
-	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-*-*)
 	case ${with_abi} in
@@ -630,12 +624,6 @@ 
 		echo "Unknown ABI used in --with-abi=$with_abi"
 		exit 1
 	esac
-	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
 	;;
 arm*-*-*)
 	tm_p_file="arm/arm-flags.h ${tm_p_file} arm/aarch-common-protos.h"
Index: configure
===================================================================
--- configure	(revision 268670)
+++ configure	(working copy)
@@ -1687,9 +1687,8 @@ 
                           Link mingw executables with --large-address-aware
   --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
+  --enable-cld            enable -mcld by default for x86
+  --enable-frame-pointer  enable -fno-omit-frame-pointer by default for x86
   --disable-win32-registry
                           disable lookup of installation paths in the Registry
                           on Windows hosts
@@ -12199,8 +12198,7 @@ 
 
 case $target_os in
 linux* | darwin[8912]*)
-  # Enable -fomit-frame-pointer by default for Linux and Darwin with
-  # DWARF2.
+  # Enable -fomit-frame-pointer by default for Linux and Darwin with DWARF2.
   enable_frame_pointer=no
   ;;
 *)
@@ -12211,6 +12209,25 @@ 
 fi
 
 
+case $target in
+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-*-*)
+	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_X86_64_FRAME_POINTER=1"
+	fi
+	;;
+esac
+
 # Windows32 Registry support for specifying GCC installation paths.
 # Check whether --enable-win32-registry was given.
 if test "${enable_win32_registry+set}" = set; then :
@@ -18646,7 +18663,7 @@ 
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18640 "configure"
+#line 18666 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18752,7 +18769,7 @@ 
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18746 "configure"
+#line 18772 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -25141,7 +25158,7 @@ 
           no)
             ;;
           *)
-            as_fn_error "'$enableval' is an invalid value for --enable-standard-branch-protection.\
+            as_fn_error $? "'$enableval' is an invalid value for --enable-standard-branch-protection.\
   Valid choices are 'yes' and 'no'." "$LINENO" 5
             ;;
         esac
Index: configure.ac
===================================================================
--- configure.ac	(revision 268670)
+++ configure.ac	(working copy)
@@ -1876,17 +1876,16 @@ 
     [Define if we should use leading underscore on 64 bit mingw targets])])
 
 AC_ARG_ENABLE(cld,
-[AS_HELP_STRING([--enable-cld], [enable -mcld by default for 32bit x86])], [],
+[AS_HELP_STRING([--enable-cld], [enable -mcld by default for x86])], [],
 [enable_cld=no])
 
 AC_ARG_ENABLE(frame-pointer,
 [AS_HELP_STRING([--enable-frame-pointer],
-		[enable -fno-omit-frame-pointer by default for 32bit x86])], [],
+		[enable -fno-omit-frame-pointer by default for x86])], [],
 [
 case $target_os in
 linux* | darwin[[8912]]*)
-  # Enable -fomit-frame-pointer by default for Linux and Darwin with
-  # DWARF2.
+  # Enable -fomit-frame-pointer by default for Linux and Darwin with DWARF2.
   enable_frame_pointer=no
   ;;
 *)
@@ -1895,6 +1894,25 @@ 
 esac
 ])
 
+case $target in
+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-*-*)
+	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_X86_64_FRAME_POINTER=1"
+	fi
+	;;
+esac
+
 # Windows32 Registry support for specifying GCC installation paths.
 AC_ARG_ENABLE(win32-registry,
 [AS_HELP_STRING([--disable-win32-registry],