diff --git a/sql/files/defaultdata/cppsafe/build b/sql/files/defaultdata/cppsafe/build new file mode 100755 index 0000000000..3ad1806766 --- /dev/null +++ b/sql/files/defaultdata/cppsafe/build @@ -0,0 +1,2 @@ +#!/bin/sh +# nothing to compile diff --git a/sql/files/defaultdata/cppsafe/run b/sql/files/defaultdata/cppsafe/run new file mode 100755 index 0000000000..cd43a7c45d --- /dev/null +++ b/sql/files/defaultdata/cppsafe/run @@ -0,0 +1,22 @@ +#!/bin/sh + +# C++ compile wrapper-script for 'compile.sh'. +# See that script for syntax and more info. + +DEST="$1" ; shift +MEMLIMIT="$1" ; shift + +# Add -DONLINE_JUDGE or -DDOMJUDGE below if you want it make easier for teams +# to do local debugging. + +# -x c++: Explicitly set compile language to C++ (no object files or +# other languages autodetected by extension) +# -Wall: Report all warnings +# -fsanitize: Enable the specified Sanitizers, see https://github.com/google/sanitizers for the full documentation +# -fPIE -pie -fno-omit-frame-pointer -fno-optimize-sibling-calls: Make code position independent and disable optimizations that may obfuscate the info provided by the +sanitizers +# -g: Include debugging/symbol information in the executable, improves sanitizers output if an error is detected +# -O2: Level 2 optimizations (default for speed) +# -pipe: Use pipes for communication between stages of compilation +g++ -x c++ -Wall -fsanitize=address,undefined -fPIE -pie -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -O2 -pipe -o "$DEST" "$@" +exit $? diff --git a/sql/files/defaultdata/csafe/build b/sql/files/defaultdata/csafe/build new file mode 100755 index 0000000000..3ad1806766 --- /dev/null +++ b/sql/files/defaultdata/csafe/build @@ -0,0 +1,2 @@ +#!/bin/sh +# nothing to compile diff --git a/sql/files/defaultdata/csafe/run b/sql/files/defaultdata/csafe/run new file mode 100755 index 0000000000..39e5fed98d --- /dev/null +++ b/sql/files/defaultdata/csafe/run @@ -0,0 +1,24 @@ +#!/bin/sh + +# C compile wrapper-script for 'compile.sh'. +# See that script for syntax and more info. + +DEST="$1" ; shift +MEMLIMIT="$1" ; shift + +# Add -DONLINE_JUDGE or -DDOMJUDGE below if you want it make easier for teams +# to do local debugging. + +# -x c: Explicitly set compile language to C (no C++ nor object files +# autodetected by extension) +# -Wall: Report all warnings +# -fsanitize: Enable the specified Sanitizers, see https://github.com/google/sanitizers for the full documentation +# -fPIE -pie -fno-omit-frame-pointer -fno-optimize-sibling-calls: make code position independent and disable optimizations that may obfuscate the info provided by the +sanitizers +# -g: Include debugging/symbol information in the executable, improves sanitizers output if an error is detected +# -O2: Level 2 optimizations (default for speed) +# -g have file names and line numbers included in warning messages +# -pipe: Use pipes for communication between stages of compilation +# -lm: Link with math-library (has to be last argument!) +gcc -x c -Wall -fsanitize=address,undefined -fPIE -pie -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -O2 -pipe -o "$DEST" "$@" -lm +exit $?