24 lines · cpp
1//===-- Implementation of __stack_chk_fail --------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "src/compiler/__stack_chk_fail.h"10#include "hdr/stdint_proxy.h" // For uintptr_t11#include "src/__support/OSUtil/io.h"12#include "src/stdlib/abort.h"13 14extern "C" {15 16uintptr_t __stack_chk_guard = static_cast<uintptr_t>(0xa9fff01234);17 18void __stack_chk_fail(void) {19 LIBC_NAMESPACE::write_to_stderr("stack smashing detected\n");20 LIBC_NAMESPACE::abort();21}22 23} // extern "C"24