Skip to content

Instantly share code, notes, and snippets.

@yankos
Created September 20, 2016 12:13
Show Gist options
  • Select an option

  • Save yankos/2947ef903b8f3e1842f283bc1b4049c5 to your computer and use it in GitHub Desktop.

Select an option

Save yankos/2947ef903b8f3e1842f283bc1b4049c5 to your computer and use it in GitHub Desktop.
diff --git a/build/install b/build/install
index a0bc399..8493bd1 100755
--- a/build/install
+++ b/build/install
@@ -14,16 +14,18 @@
# Authors: Andres Gutierrez <andres@phalconphp.com>
# Eduar Carvajal <eduar@phalconphp.com>
+GCC_OPT="-fno-delete-null-pointer-checks -fno-builtin-memcmp -ftrack-macro-expansion=0 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
+
# Check best compilation flags for GCC
export CC="gcc"
-export CFLAGS="-march=native -mtune=native -O2 -finline-functions -fomit-frame-pointer"
+export CFLAGS="-march=native -mtune=native -O2 -finline-functions -fomit-frame-pointer $GCC_OPT"
export CPPFLAGS="-DPHALCON_RELEASE"
echo "int main() {}" > t.c
gcc $CFLAGS t.c -o t 2> t.t
if [ $? != 0 ]; then
chmod +x gcccpuopt
BFLAGS=`./gcccpuopt`
- export CFLAGS="-O2 -finline-functions -fomit-frame-pointer $BFLAGS"
+ export CFLAGS="-O2 -finline-functions -fomit-frame-pointer $GCC_OPT $BFLAGS"
gcc $CFLAGS t.c -o t 2> t.t
if [ $? != 0 ]; then
export CFLAGS="-O2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment