xref: /illumos-gate/usr/src/lib/ssp_ns/common/ssp_ns.c (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2020 Oxide Computer Company
14  */
15 
16 #include <sys/ccompile.h>
17 
18 /*
19  * To impement gcc's stack protector library, the compiler emits a function call
20  * to a symbol which can be called absolutely. As a result, to make that happen,
21  * we mimic what gcc does with libssp and create an archive file that can be
22  * used in the specs file to pull this in directly. This is a bit of a pain, but
23  * that's the best we can do given the architecture that we have.
24  *
25  * Warning: This is a static archive. Nothing beyond the call for
26  * __stack_chk_fail_local and calls to committed interfaces should be here. As
27  * this implementation will be linked into programs, one should exercise care to
28  * make sure we don't expose anything else here.
29  */
30 
31 extern void __stack_chk_fail(void);
32 
33 void __HIDDEN
34 __stack_chk_fail_local(void)
35 {
36 	__stack_chk_fail();
37 }
38