diff mbox

[Android] Stack protector enabling for Android target

Message ID 528CDBAB-B73A-46E5-8EEE-4D12A63E808C@codesourcery.com
State New
Headers show

Commit Message

Maxim Kuvyrkov May 15, 2012, 7:20 p.m. UTC
On 12/05/2012, at 9:03 AM, Igor Zamyatin wrote:

> Hi!
> 
> Please look at the modified patch in the attachment. ChangeLog remains the same.
> 
> Tested in android environment(x86_64-*-linux-android), also
> bootstrapped on x86_64-unknown-linux-gnu.
> I also started regtesting on linux. Is it ok after successfull regtesting?

       [# glibc 2.4 and later provides __stack_chk_fail and
       # either __stack_chk_guard, or TLS access to stack guard canary.
       if test -f $target_header_dir/features.h \
@@ -4566,6 +4566,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*)

The patch is OK provided successful regtest and either dropping the first hunk or explaining why it is necessary.

Thanks!

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics
diff mbox

Patch

diff --git a/gcc/configure.ac b/gcc/configure.ac
index 2c17736..43e760b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4545,7 +4545,7 @@  AC_CACHE_CHECK(__stack_chk_fail in target C library,
       gcc_cv_libc_provides_ssp,
       [gcc_cv_libc_provides_ssp=no
     case "$target" in
-       *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+       *-*-linux* | *-android* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)

You should not need this change.  Android target triplets are of form *-*-linux-android*, which matches *-*-linux*.