From dde29e2799b82bf76b263eac46acf3a1ae90d206 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Tue, 5 Apr 2016 22:41:50 +0000 Subject: Faster stack-protector for Android/AArch64. Bionic has a defined thread-local location for the stack protector cookie. Emit a direct load instead of going through __stack_chk_guard. llvm-svn: 265481 --- llvm/lib/Target/X86/X86ISelLowering.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp') diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index ea5518ed4c6..f81a3082ed2 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -2193,16 +2193,17 @@ unsigned X86TargetLowering::getAddressSpace() const { return 256; } -bool X86TargetLowering::getStackCookieLocation(unsigned &AddressSpace, - unsigned &Offset) const { +Value *X86TargetLowering::getStackCookieLocation(IRBuilder<> &IRB) const { if (!Subtarget.isTargetLinux()) - return false; + return TargetLowering::getStackCookieLocation(IRB); // %fs:0x28, unless we're using a Kernel code model, in which case it's %gs: // %gs:0x14 on i386 - Offset = (Subtarget.is64Bit()) ? 0x28 : 0x14; - AddressSpace = getAddressSpace(); - return true; + unsigned Offset = (Subtarget.is64Bit()) ? 0x28 : 0x14; + unsigned AddressSpace = getAddressSpace(); + return ConstantExpr::getIntToPtr( + ConstantInt::get(Type::getInt32Ty(IRB.getContext()), Offset), + Type::getInt8PtrTy(IRB.getContext())->getPointerTo(AddressSpace)); } Value *X86TargetLowering::getSafeStackPointerLocation(IRBuilder<> &IRB) const { -- cgit v1.2.3