From 74f03ddadb4fef78cc37c1d2569f09b50eff9221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Fri, 5 Nov 2021 18:11:25 +0100 Subject: [PATCH] CI: statically check stack size on Linux (#3055) --- .github/workflows/ci.yml | 6 ++++++ config.nims | 3 ++- vendor/nimbus-build-system | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6736d6032..db464b6ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,6 +120,12 @@ jobs: echo "ARCH=$ARCH" >> $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 if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'i386' ]]; then export CFLAGS="${CFLAGS} -m32 -mno-adx" diff --git a/config.nims b/config.nims index ca639083c..538c00d01 100644 --- a/config.nims +++ b/config.nims @@ -43,7 +43,8 @@ if defined(cwarnings): if defined(limitStackUsage): # 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` - # 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("passL", "-fstack-usage -Werror=stack-usage=1048576") diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system index 5fbffb228..e5bc3dd3a 160000 --- a/vendor/nimbus-build-system +++ b/vendor/nimbus-build-system @@ -1 +1 @@ -Subproject commit 5fbffb22859a85aa0dc3e9238cc03d92ab197682 +Subproject commit e5bc3dd3a2736d0226c90c8300746069fdb69174