Re: [PATCH, Android] Stack protector enabling for Android target

2012-05-16 Thread Pavel Chupin
Hi all,
First hunk is not needed indeed. Testing is ok. Thanks!!!
Here is the final patch:

diff --git a/gcc/configure.ac b/gcc/configure.ac
index 2c17736..43e760b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -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*)

2012/5/15 Maxim Kuvyrkov ma...@codesourcery.com:
 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?

 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*.

       [# 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


-- 
Pavel Chupin
Software Engineer
Intel Corporation


Re: [PATCH, Android] Stack protector enabling for Android target

2012-05-15 Thread Maxim Kuvyrkov
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?

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*.  

   [# 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



Re: [PATCH, Android] Stack protector enabling for Android target

2012-05-11 Thread Igor Zamyatin
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?

Thanks,
Igor

On Mon, May 7, 2012 at 10:08 PM, H.J. Lu hjl.to...@gmail.com wrote:
 On Mon, May 7, 2012 at 11:04 AM, Maxim Kuvyrkov ma...@codesourcery.com 
 wrote:
 On 6/05/2012, at 7:02 PM, Igor Zamyatin wrote:

 Hi!

 The patch enables stack protector for Android.
 Android targets don't contain necessary information in features.h so
 we explicitly enable stack protector for Android.

 Bootstrapped and regtested on x86_64. Ok to commit?

 Thanks,
 Igor

 2012-05-06  Igor Zamyatin  igor.zamya...@intel.com

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


 diff --git a/gcc/configure.ac b/gcc/configure.ac
 index 86b4bea..c1012d6 100644
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
 @@ -4545,6 +4545,8 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
       gcc_cv_libc_provides_ssp,
       [gcc_cv_libc_provides_ssp=no
     case $target in
 +       *-android*)
 +         gcc_cv_libc_provides_ssp=yes;;
        *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
       [# glibc 2.4 and later provides __stack_chk_fail and
       # either __stack_chk_guard, or TLS access to stack guard canary.


 What you really want is to enable stack protector for Bionic libc, which is 
 often synonymous with -android* target, but not always.  Let's enable ssp 
 based on whether __BIONIC__ is defined in the libc headers (i.e., add a grep 
 test for __BIONIC__ in sys/cdefs.h)

 Also please add a comment along the lines of all versions of Bionic support 
 stack protector.

 Which exact target did you test this on?  X86_64-*-* is a pretty broad 
 definition.


 We are working on x86_64-*-linux-android target,
 which uses x32.

 --
 H.J.


stack_protector.patch
Description: Binary data


Re: [PATCH, Android] Stack protector enabling for Android target

2012-05-07 Thread Maxim Kuvyrkov
On 6/05/2012, at 7:02 PM, Igor Zamyatin wrote:

 Hi!
 
 The patch enables stack protector for Android.
 Android targets don't contain necessary information in features.h so
 we explicitly enable stack protector for Android.
 
 Bootstrapped and regtested on x86_64. Ok to commit?
 
 Thanks,
 Igor
 
 2012-05-06  Igor Zamyatin  igor.zamya...@intel.com
 
* configure.ac: Stack protector enabling for Android targets.
* configure: Regenerate.
 
 
 diff --git a/gcc/configure.ac b/gcc/configure.ac
 index 86b4bea..c1012d6 100644
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
 @@ -4545,6 +4545,8 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
   gcc_cv_libc_provides_ssp,
   [gcc_cv_libc_provides_ssp=no
 case $target in
 +   *-android*)
 + gcc_cv_libc_provides_ssp=yes;;
*-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
   [# glibc 2.4 and later provides __stack_chk_fail and
   # either __stack_chk_guard, or TLS access to stack guard canary.


What you really want is to enable stack protector for Bionic libc, which is 
often synonymous with -android* target, but not always.  Let's enable ssp based 
on whether __BIONIC__ is defined in the libc headers (i.e., add a grep test for 
__BIONIC__ in sys/cdefs.h)

Also please add a comment along the lines of all versions of Bionic support 
stack protector.

Which exact target did you test this on?  X86_64-*-* is a pretty broad 
definition.

Thank you,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



Re: [PATCH, Android] Stack protector enabling for Android target

2012-05-07 Thread H.J. Lu
On Mon, May 7, 2012 at 11:04 AM, Maxim Kuvyrkov ma...@codesourcery.com wrote:
 On 6/05/2012, at 7:02 PM, Igor Zamyatin wrote:

 Hi!

 The patch enables stack protector for Android.
 Android targets don't contain necessary information in features.h so
 we explicitly enable stack protector for Android.

 Bootstrapped and regtested on x86_64. Ok to commit?

 Thanks,
 Igor

 2012-05-06  Igor Zamyatin  igor.zamya...@intel.com

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


 diff --git a/gcc/configure.ac b/gcc/configure.ac
 index 86b4bea..c1012d6 100644
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
 @@ -4545,6 +4545,8 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
       gcc_cv_libc_provides_ssp,
       [gcc_cv_libc_provides_ssp=no
     case $target in
 +       *-android*)
 +         gcc_cv_libc_provides_ssp=yes;;
        *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
       [# glibc 2.4 and later provides __stack_chk_fail and
       # either __stack_chk_guard, or TLS access to stack guard canary.


 What you really want is to enable stack protector for Bionic libc, which is 
 often synonymous with -android* target, but not always.  Let's enable ssp 
 based on whether __BIONIC__ is defined in the libc headers (i.e., add a grep 
 test for __BIONIC__ in sys/cdefs.h)

 Also please add a comment along the lines of all versions of Bionic support 
 stack protector.

 Which exact target did you test this on?  X86_64-*-* is a pretty broad 
 definition.


We are working on x86_64-*-linux-android target,
which uses x32.

-- 
H.J.


[PATCH, Android] Stack protector enabling for Android target

2012-05-06 Thread Igor Zamyatin
Hi!

The patch enables stack protector for Android.
Android targets don't contain necessary information in features.h so
we explicitly enable stack protector for Android.

Bootstrapped and regtested on x86_64. Ok to commit?

Thanks,
Igor

2012-05-06  Igor Zamyatin  igor.zamya...@intel.com

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


diff --git a/gcc/configure.ac b/gcc/configure.ac
index 86b4bea..c1012d6 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4545,6 +4545,8 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
   gcc_cv_libc_provides_ssp,
   [gcc_cv_libc_provides_ssp=no
 case $target in
+   *-android*)
+ gcc_cv_libc_provides_ssp=yes;;
*-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
   [# glibc 2.4 and later provides __stack_chk_fail and
   # either __stack_chk_guard, or TLS access to stack guard canary.