Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-08-14 Thread Kirill Yukhin
 OK, provided that the patches in the above threads apply without conflicts.  
 If there are conflicts, please repost for review.

Comitted to 4.7 branch: http://gcc.gnu.org/ml/gcc-cvs/2012-08/msg00360.html

Thanks, K


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-08-10 Thread Igor Zamyatin
Hi!

There were only trivial merge conflicts like


  [(match_operand 0 memory_operand )
   (match_operand 1 memory_operand )]
  
---
  [(match_operand 0 memory_operand)
   (match_operand 1 memory_operand)]
  !TARGET_HAS_BIONIC


Patch attached.

All necessary testing passed. Ok for 4.7?

Changelog:


2012-08-08 Pavel Chupin pavel.v.chu...@intel.com

Backport from mainline r189840 and r187586:

2012-07-25 Sergey Melnikov sergey.melni...@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.zamya...@intel.com

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


On Wed, Aug 8, 2012 at 2:25 PM, Maxim Kuvyrkov ma...@codesourcery.com wrote:
 On 8/08/2012, at 9:46 PM, Uros Bizjak wrote:

 On Wed, Aug 8, 2012 at 9:54 AM, Igor Zamyatin izamya...@gmail.com wrote:

 I'd like to ask whether stack-protector changes for Android could go to 4.7?

 Pathes are:

 http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01089.html
 http://gcc.gnu.org/ml/gcc-patches/2012-07/msg01157.html

 OK, as far as x86 is concerned.

 Strictly speaking, these fixes are not for a regression, so do not readily 
 qualify for a release branch.  However, since the patches are no-ops on 
 targets other than x86 and Uros OK'd them for x86 ...

 OK, provided that the patches in the above threads apply without conflicts.  
 If there are conflicts, please repost for review.

 Thanks,

 --
 Maxim Kuvyrkov
 CodeSourcery / Mentor Graphics



stack-protector-4_7.patch
Description: Binary data


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-08-08 Thread Igor Zamyatin
Hi all!

I'd like to ask whether stack-protector changes for Android could go to 4.7?

Pathes are:

http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01089.html
http://gcc.gnu.org/ml/gcc-patches/2012-07/msg01157.html

Thanks,
Igor

On Wed, Jul 25, 2012 at 2:08 AM, Maxim Kuvyrkov ma...@codesourcery.com wrote:
 On 24/07/2012, at 10:08 PM, Uros Bizjak wrote:

 On Mon, Jul 23, 2012 at 10:00 PM, Igor Zamyatin izamya...@gmail.com wrote:

 2012-07-23 Sergey Melnikov sergey.melni...@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

 Looks OK to me, patch needs approval from Maxim.

 OK.  Thanks for fixing this.

 --
 Maxim Kuvyrkov
 CodeSourcery / Mentor Graphics



Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-08-08 Thread Uros Bizjak
On Wed, Aug 8, 2012 at 9:54 AM, Igor Zamyatin izamya...@gmail.com wrote:

 I'd like to ask whether stack-protector changes for Android could go to 4.7?

 Pathes are:

 http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01089.html
 http://gcc.gnu.org/ml/gcc-patches/2012-07/msg01157.html

OK, as far as x86 is concerned.

Thanks,
Uros.


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-08-08 Thread Maxim Kuvyrkov
On 8/08/2012, at 9:46 PM, Uros Bizjak wrote:

 On Wed, Aug 8, 2012 at 9:54 AM, Igor Zamyatin izamya...@gmail.com wrote:
 
 I'd like to ask whether stack-protector changes for Android could go to 4.7?
 
 Pathes are:
 
 http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01089.html
 http://gcc.gnu.org/ml/gcc-patches/2012-07/msg01157.html
 
 OK, as far as x86 is concerned.

Strictly speaking, these fixes are not for a regression, so do not readily 
qualify for a release branch.  However, since the patches are no-ops on targets 
other than x86 and Uros OK'd them for x86 ...

OK, provided that the patches in the above threads apply without conflicts.  If 
there are conflicts, please repost for review.

