From 8ccec8449652b08d65d0a29838e66b5ea8624b29 Mon Sep 17 00:00:00 2001 From: dmitry-j-mikhin <41896087+dmitry-j-mikhin@users.noreply.github.com> Date: Sun, 12 Dec 2021 16:25:58 +0300 Subject: [PATCH] fix nginx compilation flags (#8023) * use '-O2' instead of '-Og' '-O2' produce production optimized binary while '-Og' is used mostly for debugging * use '-mtune=generic' instead of '-mtune=native' '-mtune=native' produce optimal code for builder host system, but it can be sub-optimal for execution host system --- images/nginx/rootfs/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/nginx/rootfs/build.sh b/images/nginx/rootfs/build.sh index ab64d5d94..1aa655523 100755 --- a/images/nginx/rootfs/build.sh +++ b/images/nginx/rootfs/build.sh @@ -637,7 +637,7 @@ WITH_FLAGS="--with-debug \ # "Combining -flto with -g is currently experimental and expected to produce unexpected results." # https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html -CC_OPT="-g -Og -fPIE -fstack-protector-strong \ +CC_OPT="-g -O2 -fPIE -fstack-protector-strong \ -Wformat \ -Werror=format-security \ -Wno-deprecated-declarations \ @@ -656,7 +656,7 @@ if [[ ${ARCH} != "aarch64" ]]; then fi if [[ ${ARCH} == "x86_64" ]]; then - CC_OPT+=' -m64 -mtune=native' + CC_OPT+=' -m64 -mtune=generic' fi WITH_MODULES=" \