Home > Software engineering >  How to unset -fstack-protector flag with g ?
How to unset -fstack-protector flag with g ?

Time:09-02

When I launch g , I see a lot of default flags : -mtune=generic -march=x86-64 -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -fcf-protection.

Anyone knows how to unset -fstack-protector-strong ?

Thx!

CodePudding user response:

You undo that option with

-fno-stack-protector

or

-fstack-protector

if you only want the basic protection.

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

UPDATE:

The option -fno-stack-protector is really not documented explicitly. It is part of the generic options handling of gcc. As the general options documentation says:

Many options have long names starting with -f' or with -W'—for example, -fforce-mem, -fstrength-reduce, -Wformat and so on. Most of these have both positive and negative forms; the negative form of -ffoo would be -fno-foo. This manual documents only one of these two forms, whichever one is not the default.

  • Related