This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] HEAD patch to add -fstack-protector support for x86-64 kernels


Arjan van de Ven wrote:
Hi,

The patch below (bootstrapped) adds support for (linux) kernel-side use
of -fstack-protector. The kernel uses a different segment register (gs
instead of fs) for the local storage, so for this to work gcc needs to
emit gs: relative code for -fstack-protector for the -mcmodel=kernel
code. I've also attached a testcase for this patch to go with this. The
patch is against the SVN tree from about 2 hours ago.

You do not need a pattern. Instead, in the stack_tls_protect_set_di pattern you can have as the code template.


{
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"
}


Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]