Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

increasing the stack size using compiler flags

i'm using gcc version 4.8.2, i'm on linux, having trouble with making a stack of size 8MB(8388608 bytes), due to the default stack size limit, tried "--main-stacksize=8388608" , but it didn't work.

any suggestions ?

my makefile...
Code
CPPFLAGS=    -g -w
all: run clean

run:  main.o lcf.o filz.o
    g++ $(CPPFLAGS) main.o lcf.o filz.o -o run

main.o: main.cpp
    g++ -c main.cpp

lcf.o: lcf.cpp
    g++ -c lcf.cpp

filz.o: filz.cpp
    g++ -c filz.cpp

clean:
    rm *.o

one more thing....

I ran this /usr/bin/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
--stack <size> Set size of the initial stack
--stack <size> Set size of the initial stack



so I tried to add -z stacksize=8388608 in the CPPFLAGS , but still no good, cuz the linker chooses to ignore it after giving me a warning.
GIMME MY OLD AVATAR BACK  :/
try this http://stackoverflow.com/questions/18909...ng-on-os-x
What distro are you running? Is it a virtual machine?
(Jun 14, 2015 08:01 PM)jfishy Wrote:  What distro are you running? Is it a virtual machine?

yes it is, a virtual machine running lubuntu 14.01

(Jun 14, 2015 05:18 PM)Only3 Wrote:  try this http://stackoverflow.com/questions/18909...ng-on-os-x

it didn't work, ld gives this error:

/usr/bin/ld: unrecognised -a option `ck_size'

The problem is kinda solved using this line..

> ulimit -s 32768 sets the stack size to 32M bytes
GIMME MY OLD AVATAR BACK  :/


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by 6577657534735Jun 20, 2019 09:48 PM 5 172 Jun 20, 2019 09:48 PM
Last Post: doxerhacker
[C#] by AurianaJul 5, 2018 06:29 PM 0 194 Jul 5, 2018 06:29 PM
Last Post: Auriana
[C#] by FireNiceJun 29, 2016 01:47 AM 11 830 Jun 29, 2016 01:47 AM
Last Post: ubbelol