OSDN Git Service

Backport from mainline r189840 and r187586:
authorkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Aug 2012 13:59:04 +0000 (13:59 +0000)
committerkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Aug 2012 13:59:04 +0000 (13:59 +0000)
        2012-07-25 Sergey Melnikov <sergey.melnikov@intel.com>

        * config/i386/i386.md (stack_protect_set): Disable the pattern
        for Android since Android libc (bionic) does not provide random
        value for stack protection guard at gs:0x14. Guard value
        will be provided from external symbol (default implementation).
        (stack_protect_set_<mode>): Likewise.
        (stack_protect_test): Likewise.
        (stack_protect_test_<mode>): Likewise.
        * gcc/defaults.h: Define macro TARGET_HAS_BIONIC to 0 - target does
        not have Bionic by default
        * config/linux.h: Redefine macro TARGET_HAS_BIONIC to (OPTION_BIONIC)
        Macro OPTION_BIONIC is defined in this file and provides Bionic
        accessibility status

        2012-05-16  Igor Zamyatin  <igor.zamyatin@intel.com>

        * configure.ac: Stack protector enabling for Android targets.
        * configure: Regenerate.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@190383 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/config/linux.h
gcc/configure
gcc/configure.ac
gcc/defaults.h

index 1be4f6c..99d5d92 100644 (file)
@@ -1,3 +1,26 @@
+2012-08-08 Pavel Chupin <pavel.v.chupin@intel.com>
+
+       Backport from mainline r189840 and r187586:
+       2012-07-25 Sergey Melnikov <sergey.melnikov@intel.com>
+
+       * config/i386/i386.md (stack_protect_set): Disable the pattern
+       for Android since Android libc (bionic) does not provide random
+       value for stack protection guard at gs:0x14. Guard value
+       will be provided from external symbol (default implementation).
+       (stack_protect_set_<mode>): Likewise.
+       (stack_protect_test): Likewise.
+       (stack_protect_test_<mode>): Likewise.
+       * gcc/defaults.h: Define macro TARGET_HAS_BIONIC to 0 - target does
+       not have Bionic by default
+       * config/linux.h: Redefine macro TARGET_HAS_BIONIC to (OPTION_BIONIC)
+       Macro OPTION_BIONIC is defined in this file and provides Bionic
+       accessibility status
+
+       2012-05-16  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       * configure.ac: Stack protector enabling for Android targets.
+       * configure: Regenerate.
+
 2012-08-13  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from trunk
index c66026b..91b83e6 100644 (file)
 (define_expand "stack_protect_set"
   [(match_operand 0 "memory_operand" "")
    (match_operand 1 "memory_operand" "")]
-  ""
+  "!TARGET_HAS_BIONIC"
 {
   rtx (*insn)(rtx, rtx);
 
                    UNSPEC_SP_SET))
    (set (match_scratch:PTR 2 "=&r") (const_int 0))
    (clobber (reg:CC FLAGS_REG))]
-  ""
+  "!TARGET_HAS_BIONIC"
   "mov{<imodesuffix>}\t{%1, %2|%2, %1}\;mov{<imodesuffix>}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"
   [(set_attr "type" "multi")])
 
   [(match_operand 0 "memory_operand" "")
    (match_operand 1 "memory_operand" "")
    (match_operand 2 "" "")]
-  ""
+  "!TARGET_HAS_BIONIC"
 {
   rtx flags = gen_rtx_REG (CCZmode, FLAGS_REG);
 
                     (match_operand:PTR 2 "memory_operand" "m")]
                    UNSPEC_SP_TEST))
    (clobber (match_scratch:PTR 3 "=&r"))]
-  ""
+  "!TARGET_HAS_BIONIC"
   "mov{<imodesuffix>}\t{%1, %3|%3, %1}\;xor{<imodesuffix>}\t{%2, %3|%3, %2}"
   [(set_attr "type" "multi")])
 
index dbbeea5..fb459e6 100644 (file)
@@ -104,3 +104,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 /* Whether we have sincos that follows the GNU extension.  */
 #undef TARGET_HAS_SINCOS
 #define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)
+
+/* Whether we have Bionic libc runtime */
+#undef TARGET_HAS_BIONIC
+#define TARGET_HAS_BIONIC (OPTION_BIONIC)
index 488ef84..93fdb62 100755 (executable)
@@ -26722,6 +26722,11 @@ else
             $target_header_dir/bits/uClibc_config.h > /dev/null; then
          gcc_cv_libc_provides_ssp=yes
        fi
+      # all versions of Bionic support stack protector
+      elif test -f $target_header_dir/sys/cdefs.h \
+        && $EGREP '^[  ]*#[    ]*define[       ]+__BIONIC__[   ]+1' \
+           $target_header_dir/sys/cdefs.h > /dev/null; then
+         gcc_cv_libc_provides_ssp=yes
       fi
        ;;
        *-*-gnu*)
index 32a0664..2632afa 100644 (file)
@@ -4633,6 +4633,11 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
             $target_header_dir/bits/uClibc_config.h > /dev/null; then
          gcc_cv_libc_provides_ssp=yes
        fi
+      # all versions of Bionic support stack protector
+      elif test -f $target_header_dir/sys/cdefs.h \
+        && $EGREP '^[  ]*#[    ]*define[       ]+__BIONIC__[   ]+1' \
+           $target_header_dir/sys/cdefs.h > /dev/null; then
+         gcc_cv_libc_provides_ssp=yes
       fi]
        ;;
        *-*-gnu*)
index 0e9e2b4..3f2c27d 100644 (file)
@@ -1063,6 +1063,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define TARGET_HAS_SINCOS 0
 #endif
 
+/* Determin whether the target runtime library is Bionic */
+#ifndef TARGET_HAS_BIONIC
+#define TARGET_HAS_BIONIC 0
+#endif
+
 /* Indicate that CLZ and CTZ are undefined at zero.  */
 #ifndef CLZ_DEFINED_VALUE_AT_ZERO
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  0