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

via libc-commits libc-commits at lists.llvm.org
Wed Dec 25 18:05:05 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Tristan Ross (RossComputerGuy)

<details>
<summary>Changes</summary>

`__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.

---
Full diff: https://github.com/llvm/llvm-project/pull/121121.diff


1 Files Affected:

- (modified) libc/src/compiler/generic/__stack_chk_fail.cpp (+2) 


``````````diff
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();

``````````

</details>


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


More information about the libc-commits mailing list