Community
cancel
Showing results for 
Search instead for 
Did you mean: 
SergeyKostrov
Valued Contributor II
878 Views

Passing a stack size value to a linker at compile time using -Xlinker compiler option

Passing a stack size value to a linker at compile time using -Xlinker compiler option
0 Kudos
6 Replies
SergeyKostrov
Valued Contributor II
878 Views

It is Not possible to pass a stack size value to a linker at compile time using -Xlinker compiler option with Intel C++ compiler v17 u2 for Linux. For example, on Windows platforms with MinGW C++ compiler I've been using Xlinker option for more than 5 years but with Intel C++ compiler for Linux it doesn't work: ... -Xlinker --stack=1073741824 ... You see that I pass a value 1073741824 to a linker for the stack linker option. Something is wrong and compatibility of passing parameters to the linker on Linux is broken. I've tried many-many different combinations and they don't work as well.
SergeyKostrov
Valued Contributor II
878 Views

Note: Please don't explain me how ulimit Linux utility works, or how it could be used instead. I need to use Xlinker option to set a stack size of an application at compile time.
Judith_W_Intel
Employee
878 Views

 

Does it work with ld?

The ld on my machine doesn't accept the --stack option.

ld sptel15-606> ld t.o --stack=1073741824
ld: unrecognized option '--stack=1073741824'
ld: use the --help option for usage information
sptel15-607>

It looks like the option is passed through to the linker when you use this syntax:

sptel15-621> icc -Xlinker --stack,max-page-size=2048 t.c
ld: unrecognized option '--stack,max-page-size=2048'
ld: use the --help option for usage information
sptel15-622>
 

SergeyKostrov
Valued Contributor II
878 Views

>>... >>sptel15-621> icc -Xlinker --stack,max-page-size=2048 t.c That option is not related to the problem. I think you're confirming the problem with LD and I understand that this is not a direct problem with Intel C++ compiler.
SergeyKostrov
Valued Contributor II
878 Views

Here are lists of all stack-related options for two versions of LD I use on two Linux systems: [ Linux Ubuntu ] ... ubuntu@ubuntu-vm:~$ icc -v icc version 17.0.2 (gcc version 5.0.0 compatibility) ubuntu@ubuntu-vm:~$ ld -v GNU ld (GNU Binutils for Ubuntu) 2.26 ubuntu@ubuntu-vm:~$ ld --help | grep stack -z execstack Mark executable as requiring executable stack -z noexecstack Mark executable as not requiring executable stack -z stacksize=SIZE Set size of stack segment --stack Set size of the initial stack --stack Set size of the initial stack ... [ Linux RedHat ] ... [guest@....-.... WorkTest]$ icc -v icc version 16.0.3 (gcc version 4.8.5 compatibility) [guest@....-.... WorkTest]$ ld -v GNU ld version 2.23.52.0.1-55.el7 20130226 [guest@....-.... WorkTest]$ ld --help | grep stack -z execstack Mark executable as requiring executable stack -z noexecstack Mark executable as not requiring executable stack -z stacksize=SIZE Set size of stack segment -z execstack Mark executable as requiring executable stack -z noexecstack Mark executable as not requiring executable stack -z stacksize=SIZE Set size of stack segment -z execstack Mark executable as requiring executable stack -z noexecstack Mark executable as not requiring executable stack -z stacksize=SIZE Set size of stack segment -z execstack Mark executable as requiring executable stack -z noexecstack Mark executable as not requiring executable stack -z stacksize=SIZE Set size of stack segment -z execstack Mark executable as requiring executable stack -z noexecstack Mark executable as not requiring executable stack -z stacksize=SIZE Set size of stack segment ... I've tried many different combinations and nothing worked. Thanks for your response, Judith.
SergeyKostrov
Valued Contributor II
878 Views

>>...I've tried many different combinations and nothing worked... I decided to use a workaround and I call an application from a script that first executes 'ulimit -s 268435456' Linux command.
Reply