For the future, gcc has a flag: -fstack-usage
when compiling it generates *.su files that have info how much bytes a function would need for stack.
After adding that, recompiling cpuminer-opt on core2 and then printing all *.su files, sorted by size:
$ find . -iname '*.su' -print0 | xargs -0 cat |sort -k2n|tail|column -t
x17.c:212:6:x17hash_alt 3904 static
cpu-miner.c:2689:5:main 4144 static
x17.c:87:13:x17hash 4256 static
hodl-wolf.c:28:5:scanhash_hodl_wolf 4304 static
scrypt.c:696:12:scanhash_scrypt 7680 dynamic,bounded
hmq1725.c:143:13:hmq1725hash 7744 static
scrypt.c:648:13:scrypt_1024_1_1_256_24way 9088 dynamic,bounded
m7mhash.c:195:5:scanhash_m7m_hash 12464 dynamic,bounded
api.c:511:13:api 17136 dynamic,bounded
cryptonight.c:172:6:cryptonight_hash_ctx 2097648 static
You might want to increase max stack size in makefile to 3mb or more, setting it to 2MB isn't enough because you need 2097648 bytes just for that function.
Edit2: I couldn't find any documentation for --stack so I don't know what makefile is doing.
"-Wl," means "pass this to linker", which means ld, so you need to check the documentation of ld --
http://linux.die.net/man/1/ldOn Windows, stack size limit is specified in the binary. On Linux, the limit is set by system administrator. On current debian, default is 8Mb.
I found -fno-stack-limit but it still crashes at the same place.
This is different feature from above, and -fno-stack-limit is used to negate -fstack-limit-register/-fstack-limit-symbol, by default this feature is not set.