如何使用 g++ 取消设置 -fstack-protector 标志?

Aut*_*hre 1 c++ g++

当我启动 g++ 时,我看到很多默认标志:-mtune=generic -march=x86-64 -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -fcf-protection

有谁知道如何取消设置-fstack-protector-strong吗?

谢谢!

Hen*_*her 5

您可以使用以下命令撤消该选项

\n
-fno-stack-protector\n
Run Code Online (Sandbox Code Playgroud)\n

或者

\n
-fstack-protector\n
Run Code Online (Sandbox Code Playgroud)\n

如果您只想要基本的保护。

\n

参考: https: //gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html

\n

更新:

\n

该选项-fno-stack-protector确实没有明确记录。它是 gcc 通用选项处理的一部分。正如一般选项文档所述

\n
\n

许多选项的名称都以-f\' or with -W\'\xe2\x80\x94 开头,例如 -fforce-mem、-fstrength-reduce、-Wformat 等。其中大多数都有积极和消极的形式;-ffoo 的否定形式是 -fno-foo。本手册仅记录这两种形式中的一种,以非默认形式为准。

\n
\n