Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the illumos libc SSP implementation for -fstack-protector (9.3.0) #39

Open
wants to merge 1 commit into
base: il-9_3_0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions gcc/config/i386/sol2.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,20 @@ along with GCC; see the file COPYING3. If not see
/* We do not need NT_VERSION notes. */
#undef X86_FILE_START_VERSION_DIRECTIVE
#define X86_FILE_START_VERSION_DIRECTIVE false

/*
* As of 5788, the illumos libc includes support for the stack protector
* __stack_chk_fail() function and for the __stack_chk_guard variable.
* That means that, for most cases, no extra objects need to be linked in
* when compiling with one of the -fstack-protector options.
* However, for 32-bit PIC/PIE objects, the gcc stack protector emits a
* function call to __stack_chk_fail_local(); this symbol is provided in
* illumos via the libssp_ns.a object. The spec below includes this in the
* link when appropriate.
*/
#if defined(TARGET_LIBC_PROVIDES_SSP)
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all|" \
"fstack-protector-strong|fstack-protector-explicit:" \
DEF_ARCH32_SPEC("-lssp_ns") \
"}"
#endif
2 changes: 1 addition & 1 deletion gcc/configure
Original file line number Diff line number Diff line change
Expand Up @@ -29283,7 +29283,7 @@ fi
# realistically usable GNU/Hurd configurations.
# All supported versions of musl provide it as well
gcc_cv_libc_provides_ssp=yes;;
*-*-darwin* | *-*-freebsd* | *-*-netbsd*)
*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-solaris2*)
ac_fn_cxx_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
if test "x$ac_cv_func___stack_chk_fail" = xyes; then :
gcc_cv_libc_provides_ssp=yes
Expand Down
2 changes: 1 addition & 1 deletion gcc/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5965,7 +5965,7 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
# realistically usable GNU/Hurd configurations.
# All supported versions of musl provide it as well
gcc_cv_libc_provides_ssp=yes;;
*-*-darwin* | *-*-freebsd* | *-*-netbsd*)
*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-solaris2*)
AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
[echo "no __stack_chk_fail on this target"])
;;
Expand Down