diff options
author | Pavel Chupin <pavel.v.chupin@intel.com> | 2012-08-03 12:37:21 +0400 |
---|---|---|
committer | Pavel Chupin <pavel.v.chupin@intel.com> | 2012-09-03 18:14:58 +0400 |
commit | a3bbecce2c41db5752beb324939b63c5dfb7112c (patch) | |
tree | bb3d940cd372dc830c2f626d6290e05256c3853e /gcc-4.4.3/gcc | |
parent | 329ca6fa5d9972ad6dad8387036b4dbe9cfa1f27 (diff) | |
download | toolchain_gcc-a3bbecce2c41db5752beb324939b63c5dfb7112c.tar.gz toolchain_gcc-a3bbecce2c41db5752beb324939b63c5dfb7112c.tar.bz2 toolchain_gcc-a3bbecce2c41db5752beb324939b63c5dfb7112c.zip |
Backport from trunk r189840 and r187586: stack-protector fixes for 4.4.3
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.
Change-Id: I878562dd0bed8069011246c29c1ac6ce1c353644
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Diffstat (limited to 'gcc-4.4.3/gcc')
-rw-r--r-- | gcc-4.4.3/gcc/config/i386/i386.md | 6 | ||||
-rw-r--r-- | gcc-4.4.3/gcc/config/linux.h | 4 | ||||
-rwxr-xr-x | gcc-4.4.3/gcc/configure | 5 | ||||
-rw-r--r-- | gcc-4.4.3/gcc/configure.ac | 5 | ||||
-rw-r--r-- | gcc-4.4.3/gcc/defaults.h | 5 |
5 files changed, 22 insertions, 3 deletions
diff --git a/gcc-4.4.3/gcc/config/i386/i386.md b/gcc-4.4.3/gcc/config/i386/i386.md index 7989c31db..712df1071 100644 --- a/gcc-4.4.3/gcc/config/i386/i386.md +++ b/gcc-4.4.3/gcc/config/i386/i386.md @@ -21926,7 +21926,7 @@ (define_expand "stack_protect_set" [(match_operand 0 "memory_operand" "") (match_operand 1 "memory_operand" "")] - "" + "!TARGET_HAS_BIONIC" { #ifdef TARGET_THREAD_SSP_OFFSET if (TARGET_64BIT) @@ -21949,7 +21949,7 @@ (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET)) (set (match_scratch:SI 2 "=&r") (const_int 0)) (clobber (reg:CC FLAGS_REG))] - "" + "!TARGET_HAS_BIONIC" "mov{l}\t{%1, %2|%2, %1}\;mov{l}\t{%2, %0|%0, %2}\;xor{l}\t%2, %2" [(set_attr "type" "multi")]) @@ -21992,7 +21992,7 @@ [(match_operand 0 "memory_operand" "") (match_operand 1 "memory_operand" "") (match_operand 2 "" "")] - "" + "!TARGET_HAS_BIONIC" { rtx flags = gen_rtx_REG (CCZmode, FLAGS_REG); ix86_compare_op0 = operands[0]; diff --git a/gcc-4.4.3/gcc/config/linux.h b/gcc-4.4.3/gcc/config/linux.h index 740ddb7be..f2dc836ca 100644 --- a/gcc-4.4.3/gcc/config/linux.h +++ b/gcc-4.4.3/gcc/config/linux.h @@ -169,4 +169,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* Whether we have sincos that follows the GNU extension. */ #define TARGET_HAS_SINCOS (OPTION_GLIBC) +/* Whether we have Bionic libc runtime */ +#undef TARGET_HAS_BIONIC +#define TARGET_HAS_BIONIC (OPTION_BIONIC) + #define TARGET_POSIX_IO diff --git a/gcc-4.4.3/gcc/configure b/gcc-4.4.3/gcc/configure index 8e79dc560..dd06087d5 100755 --- a/gcc-4.4.3/gcc/configure +++ b/gcc-4.4.3/gcc/configure @@ -24653,6 +24653,11 @@ else $glibc_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 $glibc_header_dir/sys/cdefs.h \ + && $EGREP '^[ ]*#[ ]*define[ ]+__BIONIC__[ ]+1' \ + $glibc_header_dir/sys/cdefs.h > /dev/null; then + gcc_cv_libc_provides_ssp=yes fi ;; *-*-gnu*) diff --git a/gcc-4.4.3/gcc/configure.ac b/gcc-4.4.3/gcc/configure.ac index e83b6cad5..523f9f432 100644 --- a/gcc-4.4.3/gcc/configure.ac +++ b/gcc-4.4.3/gcc/configure.ac @@ -3854,6 +3854,11 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library, $glibc_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 $glibc_header_dir/sys/cdefs.h \ + && $EGREP '^[ ]*#[ ]*define[ ]+__BIONIC__[ ]+1' \ + $glibc_header_dir/sys/cdefs.h > /dev/null; then + gcc_cv_libc_provides_ssp=yes fi ;; *-*-gnu*) diff --git a/gcc-4.4.3/gcc/defaults.h b/gcc-4.4.3/gcc/defaults.h index 349c1f7a4..0004f18f4 100644 --- a/gcc-4.4.3/gcc/defaults.h +++ b/gcc-4.4.3/gcc/defaults.h @@ -823,6 +823,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 |