Skip to content

Commit

Permalink
[stackprotector] Add in the stackprotector libcall.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gottesmm committed Aug 12, 2013
1 parent 2a64a63 commit 15b2782
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/llvm/CodeGen/RuntimeLibcalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ namespace RTLIB {
SYNC_FETCH_AND_NAND_4,
SYNC_FETCH_AND_NAND_8,

// Stack Protector Fail.
STACKPROTECTOR_CHECK_FAIL,

UNKNOWN_LIBCALL
};

Expand Down
7 changes: 7 additions & 0 deletions lib/CodeGen/TargetLoweringBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 15b2782

Please sign in to comment.