Thanks,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-24 Thread Uros Bizjak
On Mon, Jul 23, 2012 at 10:00 PM, Igor Zamyatin izamya...@gmail.com wrote:

 2012-07-23 Sergey Melnikov sergey.melni...@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

Looks OK to me, patch needs approval from Maxim.

Thanks,
Uros.


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-24 Thread Maxim Kuvyrkov
On 24/07/2012, at 10:08 PM, Uros Bizjak wrote:

 On Mon, Jul 23, 2012 at 10:00 PM, Igor Zamyatin izamya...@gmail.com wrote:
 
 2012-07-23 Sergey Melnikov sergey.melni...@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
 
 Looks OK to me, patch needs approval from Maxim.

OK.  Thanks for fixing this.

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



[PATCH, Android] Runtime stack protector enabling for Android target

2012-07-23 Thread Igor Zamyatin
Hi!

Since this change for stack-protector enabling hurts mingw compiler
(see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53980 and
http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00638.html) we'd like to
make change more general.
Please see new patch in attachment.
Tested in android environment(x86_64-*-linux-android), also
bootstrapped and regtested on x86_64-unknown-linux-gnu and i686-linux.
Also mingw bootstrap was checked.
Ok for trunk?

Thanks,
Igor


Changelog:

2012-07-23 Sergey Melnikov sergey.melni...@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


patch-stack-protector-3_target_bionic.diff
Description: Binary data


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-16 Thread Rainer Emrich
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'm not sure if that's related, but for x86_64-w64-mingw32 bootstrap fails in
stage 1:

