build: improve stack protector check
commit1399198d51d1f79ff99304369442e04c015eef23
authorGustavo Zacarias <gustavo@zacarias.com.ar>
Fri, 11 Sep 2015 19:57:16 +0000 (11 16:57 -0300)
committerJeremy Allison <jra@samba.org>
Mon, 21 Sep 2015 21:29:13 +0000 (21 23:29 +0200)
tree567cde34286b75eecbeb13519c59c6895ad90596
parentb4747b6364d9c49a3f146800921c44b3c39f59d1
build: improve stack protector check

Testing a toolchain for proper -fstack-protector must go beyond ensuring
the compiler and linker accept the option.
If the test C program does nothing with the stack then guards aren't
inserted and/or are optimized away giving the false impression that it
works when in fact the libc might not support it.

Update the check to a program that uses the stack, hence making a link
fail if proper support isn't available, for example in non-ssp enabled
uclibc toolchains like this:

test.c:(.text.startup+0x64): undefined reference to `__stack_chk_fail'

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Sep 21 23:29:13 CEST 2015 on sn-devel-104
buildtools/wafsamba/samba_autoconf.py