summaryrefslogtreecommitdiff
path: root/libc-parts/stack-protector.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-12-11 16:20:37 +0100
committerNeal H. Walfield <neal@gnu.org>2008-12-11 16:20:37 +0100
commit8560dd4d462e064c8050000d909d431ff0853b7b (patch)
treee178d76e1380d49980d5b4cfa30aca50f3e84779 /libc-parts/stack-protector.c
parented4456f529c1aef88110be4f3cde6710a368857f (diff)
Add support for -fstack-protector.
/ 2008-12-11 Neal H. Walfield <neal@gnu.org> * configure.ac (C_CHECKS): Add `-fstack-protector-all' for all runtime check levels except level 0. libc-parts/ 2008-12-11 Neal H. Walfield <neal@gnu.org> * headers.m4: Create sysroot/lib/libssp.a and sysroot/lib/libssp-nonshared.a. * stack-protector.c: New file. * Makefile.am (common_sources): Add stack-protector.c.
Diffstat (limited to 'libc-parts/stack-protector.c')
-rw-r--r--libc-parts/stack-protector.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libc-parts/stack-protector.c b/libc-parts/stack-protector.c
new file mode 100644
index 0000000..2c3bd58
--- /dev/null
+++ b/libc-parts/stack-protector.c
@@ -0,0 +1,30 @@
+/* stack-protector.c - Stack protector stubs.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Written by Neal H. Walfield <neal@gnu.org>.
+
+ This file is part of the GNU Hurd.
+
+ The GNU Hurd is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ The GNU Hurd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <hurd/stddef.h>
+
+int __stack_chk_guard = 0xcab00d1e;
+
+void
+__stack_chk_fail (void)
+{
+ backtrace_print ();
+ panic ("stack check failed!");
+}