if not IN_LAUNCH_DIR(conf):
return
- if conf.CHECK_CFLAGS(['-fstack-protector']) and conf.CHECK_LDFLAGS(['-fstack-protector']):
- conf.ADD_CFLAGS('-fstack-protector')
- conf.ADD_LDFLAGS('-fstack-protector')
+ # we need to build real code that can't be optimized away to test
+ if conf.check(fragment='''
+ #include <stdio.h>
+
+ int main(void)
+ {
+ char t[100000];
+ while (fgets(t, sizeof(t), stdin));
+ return 0;
+ }
+ ''',
+ execute=0,
+ ccflags='-fstack-protector',
+ ldflags='-fstack-protector',
+ msg='Checking if toolchain accepts -fstack-protector'):
+ conf.ADD_CFLAGS('-fstack-protector')
+ conf.ADD_LDFLAGS('-fstack-protector')
if Options.options.debug:
conf.ADD_CFLAGS('-g', testflags=True)