]> git.lizzy.rs Git - rust.git/blob - tests/run-make/static-pie/check_gcc_version.sh
Rollup merge of #107284 - notriddle:notriddle/plus, r=jsha
[rust.git] / tests / run-make / static-pie / check_gcc_version.sh
1 #!/bin/bash
2
3 set -euo pipefail
4
5 if command -v gcc > /dev/null
6 then
7   GCC_VERSION=$(echo __GNUC__ | gcc -E -x c - | grep -v -e '^#' )
8   echo "gcc version $GCC_VERSION detected"
9   if (( $GCC_VERSION >= 8 ))
10   then
11     echo "gcc supports -static-pie"
12     exit 0
13   else
14     echo "gcc too old to support -static-pie, skipping test"
15     exit 1
16   fi
17 else
18   echo "No gcc version detected"
19   exit 2
20 fi