gcc -mpreferred-stack-boundary option
compilation, gcc, linux, stack
Solution
I want to know what's the use of -mpreferred-stack-boundary option during compilation in GNU debugger.
The option has absolutely nothing to do with the debugger.
It affects generated code in your binary. By default, GCC will arrange things so that every function, immediately upon entry, has its stack pointer aligned on 16-byte boundary (this may be important if you have local variables, and enable `sse2` instructions).
If you change the default to e.g. `-mpreferred-stack-boundary=2`, then GCC will align stack pointer on 4-byte boundary. This will reduce stack requirements of your routines, but will crash if your code (or code you call) does use `sse2`, so is generally not safe.
Problem
I want to know what's the use of `-mpreferred-stack-boundary` option during compilation in GNU compiler. I've checked the documentation but the explanation is lost on me. Could someone please explain it.