From b091d23685dd59185b0b8e8e23786a452f622b16 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sat, 13 Jun 2015 22:26:58 -0500 Subject: [PATCH] fix libtool 2.4.2 stack-protector flag handling Teach libtool 2.4.2 how to pass -fstack-protector* to the linker so libssp is properly linked in on some toolchains. See upstream patch: https://github.com/instantinfrastructure/poky-daisy/blob/master/meta/recipes-devtools/libtool/libtool/respect-fstack-protector.patch Thanks to kinichiro inoguchi --- autogen.sh | 5 +++++ m4/check-hardening-options.m4 | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 0b0fc04..72174ea 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,3 +4,8 @@ set -e ./update.sh mkdir -p m4 autoreconf -i -f + +# Patch libtool 2.4.2 to pass -fstack-protector as a linker argument +sed 's/-fuse-linker-plugin)/-fuse-linker-plugin|-fstack-protector*)/' \ + ltmain.sh > ltmain.sh.fixed +mv -f ltmain.sh.fixed ltmain.sh diff --git a/m4/check-hardening-options.m4 b/m4/check-hardening-options.m4 index 544d283..3ffdb1a 100644 --- a/m4/check-hardening-options.m4 +++ b/m4/check-hardening-options.m4 @@ -94,7 +94,9 @@ AC_DEFUN([CHECK_C_HARDENING_OPTIONS], [ AC_MSG_WARN([compiler does not appear to support stack protection]) ) ) - AC_SEARCH_LIBS([__stack_chk_guard],[ssp]) + AS_IF([test "x$HOST_OS" = "xwin"], [ + AC_SEARCH_LIBS([__stack_chk_guard],[ssp]) + ]) ]) ])