gcc -c -g -DIN_GCC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
- -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wc++-compat
- -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../../src/gcc-4.8.0/gcc
- -I../../../src/gcc-4.8.0/gcc/build -I../../../src/gcc-4.8.0/gcc/../include
- -I./../intl -I../../../src/gcc-4.8.0/gcc/../libcpp/include
- -I/SCRATCH/tmp.xipisatGtI/install/include
- -I/SCRATCH/tmp.xipisatGtI/install/include
- -I/SCRATCH/tmp.xipisatGtI/install/include
- -I../../../src/gcc-4.8.0/gcc/../libdecnumber
- -I../../../src/gcc-4.8.0/gcc/../libdecnumber/bid -I../libdecnumber
- -DCLOOG_INT_GMP -I/SCRATCH/tmp.xipisatGtI/install/include
- -I/SCRATCH/tmp.xipisatGtI/install/include  \
-o build/gencondmd.o build/gencondmd.c
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:17784:3: error: 'OPTION_BIONIC'
undeclared here (not in a function)
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:920:5: warning: missing
initializer [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:920:5: warning: (near
initialization for 'insn_conditions[657].value') [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:17755:5: warning: missing
initializer [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:17755:5: warning: (near
initialization for 'insn_conditions[1097].value') [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:920:5: warning: missing
initializer [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:920:5: warning: (near
initialization for 'insn_conditions[1177].value') [-Wmissing-field-initializers]
make[3]: *** [build/gencondmd.o] Error 1
make[3]: Target `all' not remade because of errors.
make[3]: Leaving directory `/SCRATCH/tmp.xipisatGtI/gcc-4.8.0/gcc-4.8.0/gcc'

see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53980

Rainer
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAEB6YACgkQoUhjsh59BL7xSgCcDU/zNX19dfNhrlbIxLQu0SRZ
nTYAn3VpO7zF6wIuWUzhfaLLdmw78e+b
=5ylG
-END PGP SIGNATURE-


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-16 Thread Kai Tietz
Hi,

I would kindly ask to revert this patch soonish.  The define
OPTION_BIONIC is defined within linux.h header, which isn't used by
cygwin and mingw targets.  so this symbol is undefined for them and
this is causing bootstrap issue for cygwin and mingw targets.

Regards,
Kai


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-16 Thread Kirill Yukhin
Reverted.
http://gcc.gnu.org/ml/gcc-cvs/2012-07/msg00442.html

Thanks, K

On Mon, Jul 16, 2012 at 5:36 PM, Kai Tietz ktiet...@googlemail.com wrote:
 Hi,

 I would kindly ask to revert this patch soonish.  The define
 OPTION_BIONIC is defined within linux.h header, which isn't used by
 cygwin and mingw targets.  so this symbol is undefined for them and
 this is causing bootstrap issue for cygwin and mingw targets.

 Regards,
 Kai


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-09 Thread Maxim Kuvyrkov
On 10/07/2012, at 8:51 AM, Igor Zamyatin wrote:

 Let's try with this patch then. Is it ok for trunk after all
 appropriate testing is done?

Sorry for the late reply, I've been down with a virus last week.

Uros,

Would you please approve this patch for i386 provided my review below?

 
 ChangeLog:
 
 2012-07-09 Sergey Melnikov sergey.melni...@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.
 
 
 diff --git a/gcc-4.6/gcc/config/i386/i386.md b/gcc-4.6/gcc/config/i386/i386.md
 index b1d7e5e..c4dd6e3 100644
 --- a/gcc-4.6/gcc/config/i386/i386.md
 +++ b/gcc-4.6/gcc/config/i386/i386.md
 @@ -17955,7 +17955,7 @@
 (define_expand stack_protect_set
   [(match_operand 0 memory_operand )
(match_operand 1 memory_operand )]
 -  
 +  !(flag_android  OPTION_BIONIC)

This should be just !OPTION_BIONIC, no flag_android.  Same applies below.

OK with that change.

-mandroid, which sets flag_android, tells the compiler to use compilation mode 
suitable for Android, like don't use C++ exceptions.  The particular 
implementation of stack protector, on the other hand, is a feature related to 
the C library.

 {
   rtx (*insn)(rtx, rtx);
 
 @@ -17979,7 +17979,7 @@
   (unspec:P [(match_operand:P 1 memory_operand m)] UNSPEC_SP_SET))
(set (match_scratch:P 2 =r) (const_int 0))
(clobber (reg:CC FLAGS_REG))]
 -  
 +  !(flag_android  OPTION_BIONIC)
   mov{imodesuffix}\t{%1, %2|%2, %1}\;mov{imodesuffix}\t{%2,
 %0|%0, %2}\;xor{l}\t%k2, %k2
   [(set_attr type multi)])
 
 @@ -17997,7 +17997,7 @@
   [(match_operand 0 memory_operand )
(match_operand 1 memory_operand )
(match_operand 2  )]
 -  
 +  !(flag_android  OPTION_BIONIC)
 {
   rtx flags = gen_rtx_REG (CCZmode, FLAGS_REG);
 
 @@ -18027,7 +18027,7 @@
(match_operand:P 2 memory_operand m)]
   UNSPEC_SP_TEST))
(clobber (match_scratch:P 3 =r))]
 -  
 +  !(flag_android  OPTION_BIONIC)
   mov{imodesuffix}\t{%1, %3|%3, %1}\;xor{imodesuffix}\t{%2, %3|%3, %2}
   [(set_attr type multi)])

Thanks,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics





[PATCH, Android] Runtime stack protector enabling for Android target

2012-07-06 Thread Igor Zamyatin
Hi!

For runtime stack protector enabling on x86 for Android we have to
disable current glibc-based implementation and turn on default one
since bionic doesn't use value from gs:0x14.

Tested in android environment(x86_64-*-linux-android), also
bootstrapped and regtested on x86_64-unknown-linux-gnu and i686-linux.
Ok for trunk?

Thanks,
Igor


ChangeLog:

2012-07-05 Sergey Melnikov sergey.melni...@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.

