Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:11.4
gcc41
stack-protect-kernel.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File stack-protect-kernel.patch of Package gcc41
2006-07-27 Arjan van de Ven <arjan@linux.intel.com> * config/i386/i386.md (stack_tls_protect_set_di) Use %gs rather than %fs for -mcmodel=kernel. (stack_tls_protect_test_di): Likewise. * gcc.target/i386/stack-prot-kernel.c: New test. Index: gcc/config/i386/i386.md =================================================================== --- gcc/config/i386/i386.md.orig 2009-11-20 13:41:13.000000000 +0100 +++ gcc/config/i386/i386.md 2009-11-20 13:42:16.000000000 +0100 @@ -20709,7 +20709,15 @@ (set (match_scratch:DI 2 "=&r") (const_int 0)) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT" - "mov{q}\t{%%fs:%P1, %2|%2, QWORD PTR %%fs:%P1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2" + { + /* The kernel uses a different segment register for performance reasons; a + system call would not have to trash the userspace segment register, + which would be expensive */ + if (ix86_cmodel != CM_KERNEL) + return "mov{q}\t{%%fs:%P1, %2|%2, QWORD PTR %%fs:%P1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"; + else + return "mov{q}\t{%%gs:%P1, %2|%2, QWORD PTR %%gs:%P1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"; + } [(set_attr "type" "multi")]) (define_expand "stack_protect_test" @@ -20777,7 +20785,15 @@ UNSPEC_SP_TLS_TEST)) (clobber (match_scratch:DI 3 "=r"))] "TARGET_64BIT" - "mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%%fs:%P2, %3|%3, QWORD PTR %%fs:%P2}" + { + /* The kernel uses a different segment register for performance reasons; a + system call would not have to trash the userspace segment register, + which would be expensive */ + if (ix86_cmodel != CM_KERNEL) + return "mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%%fs:%P2, %3|%3, QWORD PTR %%fs:%P2}"; + else + return "mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%%gs:%P2, %3|%3, QWORD PTR %%gs:%P2}"; + } [(set_attr "type" "multi")]) (include "sse.md") Index: gcc/testsuite/gcc.target/i386/stack-prot-kernel.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gcc/testsuite/gcc.target/i386/stack-prot-kernel.c 2009-11-20 13:42:16.000000000 +0100 @@ -0,0 +1,12 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -fstack-protector-all -mcmodel=kernel" } */ + +void test1 (int x) +{ + char p[40]; + int i; + for (i=0; i<40; i++) + p[i] = x; +} + +/* { dg-final { scan-assembler-not "%fs" } } */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor