choice
prompt "User space Stack-Smashing Protection"
- depends on USE_MUSL
default PKG_CC_STACKPROTECTOR_REGULAR
help
Enable GCC Stack Smashing Protection (SSP) for userspace applications
bool "None"
config PKG_CC_STACKPROTECTOR_REGULAR
bool "Regular"
- select GCC_LIBSSP if !USE_MUSL
depends on KERNEL_CC_STACKPROTECTOR_REGULAR
config PKG_CC_STACKPROTECTOR_STRONG
bool "Strong"
- select GCC_LIBSSP if !USE_MUSL
depends on KERNEL_CC_STACKPROTECTOR_STRONG
endchoice
choice
prompt "Kernel space Stack-Smashing Protection"
default KERNEL_CC_STACKPROTECTOR_REGULAR
- depends on USE_MUSL || !(x86_64 || i386)
help
Enable GCC Stack-Smashing Protection (SSP) for the kernel
config KERNEL_CC_STACKPROTECTOR_NONE
# See /LICENSE for more information.
#
-PKG_DEFAULT_DEPENDS = +libc +GCC_LIBSSP:libssp +USE_GLIBC:librt +USE_GLIBC:libpthread
+PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread
ifneq ($(PKG_NAME),toolchain)
PKG_FIXUP_DEPENDS = $(if $(filter kmod-%,$(1)),$(2),$(PKG_DEFAULT_DEPENDS) $(filter-out $(PKG_DEFAULT_DEPENDS),$(2)))
endmenu
endef
-define Package/libssp
-$(call Package/gcc/Default)
- DEPENDS+=@GCC_LIBSSP
- TITLE:=GCC support library
-endef
-
-define Package/libssp/config
- menu "Configuration"
- depends on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
-
- config LIBSSP_ROOT_DIR
- string
- prompt "libssp shared library base directory"
- depends on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
- default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
- default "/" if NATIVE_TOOLCHAIN
-
- config LIBSSP_FILE_SPEC
- string
- prompt "libssp shared library files (use wildcards)"
- depends on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
- default "./lib/libssp.so.*"
-
- endmenu
-endef
-
-
define Package/libstdcpp
$(call Package/gcc/Default)
NAME:=libstdc++
$(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/
endef
- define Package/libssp/install
- $(INSTALL_DIR) $(1)/lib
- $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
- endef
-
define Package/libstdcpp/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
done
endef
- define Package/libssp/install
- for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \
- $(INSTALL_DIR) $(1)/lib ; \
- $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/lib/ ; \
- done ; \
- exit 0
- endef
-
define Package/libstdcpp/install
for file in $(call qstrip,$(CONFIG_LIBSTDCPP_FILE_SPEC)); do \
$(INSTALL_DIR) $(1)/lib ; \
$(eval $(call BuildPackage,libc))
$(eval $(call BuildPackage,libgcc))
$(eval $(call BuildPackage,libatomic))
-$(eval $(call BuildPackage,libssp))
$(eval $(call BuildPackage,libstdcpp))
$(eval $(call BuildPackage,libasan))
$(eval $(call BuildPackage,libtsan))
endif
endif
-
# -Os miscompiles w. 2.24 gcc5/gcc6
# only -O2 tested by upstream changeset
# "Optimize i386 syscall inlining for GCC 5"
--without-cvs \
--enable-add-ons \
--$(if $(CONFIG_SOFT_FLOAT),without,with)-fp \
+ $(if $(CONFIG_PKG_CC_STACKPROTECTOR_REGULAR),--enable-stack-protector=yes) \
+ $(if $(CONFIG_PKG_CC_STACKPROTECTOR_STRONG),--enable-stack-protector=strong) \
--enable-kernel=4.14.0
export libc_cv_ssp=no