1 From: Baruch Siach <baruch@tkos.co.il>
2 Date: Tue, 27 Oct 2015 13:58:24 +0200
3 Subject: [PATCH] configure.ac: fix stack protector test
5 gcc does not generate stack protection check code for function that does not
6 use its stack. Some toolchain (most notable uClibc based) accept the
7 -fstack-protector option, but don't provide libssp. The current test will
8 incorrectly identify this case, leading to link failures like:
10 ipmiutil.o: In function `main':
11 ipmiutil.c:(.text.startup+0x1c0): undefined reference to
12 `__stack_chk_fail_local'
13 ialarms.o: In function `get_alarms_picmg':
14 ialarms.c:(.text+0x1c5): undefined reference to `__stack_chk_fail_local'
15 ialarms.o: In function `.L46':
16 ialarms.c:(.text+0x362): undefined reference to `__stack_chk_fail_local'
17 ialarms.o: In function `get_enc_leds':
18 ialarms.c:(.text+0x45f): undefined reference to `__stack_chk_fail_local'
20 Add stack usage code to the test to correctly identify missing libssp.
22 Patch status: sent upstream
23 (http://sourceforge.net/p/ipmiutil/mailman/message/34572536/)
25 Signed-off-by: Baruch Siach <baruch@tkos.co.il>
28 1 file changed, 1 insertion(+), 1 deletion(-)
30 diff --git a/configure.ac b/configure.ac
31 index 41b6ea89167a..f3f60fb9ff69 100644
34 @@ -334,7 +334,7 @@ else
35 rm -f $tmpc $tmpo >/dev/null 2>&1
36 echo $ECHO_N "checking compile fortify flags ... $ECHO_C"
37 cfhard="-fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
38 - echo "int main() { return(1); }" >$tmpc
39 + echo "int main() { alloca(100); return(1); }" >$tmpc
40 $CC -o $tmpo $cfhard $tmpc >/dev/null 2>&1
41 if test $? -ne 0 ; then