| 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-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "src/compiler/__stack_chk_fail.h" |
| 10 | #include "src/__support/OSUtil/io.h" |
| 11 | #include "src/stdlib/abort.h" |
| 12 | #include <stdint.h> // For uintptr_t |
| 13 | |
| 14 | extern "C" { |
| 15 | |
| 16 | uintptr_t __stack_chk_guard = static_cast<uintptr_t>(0xa9fff01234); |
| 17 | |
| 18 | void __stack_chk_fail(void) { |
| 19 | LIBC_NAMESPACE::write_to_stderr("stack smashing detected\n" ); |
| 20 | LIBC_NAMESPACE::abort(); |
| 21 | } |
| 22 | |
| 23 | } // extern "C" |
| 24 | |