[stackprotector] Add in the stackprotector libcall.
authorMichael Gottesman <mgottesman@apple.com>
Mon, 12 Aug 2013 18:45:38 +0000 (18:45 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Mon, 12 Aug 2013 18:45:38 +0000 (18:45 +0000)
We support this libcall on all platforms except for OpenBSD (See
lib/Codegen/StackProtector.cpp).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188193 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/RuntimeLibcalls.h
lib/CodeGen/TargetLoweringBase.cpp

index e578b509cf91876cb79230c3d202fa38425a9baa..14769ec20573cf2462e5e38e07c7fec3e59038ef 100644 (file)
@@ -354,6 +354,9 @@ namespace RTLIB {
     SYNC_FETCH_AND_NAND_4,
     SYNC_FETCH_AND_NAND_8,
 
+    // Stack Protector Fail.
+    STACKPROTECTOR_CHECK_FAIL,
+
     UNKNOWN_LIBCALL
   };
 
index b3711adce04375c4a2ed380424b29f3fda2f7238..55125bd23f9fd60cc6189517233353cf88d16d56 100644 (file)
@@ -361,6 +361,13 @@ static void InitLibcallNames(const char **Names, const TargetMachine &TM) {
     Names[RTLIB::SINCOS_F128] = 0;
     Names[RTLIB::SINCOS_PPCF128] = 0;
   }
+
+  if (Triple(TM.getTargetTriple()).getOS() != Triple::OpenBSD) {
+    Names[RTLIB::STACKPROTECTOR_CHECK_FAIL] = "__stack_chk_fail";
+  } else {
+    // These are generally not available.
+    Names[RTLIB::STACKPROTECTOR_CHECK_FAIL] = 0;
+  }
 }
 
 /// InitLibcallCallingConvs - Set default libcall CallingConvs.