From 3fd77c94a313e7bcd0bb7b4801ce53a49409b183 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Mon, 20 Mar 2017 20:35:37 +0000 Subject: [PATCH] [Fuchsia] Use %gs for ABI slots under -mcmodel=kernel Make x86_64-fuchsia targets under -mcmodel=kernel use %gs rather than %fs to access ABI slots for stack-protector and safe-stack Patch by Roland McGrath. Differential Revision: https://reviews.llvm.org/D30870 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298302 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelLowering.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index e07c63b4e24..2165e08fa25 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -2077,7 +2077,7 @@ Value *X86TargetLowering::getIRStackGuard(IRBuilder<> &IRB) const { if (hasStackGuardSlotTLS(Subtarget.getTargetTriple())) { if (Subtarget.isTargetFuchsia()) { // defines MX_TLS_STACK_GUARD_OFFSET with this value. - return SegmentOffset(IRB, 0x10, 257); + return SegmentOffset(IRB, 0x10, getAddressSpace()); } else { // %fs:0x28, unless we're using a Kernel code model, in which case // it's %gs:0x28. gs:0x14 on i386. @@ -2142,7 +2142,7 @@ Value *X86TargetLowering::getSafeStackPointerLocation(IRBuilder<> &IRB) const { // Fuchsia is similar. if (Subtarget.isTargetFuchsia()) { // defines MX_TLS_UNSAFE_SP_OFFSET with this value. - return SegmentOffset(IRB, 0x18, 257); + return SegmentOffset(IRB, 0x18, getAddressSpace()); } return TargetLowering::getSafeStackPointerLocation(IRB); -- 2.50.1