From a9ff28780dd1b7997c495b2f541f2b6e27b1a86c Mon Sep 17 00:00:00 2001 From: Josh Siegel Date: Thu, 25 Apr 2024 19:17:55 +0000 Subject: [PATCH] disable_optimizer: disable optimization via environmental variable --- config/extra/with-optimization.mk | 5 +++++ config/extra/with-security.mk | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/config/extra/with-optimization.mk b/config/extra/with-optimization.mk index e657707849..afa943b281 100644 --- a/config/extra/with-optimization.mk +++ b/config/extra/with-optimization.mk @@ -1,4 +1,9 @@ +ifeq ($(FD_DISABLE_OPTIMIZATION),) CPPFLAGS+=-O3 -ffast-math -fno-associative-math -fno-reciprocal-math CPPFLAGS+=-DFD_HAS_OPTIMIZATION=1 FD_HAS_OPTIMIZATION:=1 +else +CPPFLAGS+=-O0 -ffast-math -fno-associative-math -fno-reciprocal-math +endif + RUST_PROFILE:=release-with-debug diff --git a/config/extra/with-security.mk b/config/extra/with-security.mk index a977fa6d26..7ece3c8164 100644 --- a/config/extra/with-security.mk +++ b/config/extra/with-security.mk @@ -1,2 +1,6 @@ +ifeq ($(FD_DISABLE_OPTIMIZATION),) CPPFLAGS+=-D_FORTIFY_SOURCE=2 -fPIC -Wl,-z,now -fstack-protector-strong +else +CPPFLAGS+=-fPIC -Wl,-z,now -fstack-protector-strong +endif LDFLAGS+=-fPIC