Compare commits
1 Commits
main
...
users/arse
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ae56b6712d |
@ -21,6 +21,7 @@ def isOSOpenBSD : RuntimeLibcallPredicate<"TT.isOSOpenBSD()">;
|
|||||||
def isNotOSOpenBSD : RuntimeLibcallPredicate<"!TT.isOSOpenBSD()">;
|
def isNotOSOpenBSD : RuntimeLibcallPredicate<"!TT.isOSOpenBSD()">;
|
||||||
def isOSWindows : RuntimeLibcallPredicate<"TT.isOSWindows()">;
|
def isOSWindows : RuntimeLibcallPredicate<"TT.isOSWindows()">;
|
||||||
def isNotOSWindows : RuntimeLibcallPredicate<"!TT.isOSWindows()">;
|
def isNotOSWindows : RuntimeLibcallPredicate<"!TT.isOSWindows()">;
|
||||||
|
def isNotOSLinux : RuntimeLibcallPredicate<[{!TT.isOSLinux()}]>;
|
||||||
def isNotOSMSVCRT : RuntimeLibcallPredicate<"!TT.isOSMSVCRT()">;
|
def isNotOSMSVCRT : RuntimeLibcallPredicate<"!TT.isOSMSVCRT()">;
|
||||||
def isPS : RuntimeLibcallPredicate<"TT.isPS()">;
|
def isPS : RuntimeLibcallPredicate<"TT.isPS()">;
|
||||||
def isNotOSWindowsOrIsCygwinMinGW
|
def isNotOSWindowsOrIsCygwinMinGW
|
||||||
@ -28,6 +29,12 @@ def isNotOSWindowsOrIsCygwinMinGW
|
|||||||
def isWindowsMSVCEnvironment : RuntimeLibcallPredicate<
|
def isWindowsMSVCEnvironment : RuntimeLibcallPredicate<
|
||||||
[{TT.isWindowsMSVCEnvironment()}]>;
|
[{TT.isWindowsMSVCEnvironment()}]>;
|
||||||
|
|
||||||
|
def isNotOSLinuxAndNotOSOpenBSD : RuntimeLibcallPredicate<
|
||||||
|
[{!TT.isOSLinux() && !TT.isOSOpenBSD()}]>;
|
||||||
|
|
||||||
|
def isWindowsMSVCOrItaniumEnvironment : RuntimeLibcallPredicate<
|
||||||
|
[{TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment()}]>;
|
||||||
|
|
||||||
def isGNUEnvironment : RuntimeLibcallPredicate<"TT.isGNUEnvironment()">;
|
def isGNUEnvironment : RuntimeLibcallPredicate<"TT.isGNUEnvironment()">;
|
||||||
def darwinHasSinCosStret : RuntimeLibcallPredicate<"darwinHasSinCosStret(TT)">;
|
def darwinHasSinCosStret : RuntimeLibcallPredicate<"darwinHasSinCosStret(TT)">;
|
||||||
def darwinHasExp10 : RuntimeLibcallPredicate<"darwinHasExp10(TT)">;
|
def darwinHasExp10 : RuntimeLibcallPredicate<"darwinHasExp10(TT)">;
|
||||||
@ -471,6 +478,16 @@ def OBJC_RETAIN_AUTORELEASE : RuntimeLibcall;
|
|||||||
def OBJC_SYNC_ENTER : RuntimeLibcall;
|
def OBJC_SYNC_ENTER : RuntimeLibcall;
|
||||||
def OBJC_SYNC_EXIT : RuntimeLibcall;
|
def OBJC_SYNC_EXIT : RuntimeLibcall;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Global variable references
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// TODO: These are not libcalls and probably should be distinguished
|
||||||
|
// in some way from callable functions.
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
def STACK_CHECK_GUARD : RuntimeLibcall;
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Define implementation default libcalls
|
// Define implementation default libcalls
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
@ -1103,6 +1120,21 @@ defset list<RuntimeLibcallImpl> LibmF128FiniteLibcalls = {
|
|||||||
def __powf128_finite : RuntimeLibcallImpl<POW_FINITE_F128>;
|
def __powf128_finite : RuntimeLibcallImpl<POW_FINITE_F128>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Global variable references
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
def __stack_chk_guard : RuntimeLibcallImpl<STACK_CHECK_GUARD>;
|
||||||
|
|
||||||
|
// Name used on OpenBSD
|
||||||
|
def __guard_local : RuntimeLibcallImpl<STACK_CHECK_GUARD>;
|
||||||
|
|
||||||
|
// Name used with Windows MSVC
|
||||||
|
def __security_cookie : RuntimeLibcallImpl<STACK_CHECK_GUARD>;
|
||||||
|
|
||||||
|
// Name used on AIX
|
||||||
|
def __ssp_canary_word : RuntimeLibcallImpl<STACK_CHECK_GUARD>;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Common Libcall Sets
|
// Common Libcall Sets
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -1159,7 +1191,8 @@ defvar DarwinSinCosStret = LibcallImpls<(add __sincosf_stret, __sincos_stret),
|
|||||||
defvar DarwinExp10 = LibcallImpls<(add __exp10f, __exp10), darwinHasExp10>;
|
defvar DarwinExp10 = LibcallImpls<(add __exp10f, __exp10), darwinHasExp10>;
|
||||||
|
|
||||||
defvar SecurityCheckCookieIfWinMSVC =
|
defvar SecurityCheckCookieIfWinMSVC =
|
||||||
LibcallImpls<(add __security_check_cookie), isWindowsMSVCEnvironment>;
|
LibcallImpls<(add __security_check_cookie, __security_cookie),
|
||||||
|
isWindowsMSVCOrItaniumEnvironment>;
|
||||||
|
|
||||||
defvar LibmHasSinCosF32 = LibcallImpls<(add sincosf), hasSinCos>;
|
defvar LibmHasSinCosF32 = LibcallImpls<(add sincosf), hasSinCos>;
|
||||||
defvar LibmHasSinCosF64 = LibcallImpls<(add sincos), hasSinCos>;
|
defvar LibmHasSinCosF64 = LibcallImpls<(add sincos), hasSinCos>;
|
||||||
@ -1205,10 +1238,13 @@ defvar LibmHasFrexpF128 = LibcallImpls<(add frexp_f128), isNotOSWindowsOrIsCygwi
|
|||||||
defvar LibmHasLdexpF128 = LibcallImpls<(add ldexp_f128), isNotOSWindowsOrIsCygwinMinGW>;
|
defvar LibmHasLdexpF128 = LibcallImpls<(add ldexp_f128), isNotOSWindowsOrIsCygwinMinGW>;
|
||||||
|
|
||||||
defvar has__stack_chk_fail = LibcallImpls<(add __stack_chk_fail), isNotOSOpenBSD>;
|
defvar has__stack_chk_fail = LibcallImpls<(add __stack_chk_fail), isNotOSOpenBSD>;
|
||||||
|
defvar has__stack_chk_guard =
|
||||||
|
LibcallImpls<(add __stack_chk_guard), isNotOSOpenBSD>;
|
||||||
defvar has__stack_smash_handler = LibcallImpls<(add __stack_smash_handler), isOSOpenBSD>;
|
defvar has__stack_smash_handler = LibcallImpls<(add __stack_smash_handler), isOSOpenBSD>;
|
||||||
|
defvar has___guard_local = LibcallImpls<(add __guard_local), isOSOpenBSD>;
|
||||||
|
|
||||||
defvar DefaultStackProtector = (add has__stack_chk_fail,
|
defvar DefaultStackProtector = (add has__stack_chk_fail, has__stack_chk_guard,
|
||||||
has__stack_smash_handler);
|
has__stack_smash_handler, has___guard_local);
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Objective-C Runtime Libcalls
|
// Objective-C Runtime Libcalls
|
||||||
@ -1357,7 +1393,9 @@ def WindowsARM64ECSystemLibrary
|
|||||||
: SystemRuntimeLibrary<isWindowsArm64EC,
|
: SystemRuntimeLibrary<isWindowsArm64EC,
|
||||||
(add WinArm64ECDefaultRuntimeLibcallImpls,
|
(add WinArm64ECDefaultRuntimeLibcallImpls,
|
||||||
arm64ec___stack_chk_fail,
|
arm64ec___stack_chk_fail,
|
||||||
LibcallImpls<(add __security_check_cookie_arm64ec),
|
__stack_chk_guard,
|
||||||
|
LibcallImpls<(add __security_check_cookie_arm64ec,
|
||||||
|
__security_cookie),
|
||||||
isWindowsMSVCEnvironment>,
|
isWindowsMSVCEnvironment>,
|
||||||
ExceptionModelCallsArm64EC)>;
|
ExceptionModelCallsArm64EC)>;
|
||||||
|
|
||||||
@ -1848,7 +1886,7 @@ def HexagonSystemLibrary
|
|||||||
__umoddi3, __divdf3, __muldf3, __divsi3, __subdf3, sqrtf,
|
__umoddi3, __divdf3, __muldf3, __divsi3, __subdf3, sqrtf,
|
||||||
__divdi3, __umodsi3, __moddi3, __modsi3), HexagonLibcalls,
|
__divdi3, __umodsi3, __moddi3, __modsi3), HexagonLibcalls,
|
||||||
LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
|
LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
|
||||||
exp10f, exp10, exp10l_f128, __stack_chk_fail)>;
|
exp10f, exp10, exp10l_f128, __stack_chk_fail, __stack_chk_guard)>;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Lanai Runtime Libcalls
|
// Lanai Runtime Libcalls
|
||||||
@ -1859,7 +1897,7 @@ def isLanai : RuntimeLibcallPredicate<"TT.getArch() == Triple::lanai">;
|
|||||||
// Use fast calling convention for library functions.
|
// Use fast calling convention for library functions.
|
||||||
def LanaiSystemLibrary
|
def LanaiSystemLibrary
|
||||||
: SystemRuntimeLibrary<isLanai, (add DefaultRuntimeLibcallImpls,
|
: SystemRuntimeLibrary<isLanai, (add DefaultRuntimeLibcallImpls,
|
||||||
__stack_chk_fail)> {
|
__stack_chk_fail, __stack_chk_guard)> {
|
||||||
let DefaultLibcallCallingConv = FASTCC;
|
let DefaultLibcallCallingConv = FASTCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2157,7 +2195,8 @@ def MSP430SystemLibrary
|
|||||||
__mspabi_slll,
|
__mspabi_slll,
|
||||||
// __mspabi_[srlll/srall/sllll/rlli/rlll] are NOT implemented in libgcc
|
// __mspabi_[srlll/srall/sllll/rlli/rlll] are NOT implemented in libgcc
|
||||||
|
|
||||||
__stack_chk_fail
|
__stack_chk_fail,
|
||||||
|
__stack_chk_guard
|
||||||
)
|
)
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -2251,7 +2290,11 @@ def PPCSystemLibrary
|
|||||||
LibmHasSinCosPPCF128,
|
LibmHasSinCosPPCF128,
|
||||||
AvailableIf<memcpy, isNotAIX>,
|
AvailableIf<memcpy, isNotAIX>,
|
||||||
LibcallImpls<(add Int128RTLibcalls), isPPC64>,
|
LibcallImpls<(add Int128RTLibcalls), isPPC64>,
|
||||||
DefaultStackProtector)>;
|
has__stack_chk_fail,
|
||||||
|
has__stack_smash_handler,
|
||||||
|
has___guard_local,
|
||||||
|
AvailableIf<__ssp_canary_word, isAIX>,
|
||||||
|
AvailableIf<__stack_chk_guard, isNotAIX>)>;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// RISCV Runtime Libcalls
|
// RISCV Runtime Libcalls
|
||||||
@ -2334,7 +2377,10 @@ def SPARCSystemLibrary
|
|||||||
LibcallImpls<(add _Q_qtoll, _Q_qtoull, _Q_lltoq, _Q_ulltoq), isSPARC32>,
|
LibcallImpls<(add _Q_qtoll, _Q_qtoull, _Q_lltoq, _Q_ulltoq), isSPARC32>,
|
||||||
LibcallImpls<(add SPARC64_MulDivCalls, Int128RTLibcalls), isSPARC64>,
|
LibcallImpls<(add SPARC64_MulDivCalls, Int128RTLibcalls), isSPARC64>,
|
||||||
LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
|
LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
|
||||||
DefaultStackProtector)
|
has__stack_chk_fail,
|
||||||
|
has__stack_smash_handler,
|
||||||
|
has___guard_local,
|
||||||
|
AvailableIf<__stack_chk_guard, isNotOSLinuxAndNotOSOpenBSD>)
|
||||||
>;
|
>;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -2544,7 +2590,7 @@ def WasmSystemLibrary
|
|||||||
exp10f, exp10,
|
exp10f, exp10,
|
||||||
_Unwind_CallPersonality,
|
_Unwind_CallPersonality,
|
||||||
emscripten_return_address,
|
emscripten_return_address,
|
||||||
__stack_chk_fail)>;
|
__stack_chk_fail, __stack_chk_guard)>;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Legacy Default Runtime Libcalls
|
// Legacy Default Runtime Libcalls
|
||||||
|
@ -2059,10 +2059,16 @@ Value *TargetLoweringBase::getIRStackGuard(IRBuilderBase &IRB) const {
|
|||||||
// Currently only support "standard" __stack_chk_guard.
|
// Currently only support "standard" __stack_chk_guard.
|
||||||
// TODO: add LOAD_STACK_GUARD support.
|
// TODO: add LOAD_STACK_GUARD support.
|
||||||
void TargetLoweringBase::insertSSPDeclarations(Module &M) const {
|
void TargetLoweringBase::insertSSPDeclarations(Module &M) const {
|
||||||
if (!M.getNamedValue("__stack_chk_guard")) {
|
RTLIB::LibcallImpl StackGuardImpl = getLibcallImpl(RTLIB::STACK_CHECK_GUARD);
|
||||||
|
if (StackGuardImpl == RTLIB::Unsupported)
|
||||||
|
return;
|
||||||
|
|
||||||
|
StringRef StackGuardVarName = getLibcallImplName(StackGuardImpl);
|
||||||
|
M.getOrInsertGlobal(
|
||||||
|
StackGuardVarName, PointerType::getUnqual(M.getContext()), [=, &M]() {
|
||||||
auto *GV = new GlobalVariable(M, PointerType::getUnqual(M.getContext()),
|
auto *GV = new GlobalVariable(M, PointerType::getUnqual(M.getContext()),
|
||||||
false, GlobalVariable::ExternalLinkage,
|
false, GlobalVariable::ExternalLinkage,
|
||||||
nullptr, "__stack_chk_guard");
|
nullptr, StackGuardVarName);
|
||||||
|
|
||||||
// FreeBSD has "__stack_chk_guard" defined externally on libc.so
|
// FreeBSD has "__stack_chk_guard" defined externally on libc.so
|
||||||
if (M.getDirectAccessExternalData() &&
|
if (M.getDirectAccessExternalData() &&
|
||||||
@ -2072,16 +2078,18 @@ void TargetLoweringBase::insertSSPDeclarations(Module &M) const {
|
|||||||
(!TM.getTargetTriple().isOSDarwin() ||
|
(!TM.getTargetTriple().isOSDarwin() ||
|
||||||
TM.getRelocationModel() == Reloc::Static))
|
TM.getRelocationModel() == Reloc::Static))
|
||||||
GV->setDSOLocal(true);
|
GV->setDSOLocal(true);
|
||||||
}
|
|
||||||
|
return GV;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently only support "standard" __stack_chk_guard.
|
// Currently only support "standard" __stack_chk_guard.
|
||||||
// TODO: add LOAD_STACK_GUARD support.
|
// TODO: add LOAD_STACK_GUARD support.
|
||||||
Value *TargetLoweringBase::getSDagStackGuard(const Module &M) const {
|
Value *TargetLoweringBase::getSDagStackGuard(const Module &M) const {
|
||||||
if (getTargetMachine().getTargetTriple().isOSOpenBSD()) {
|
RTLIB::LibcallImpl GuardVarImpl = getLibcallImpl(RTLIB::STACK_CHECK_GUARD);
|
||||||
return M.getNamedValue("__guard_local");
|
if (GuardVarImpl == RTLIB::Unsupported)
|
||||||
}
|
return nullptr;
|
||||||
return M.getNamedValue("__stack_chk_guard");
|
return M.getNamedValue(getLibcallImplName(GuardVarImpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
Function *TargetLoweringBase::getSSPStackGuardCheck(const Module &M) const {
|
Function *TargetLoweringBase::getSSPStackGuardCheck(const Module &M) const {
|
||||||
|
@ -46,18 +46,6 @@ static cl::opt<bool> DisableBitcodeVersionUpgrade(
|
|||||||
"disable-bitcode-version-upgrade", cl::Hidden,
|
"disable-bitcode-version-upgrade", cl::Hidden,
|
||||||
cl::desc("Disable automatic bitcode upgrade for version mismatch"));
|
cl::desc("Disable automatic bitcode upgrade for version mismatch"));
|
||||||
|
|
||||||
static constexpr StringLiteral PreservedSymbols[] = {
|
|
||||||
// There are global variables, so put it here instead of in
|
|
||||||
// RuntimeLibcalls.td.
|
|
||||||
// TODO: Are there similar such variables?
|
|
||||||
"__ssp_canary_word",
|
|
||||||
"__stack_chk_guard",
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool isPreservedGlobalVarName(StringRef Name) {
|
|
||||||
return PreservedSymbols[0] == Name || PreservedSymbols[1] == Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const char *getExpectedProducerName() {
|
const char *getExpectedProducerName() {
|
||||||
@ -106,7 +94,7 @@ struct Builder {
|
|||||||
|
|
||||||
std::vector<storage::Str> DependentLibraries;
|
std::vector<storage::Str> DependentLibraries;
|
||||||
|
|
||||||
bool isPreservedLibFuncName(StringRef Name) {
|
bool isPreservedName(StringRef Name) {
|
||||||
return Libcalls.getSupportedLibcallImpl(Name) != RTLIB::Unsupported;
|
return Libcalls.getSupportedLibcallImpl(Name) != RTLIB::Unsupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,8 +269,7 @@ Error Builder::addSymbol(const ModuleSymbolTable &Msymtab,
|
|||||||
StringRef GVName = GV->getName();
|
StringRef GVName = GV->getName();
|
||||||
setStr(Sym.IRName, GVName);
|
setStr(Sym.IRName, GVName);
|
||||||
|
|
||||||
if (Used.count(GV) || isPreservedLibFuncName(GVName) ||
|
if (Used.count(GV) || isPreservedName(GVName))
|
||||||
isPreservedGlobalVarName(GVName))
|
|
||||||
Sym.Flags |= 1 << storage::Symbol::FB_used;
|
Sym.Flags |= 1 << storage::Symbol::FB_used;
|
||||||
if (GV->isThreadLocal())
|
if (GV->isThreadLocal())
|
||||||
Sym.Flags |= 1 << storage::Symbol::FB_tls;
|
Sym.Flags |= 1 << storage::Symbol::FB_tls;
|
||||||
|
@ -28686,9 +28686,13 @@ void AArch64TargetLowering::insertSSPDeclarations(Module &M) const {
|
|||||||
// MSVC CRT provides functionalities for stack protection.
|
// MSVC CRT provides functionalities for stack protection.
|
||||||
RTLIB::LibcallImpl SecurityCheckCookieLibcall =
|
RTLIB::LibcallImpl SecurityCheckCookieLibcall =
|
||||||
getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
|
getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
|
||||||
if (SecurityCheckCookieLibcall != RTLIB::Unsupported) {
|
|
||||||
|
RTLIB::LibcallImpl SecurityCookieVar =
|
||||||
|
getLibcallImpl(RTLIB::STACK_CHECK_GUARD);
|
||||||
|
if (SecurityCheckCookieLibcall != RTLIB::Unsupported &&
|
||||||
|
SecurityCookieVar != RTLIB::Unsupported) {
|
||||||
// MSVC CRT has a global variable holding security cookie.
|
// MSVC CRT has a global variable holding security cookie.
|
||||||
M.getOrInsertGlobal("__security_cookie",
|
M.getOrInsertGlobal(getLibcallImplName(SecurityCookieVar),
|
||||||
PointerType::getUnqual(M.getContext()));
|
PointerType::getUnqual(M.getContext()));
|
||||||
|
|
||||||
// MSVC CRT has a function to validate security cookie.
|
// MSVC CRT has a function to validate security cookie.
|
||||||
@ -28705,13 +28709,6 @@ void AArch64TargetLowering::insertSSPDeclarations(Module &M) const {
|
|||||||
TargetLowering::insertSSPDeclarations(M);
|
TargetLowering::insertSSPDeclarations(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *AArch64TargetLowering::getSDagStackGuard(const Module &M) const {
|
|
||||||
// MSVC CRT has a global variable holding security cookie.
|
|
||||||
if (Subtarget->getTargetTriple().isWindowsMSVCEnvironment())
|
|
||||||
return M.getGlobalVariable("__security_cookie");
|
|
||||||
return TargetLowering::getSDagStackGuard(M);
|
|
||||||
}
|
|
||||||
|
|
||||||
Function *AArch64TargetLowering::getSSPStackGuardCheck(const Module &M) const {
|
Function *AArch64TargetLowering::getSSPStackGuardCheck(const Module &M) const {
|
||||||
// MSVC CRT has a function to validate security cookie.
|
// MSVC CRT has a function to validate security cookie.
|
||||||
RTLIB::LibcallImpl SecurityCheckCookieLibcall =
|
RTLIB::LibcallImpl SecurityCheckCookieLibcall =
|
||||||
|
@ -354,7 +354,6 @@ public:
|
|||||||
Value *getIRStackGuard(IRBuilderBase &IRB) const override;
|
Value *getIRStackGuard(IRBuilderBase &IRB) const override;
|
||||||
|
|
||||||
void insertSSPDeclarations(Module &M) const override;
|
void insertSSPDeclarations(Module &M) const override;
|
||||||
Value *getSDagStackGuard(const Module &M) const override;
|
|
||||||
Function *getSSPStackGuardCheck(const Module &M) const override;
|
Function *getSSPStackGuardCheck(const Module &M) const override;
|
||||||
|
|
||||||
/// If the target has a standard location for the unsafe stack pointer,
|
/// If the target has a standard location for the unsafe stack pointer,
|
||||||
|
@ -21341,20 +21341,6 @@ void ARMTargetLowering::insertSSPDeclarations(Module &M) const {
|
|||||||
F->addParamAttr(0, Attribute::AttrKind::InReg);
|
F->addParamAttr(0, Attribute::AttrKind::InReg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *ARMTargetLowering::getSDagStackGuard(const Module &M) const {
|
|
||||||
RTLIB::LibcallImpl SecurityCheckCookieLibcall =
|
|
||||||
getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
|
|
||||||
if (SecurityCheckCookieLibcall != RTLIB::Unsupported) {
|
|
||||||
// MSVC CRT has a global variable holding security cookie.
|
|
||||||
//
|
|
||||||
// FIXME: We have a libcall entry for the correlated check function, but not
|
|
||||||
// the global name.
|
|
||||||
return M.getGlobalVariable("__security_cookie");
|
|
||||||
}
|
|
||||||
|
|
||||||
return TargetLowering::getSDagStackGuard(M);
|
|
||||||
}
|
|
||||||
|
|
||||||
Function *ARMTargetLowering::getSSPStackGuardCheck(const Module &M) const {
|
Function *ARMTargetLowering::getSSPStackGuardCheck(const Module &M) const {
|
||||||
// MSVC CRT has a function to validate security cookie.
|
// MSVC CRT has a function to validate security cookie.
|
||||||
RTLIB::LibcallImpl SecurityCheckCookie =
|
RTLIB::LibcallImpl SecurityCheckCookie =
|
||||||
|
@ -704,7 +704,6 @@ class VectorType;
|
|||||||
bool useLoadStackGuardNode(const Module &M) const override;
|
bool useLoadStackGuardNode(const Module &M) const override;
|
||||||
|
|
||||||
void insertSSPDeclarations(Module &M) const override;
|
void insertSSPDeclarations(Module &M) const override;
|
||||||
Value *getSDagStackGuard(const Module &M) const override;
|
|
||||||
Function *getSSPStackGuardCheck(const Module &M) const override;
|
Function *getSSPStackGuardCheck(const Module &M) const override;
|
||||||
|
|
||||||
bool canCombineStoreAndExtract(Type *VectorTy, Value *Idx,
|
bool canCombineStoreAndExtract(Type *VectorTy, Value *Idx,
|
||||||
|
@ -158,8 +158,6 @@ static bool isNByteElemShuffleMask(ShuffleVectorSDNode *, unsigned, int);
|
|||||||
|
|
||||||
static SDValue widenVec(SelectionDAG &DAG, SDValue Vec, const SDLoc &dl);
|
static SDValue widenVec(SelectionDAG &DAG, SDValue Vec, const SDLoc &dl);
|
||||||
|
|
||||||
static const char AIXSSPCanaryWordName[] = "__ssp_canary_word";
|
|
||||||
|
|
||||||
// A faster local-[exec|dynamic] TLS access sequence (enabled with the
|
// A faster local-[exec|dynamic] TLS access sequence (enabled with the
|
||||||
// -maix-small-local-[exec|dynamic]-tls option) can be produced for TLS
|
// -maix-small-local-[exec|dynamic]-tls option) can be produced for TLS
|
||||||
// variables; consistent with the IBM XL compiler, we apply a max size of
|
// variables; consistent with the IBM XL compiler, we apply a max size of
|
||||||
@ -18656,24 +18654,6 @@ bool PPCTargetLowering::useLoadStackGuardNode(const Module &M) const {
|
|||||||
return TargetLowering::useLoadStackGuardNode(M);
|
return TargetLowering::useLoadStackGuardNode(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override to disable global variable loading on Linux and insert AIX canary
|
|
||||||
// word declaration.
|
|
||||||
void PPCTargetLowering::insertSSPDeclarations(Module &M) const {
|
|
||||||
if (Subtarget.isAIXABI()) {
|
|
||||||
M.getOrInsertGlobal(AIXSSPCanaryWordName,
|
|
||||||
PointerType::getUnqual(M.getContext()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!Subtarget.isTargetLinux())
|
|
||||||
return TargetLowering::insertSSPDeclarations(M);
|
|
||||||
}
|
|
||||||
|
|
||||||
Value *PPCTargetLowering::getSDagStackGuard(const Module &M) const {
|
|
||||||
if (Subtarget.isAIXABI())
|
|
||||||
return M.getGlobalVariable(AIXSSPCanaryWordName);
|
|
||||||
return TargetLowering::getSDagStackGuard(M);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PPCTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
|
bool PPCTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
|
||||||
bool ForCodeSize) const {
|
bool ForCodeSize) const {
|
||||||
if (!VT.isSimple() || !Subtarget.hasVSX())
|
if (!VT.isSimple() || !Subtarget.hasVSX())
|
||||||
|
@ -1141,8 +1141,6 @@ namespace llvm {
|
|||||||
|
|
||||||
/// Override to support customized stack guard loading.
|
/// Override to support customized stack guard loading.
|
||||||
bool useLoadStackGuardNode(const Module &M) const override;
|
bool useLoadStackGuardNode(const Module &M) const override;
|
||||||
void insertSSPDeclarations(Module &M) const override;
|
|
||||||
Value *getSDagStackGuard(const Module &M) const override;
|
|
||||||
|
|
||||||
bool isFPImmLegal(const APFloat &Imm, EVT VT,
|
bool isFPImmLegal(const APFloat &Imm, EVT VT,
|
||||||
bool ForCodeSize) const override;
|
bool ForCodeSize) const override;
|
||||||
|
@ -3549,12 +3549,6 @@ bool SparcTargetLowering::isFMAFasterThanFMulAndFAdd(const MachineFunction &MF,
|
|||||||
return Subtarget->isUA2007() && !Subtarget->useSoftFloat();
|
return Subtarget->isUA2007() && !Subtarget->useSoftFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override to disable global variable loading on Linux.
|
|
||||||
void SparcTargetLowering::insertSSPDeclarations(Module &M) const {
|
|
||||||
if (!Subtarget->isTargetLinux())
|
|
||||||
return TargetLowering::insertSSPDeclarations(M);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SparcTargetLowering::AdjustInstrPostInstrSelection(MachineInstr &MI,
|
void SparcTargetLowering::AdjustInstrPostInstrSelection(MachineInstr &MI,
|
||||||
SDNode *Node) const {
|
SDNode *Node) const {
|
||||||
assert(MI.getOpcode() == SP::SUBCCrr || MI.getOpcode() == SP::SUBCCri);
|
assert(MI.getOpcode() == SP::SUBCCrr || MI.getOpcode() == SP::SUBCCri);
|
||||||
|
@ -79,7 +79,6 @@ namespace llvm {
|
|||||||
|
|
||||||
/// Override to support customized stack guard loading.
|
/// Override to support customized stack guard loading.
|
||||||
bool useLoadStackGuardNode(const Module &M) const override;
|
bool useLoadStackGuardNode(const Module &M) const override;
|
||||||
void insertSSPDeclarations(Module &M) const override;
|
|
||||||
|
|
||||||
/// getSetCCResultType - Return the ISD::SETCC ValueType
|
/// getSetCCResultType - Return the ISD::SETCC ValueType
|
||||||
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context,
|
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context,
|
||||||
|
@ -1591,7 +1591,6 @@ namespace llvm {
|
|||||||
bool useLoadStackGuardNode(const Module &M) const override;
|
bool useLoadStackGuardNode(const Module &M) const override;
|
||||||
bool useStackGuardXorFP() const override;
|
bool useStackGuardXorFP() const override;
|
||||||
void insertSSPDeclarations(Module &M) const override;
|
void insertSSPDeclarations(Module &M) const override;
|
||||||
Value *getSDagStackGuard(const Module &M) const override;
|
|
||||||
Function *getSSPStackGuardCheck(const Module &M) const override;
|
Function *getSSPStackGuardCheck(const Module &M) const override;
|
||||||
SDValue emitStackGuardXorFP(SelectionDAG &DAG, SDValue Val,
|
SDValue emitStackGuardXorFP(SelectionDAG &DAG, SDValue Val,
|
||||||
const SDLoc &DL) const override;
|
const SDLoc &DL) const override;
|
||||||
|
@ -632,15 +632,6 @@ void X86TargetLowering::insertSSPDeclarations(Module &M) const {
|
|||||||
TargetLowering::insertSSPDeclarations(M);
|
TargetLowering::insertSSPDeclarations(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *X86TargetLowering::getSDagStackGuard(const Module &M) const {
|
|
||||||
// MSVC CRT has a global variable holding security cookie.
|
|
||||||
if (Subtarget.getTargetTriple().isWindowsMSVCEnvironment() ||
|
|
||||||
Subtarget.getTargetTriple().isWindowsItaniumEnvironment()) {
|
|
||||||
return M.getGlobalVariable("__security_cookie");
|
|
||||||
}
|
|
||||||
return TargetLowering::getSDagStackGuard(M);
|
|
||||||
}
|
|
||||||
|
|
||||||
Function *X86TargetLowering::getSSPStackGuardCheck(const Module &M) const {
|
Function *X86TargetLowering::getSSPStackGuardCheck(const Module &M) const {
|
||||||
// MSVC CRT has a function to validate security cookie.
|
// MSVC CRT has a function to validate security cookie.
|
||||||
if (Subtarget.getTargetTriple().isWindowsMSVCEnvironment() ||
|
if (Subtarget.getTargetTriple().isWindowsMSVCEnvironment() ||
|
||||||
|
@ -65,8 +65,8 @@ define void @func() sspreq nounwind {
|
|||||||
; LINUX32: # %bb.0:
|
; LINUX32: # %bb.0:
|
||||||
; LINUX32-NEXT: mflr 0
|
; LINUX32-NEXT: mflr 0
|
||||||
; LINUX32-NEXT: stwu 1, -16(1)
|
; LINUX32-NEXT: stwu 1, -16(1)
|
||||||
; LINUX32-NEXT: stw 0, 20(1)
|
|
||||||
; LINUX32-NEXT: lwz 3, -28680(2)
|
; LINUX32-NEXT: lwz 3, -28680(2)
|
||||||
|
; LINUX32-NEXT: stw 0, 20(1)
|
||||||
; LINUX32-NEXT: stw 3, 12(1)
|
; LINUX32-NEXT: stw 3, 12(1)
|
||||||
; LINUX32-NEXT: addi 3, 1, 8
|
; LINUX32-NEXT: addi 3, 1, 8
|
||||||
; LINUX32-NEXT: bl capture
|
; LINUX32-NEXT: bl capture
|
||||||
@ -86,8 +86,8 @@ define void @func() sspreq nounwind {
|
|||||||
; LINUX64: # %bb.0:
|
; LINUX64: # %bb.0:
|
||||||
; LINUX64-NEXT: mflr 0
|
; LINUX64-NEXT: mflr 0
|
||||||
; LINUX64-NEXT: stdu 1, -128(1)
|
; LINUX64-NEXT: stdu 1, -128(1)
|
||||||
; LINUX64-NEXT: std 0, 144(1)
|
|
||||||
; LINUX64-NEXT: ld 3, -28688(13)
|
; LINUX64-NEXT: ld 3, -28688(13)
|
||||||
|
; LINUX64-NEXT: std 0, 144(1)
|
||||||
; LINUX64-NEXT: std 3, 120(1)
|
; LINUX64-NEXT: std 3, 120(1)
|
||||||
; LINUX64-NEXT: addi 3, 1, 116
|
; LINUX64-NEXT: addi 3, 1, 116
|
||||||
; LINUX64-NEXT: bl capture
|
; LINUX64-NEXT: bl capture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user