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")])