Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmair Majid <omajid@redhat.com>2020-08-10 16:43:39 +0300
committerGitHub <noreply@github.com>2020-08-10 16:43:39 +0300
commit1ec6939facb0fc51b989f368816d0df29be285ed (patch)
tree84e563b94c6adc0c60b7ec177fb63df411843583 /eng/build.sh
parent7281349206c09e0098ae0e4184f2b46225f85b1e (diff)
Support extra compiler flags during building (#39191)
Many Linux distributions like to use an extra set of compiler flags (via `CFLAGS`, `CXXFLAGS` and `LDFLAGS`) to produce builds that are hardened against vulnerabilities and exploits. The flags sometimes also enable extra warnings to inform packagers about potential memory issues. This pach adds support for that to dotnet/runtime. The obvious method to make this work is to just export the `CFLAGS`, `CXXFLAGS`, and `LDFLAGS` directly. This, however, enables those flags during configure-time (aka `cmake` without `--build` too). That means several cmake configure tests get executed with unexpected compiler flags. These configure tests can then report incorrect results. For example, https://bugzilla.redhat.com/show_bug.cgi?id=1712158 demonstrates an issue where the check for `strerror_r` in the runtime comes to the wrong conclusion because `-Wall` is enabled and a variable is unused. A slightly longer fix is to support another set of environment variables, and use them to set `CFLAGS`, `CXXFLAGS`, `LDFLAGS`, but only for the invocation of `cmake --build`/`make`. See #35727 for the complete details. Fixes #35727
Diffstat (limited to 'eng/build.sh')
-rwxr-xr-xeng/build.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/eng/build.sh b/eng/build.sh
index da8e3770f59..afa16a69447 100755
--- a/eng/build.sh
+++ b/eng/build.sh
@@ -97,6 +97,9 @@ usage()
echo "* Build CoreCLR for Linux x64 on Debug configuration using GCC 8.4."
echo "./build.sh clr -gcc8.4"
echo ""
+ echo "* Build CoreCLR for Linux x64 using extra compiler flags (-fstack-clash-protection)."
+ echo "EXTRA_CFLAGS=-fstack-clash-protection EXTRA_CXXFLAGS=-fstack-clash-protection ./build.sh clr"
+ echo ""
echo "* Cross-compile CoreCLR runtime for Linux ARM64 on Release configuration."
echo "./build.sh clr.runtime -arch arm64 -c release -cross"
echo ""