简体   繁体   English

为什么不直接使用命令'CFLAGS += -fno-stack-protector'?

[英]why not use command 'CFLAGS += -fno-stack-protector' directly?

CFLAGS  := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS  += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)

In the second line,i confuse why not use command CFLAGS += -fno-stack-protector directly?在第二行,我很困惑为什么不直接使用命令CFLAGS += -fno-stack-protector

It's a way to do a build-time check that the C compiler supports the -fno-stack-protector flag.这是一种进行构建时检查 C 编译器是否支持-fno-stack-protector标志的方法。

If the compiler doesn't support the flag then $(CC) -fno-stack-protector -E -xc /dev/null >/dev/null 2>&1 will fail and nothing will be added to CFLAGS .如果编译器不支持该标志,则$(CC) -fno-stack-protector -E -xc /dev/null >/dev/null 2>&1将失败并且不会向CFLAGS添加任何内容。

These kinds of checks are usually done by a build configuration script.这些类型的检查通常由构建配置脚本完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM