[libc-commits] [libc] [libc] add __stack_chk_guard to generic (PR #121121)

Tristan Ross via libc-commits libc-commits at lists.llvm.org
Wed Dec 25 18:04:35 PST 2024


https://github.com/RossComputerGuy created https://github.com/llvm/llvm-project/pull/121121

`__stack_chk_guard` is needed for many things and it's undefined so let's define it. If we need a more complex definition, we can do it per target or expand it. This is meant as a simple definition.

>From b4a9f336b2943bfd428281cf43ab462ce08f2d8f Mon Sep 17 00:00:00 2001
From: Tristan Ross <tristan.ross at midstall.com>
Date: Wed, 25 Dec 2024 18:02:38 -0800
Subject: [PATCH] [libc] add __stack_chk_guard to generic

---
 libc/src/compiler/generic/__stack_chk_fail.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libc/src/compiler/generic/__stack_chk_fail.cpp b/libc/src/compiler/generic/__stack_chk_fail.cpp
index c76ec1407ad356..68ab887afe3175 100644
--- a/libc/src/compiler/generic/__stack_chk_fail.cpp
+++ b/libc/src/compiler/generic/__stack_chk_fail.cpp
@@ -12,6 +12,8 @@
 
 extern "C" {
 
+uintptr_t __stack_chk_guard;
+
 void __stack_chk_fail(void) {
   LIBC_NAMESPACE::write_to_stderr("stack smashing detected\n");
   LIBC_NAMESPACE::abort();



More information about the libc-commits mailing list