diff --git a/gcc-4.6/gcc/config/i386/i386.md b/gcc-4.6/gcc/config/i386/i386.md
index b1d7e5e..fe0009d 100644
--- a/gcc-4.6/gcc/config/i386/i386.md
+++ b/gcc-4.6/gcc/config/i386/i386.md
@@ -17955,7 +17955,7 @@
 (define_expand stack_protect_set
   [(match_operand 0 memory_operand )
(match_operand 1 memory_operand )]
-  
+  !ANDROID_DEFAULT
 {
   rtx (*insn)(rtx, rtx);

@@ -17979,7 +17979,7 @@
(unspec:P [(match_operand:P 1 memory_operand m)] UNSPEC_SP_SET))
(set (match_scratch:P 2 =r) (const_int 0))
(clobber (reg:CC FLAGS_REG))]
-  
+  !ANDROID_DEFAULT
   mov{imodesuffix}\t{%1, %2|%2, %1}\;mov{imodesuffix}\t{%2,
%0|%0, %2}\;xor{l}\t%k2, %k2
   [(set_attr type multi)])

@@ -17997,7 +17997,7 @@
   [(match_operand 0 memory_operand )
(match_operand 1 memory_operand )
(match_operand 2  )]
-  
+  !ANDROID_DEFAULT
 {
   rtx flags = gen_rtx_REG (CCZmode, FLAGS_REG);

@@ -18027,7 +18027,7 @@
 (match_operand:P 2 memory_operand m)]
UNSPEC_SP_TEST))
(clobber (match_scratch:P 3 =r))]
-  
+  !ANDROID_DEFAULT
   mov{imodesuffix}\t{%1, %3|%3, %1}\;xor{imodesuffix}\t{%2, %3|%3, %2}
   [(set_attr type multi)])


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-06 Thread Igor Zamyatin
Right, flag_android looks better, thanks.
Probably it's even better to check also bionic (OPTION_BIONIC)

On Fri, Jul 6, 2012 at 12:13 PM, Andrew Pinski pins...@gmail.com wrote:
 On Fri, Jul 6, 2012 at 12:49 AM, Igor Zamyatin izamya...@gmail.com wrote:
 Hi!

 For runtime stack protector enabling on x86 for Android we have to
 disable current glibc-based implementation and turn on default one
 since bionic doesn't use value from gs:0x14.

 Tested in android environment(x86_64-*-linux-android), also
 bootstrapped and regtested on x86_64-unknown-linux-gnu and i686-linux.
 Ok for trunk?



 I think you want flag_android and not ANDROID_DEFAULT since you could
 use -mno-android .

 Thanks,
 Andrew




 Thanks,
 Igor


 ChangeLog:

 2012-07-05 Sergey Melnikov sergey.melni...@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.

 diff --git a/gcc-4.6/gcc/config/i386/i386.md 
 b/gcc-4.6/gcc/config/i386/i386.md
 index b1d7e5e..fe0009d 100644
 --- a/gcc-4.6/gcc/config/i386/i386.md
 +++ b/gcc-4.6/gcc/config/i386/i386.md
 @@ -17955,7 +17955,7 @@
  (define_expand stack_protect_set
[(match_operand 0 memory_operand )
 (match_operand 1 memory_operand )]
 -  
 +  !ANDROID_DEFAULT
  {
rtx (*insn)(rtx, rtx);

 @@ -17979,7 +17979,7 @@
 (unspec:P [(match_operand:P 1 memory_operand m)] UNSPEC_SP_SET))
 (set (match_scratch:P 2 =r) (const_int 0))
 (clobber (reg:CC FLAGS_REG))]
 -  
 +  !ANDROID_DEFAULT
mov{imodesuffix}\t{%1, %2|%2, %1}\;mov{imodesuffix}\t{%2,
 %0|%0, %2}\;xor{l}\t%k2, %k2
[(set_attr type multi)])

 @@ -17997,7 +17997,7 @@
[(match_operand 0 memory_operand )
 (match_operand 1 memory_operand )
 (match_operand 2  )]
 -  
 +  !ANDROID_DEFAULT
  {
rtx flags = gen_rtx_REG (CCZmode, FLAGS_REG);

 @@ -18027,7 +18027,7 @@
  (match_operand:P 2 memory_operand m)]
 UNSPEC_SP_TEST))
 (clobber (match_scratch:P 3 =r))]
 -  
 +  !ANDROID_DEFAULT
mov{imodesuffix}\t{%1, %3|%3, %1}\;xor{imodesuffix}\t{%2, %3|%3, %2}
[(set_attr type multi)])