aboutsummaryrefslogtreecommitdiff
path: root/libc/src/compiler/generic/__stack_chk_fail.cpp
blob: 7edd16cf6a864d2f3e93a1cc6d98d7c9972a0280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//===-- Implementation of __stack_chk_fail --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/compiler/__stack_chk_fail.h"
#include "hdr/stdint_proxy.h" // For uintptr_t
#include "src/__support/OSUtil/io.h"
#include "src/stdlib/abort.h"

extern "C" {

uintptr_t __stack_chk_guard = static_cast<uintptr_t>(0xa9fff01234);

void __stack_chk_fail(void) {
  LIBC_NAMESPACE::write_to_stderr("stack smashing detected\n");
  LIBC_NAMESPACE::abort();
}

} // extern "C"