CI: statically check stack size on Linux (#3055)

This commit is contained in:
Ștefan Talpalaru 2021-11-05 18:11:25 +01:00 committed by GitHub
parent ea0a191723
commit 74f03ddadb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -120,6 +120,12 @@ jobs:
echo "ARCH=$ARCH" >> $GITHUB_ENV echo "ARCH=$ARCH" >> $GITHUB_ENV
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
# Stack usage test on recent enough gcc:
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'amd64' ]]; then
export NIMFLAGS="${NIMFLAGS} -d:limitStackUsage"
echo "NIMFLAGS=$NIMFLAGS" >> $GITHUB_ENV
fi
# libminiupnp / natpmp # libminiupnp / natpmp
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'i386' ]]; then if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'i386' ]]; then
export CFLAGS="${CFLAGS} -m32 -mno-adx" export CFLAGS="${CFLAGS} -m32 -mno-adx"

View File

@ -43,7 +43,8 @@ if defined(cwarnings):
if defined(limitStackUsage): if defined(limitStackUsage):
# This limits stack usage of each individual function to 1MB - the option is # This limits stack usage of each individual function to 1MB - the option is
# available on some GCC versions but not all - run with `-d:limitStackUsage` # available on some GCC versions but not all - run with `-d:limitStackUsage`
# and look for .su files in "./nimcache/" that list the stack size of each function # and look for .su files in "./build/", "./nimcache/" or $TMPDIR that list the
# stack size of each function.
switch("passC", "-fstack-usage -Werror=stack-usage=1048576") switch("passC", "-fstack-usage -Werror=stack-usage=1048576")
switch("passL", "-fstack-usage -Werror=stack-usage=1048576") switch("passL", "-fstack-usage -Werror=stack-usage=1048576")

@ -1 +1 @@
Subproject commit 5fbffb22859a85aa0dc3e9238cc03d92ab197682 Subproject commit e5bc3dd3a2736d0226c90c8300746069fdb69174