在OSX C++程序编译期间g++
我使用
LD_FLAGS= -Wl,-stack_size,0x100000000
Run Code Online (Sandbox Code Playgroud)
但在SUSE Linux中,我经常遇到如下错误:
x86_64-suse-linux/bin/ld: unrecognized option '--stack'
Run Code Online (Sandbox Code Playgroud)
和类似的.
我知道可以使用
ulimit -s unlimited
Run Code Online (Sandbox Code Playgroud)
但这并不好,因为单个用户并不总能做到这一点.
如何在单个应用程序中使用GCC增加Linux中的堆栈大小?
我可以用clang ++指定堆栈大小吗?我找不到任何允许我这样做的编译器选项.我正在使用OS X.
注意:这个问题具体是指Clang,而不是GCC编译器.
I'm trying to understand how stack works in Linux. I read AMD64 ABI sections about stack and process initialization and it is not clear how the stack should be mapped. Here is the relevant quote (3.4.1):
Stack State
This section describes the machine state that
exec
(BA_OS) creates for new processes.
and
It is unspecified whether the data and stack segments are initially mapped with execute permissions or not. Applications which need to execute code on the stack or data …