git: gcc47, gcc80: Define LINK_SSP_SPEC to link with libssp_nonshared.a
Aaron LI
aly at crater.dragonflybsd.org
Mon Mar 23 00:40:20 PDT 2026
commit 6bf6d109a5126fea31487a000025d5f2a530d6d5
Author: Aaron LI <aly at aaronly.me>
Date: Fri Mar 6 11:10:54 2026 +0800
gcc47,gcc80: Define LINK_SSP_SPEC to link with libssp_nonshared.a
libssp_nonshared.a provides '__stack_chk_fail_local()' as a hidden
symbol to avoids PLT overhead on 32-bit x86 by deferring PIC register
setup to the cold failure path. Although our libc.a (static) also
provides the '__stack_chk_fail_local()', it cannot be used when the
program is dynamically linked.
Note that on x86-64, GCC calls '__stack_chk_fail()' directly because
RIP-relative addressing makes PLT efficient, but we link
libssp_nonshared.a for consistency with other systems as well as for
future-proof.
One more thing, the 'TARGET_LIBC_PROVIDES_SSP' macro is undefined in GCC
4.7's 'auto-host.h' but defined to be 1 in GCC 8.0's. However, this
difference is ignored when 'LINK_SSP_SPEC' is explicitly defined.
Summary of changes:
gnu/usr.bin/cc47/cc_prep/config/dragonfly-native.h | 16 ++++++++++++++++
gnu/usr.bin/cc80/cc_prep/config/dragonfly-native.h | 16 ++++++++++++++++
2 files changed, 32 insertions(+)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6bf6d109a5126fea31487a000025d5f2a530d6d5
--
DragonFly BSD source repository
More information about the Commits
mailing list