summaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2022-08-24 23:00:04 -0400
committerGitHub <noreply@github.com>2022-08-24 23:00:04 -0400
commit0b5747421b279283fc6d1b1065dc01fb5d1ec997 (patch)
tree3bc490e2e4f80f3c2ff907f35d48112da44a46b7 /GNUmakefile
parent307ada58d618eb05c89b6e4a6bc55ac4026a7e9a (diff)
downloadcryptopp-git-0b5747421b279283fc6d1b1065dc01fb5d1ec997.tar.gz
Add -fno-devirtualize when using GCC 12 (GH #1134, GH #1141, PR #1147)
This is not a fix since it only treats the symptom of GCC removing live code. We do not know why GCC is doing it.
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile16
1 files changed, 14 insertions, 2 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 0f849fc6..deffca90 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -846,6 +846,18 @@ ifeq ($(IS_X86)$(IS_CYGWIN)$(IS_MINGW),000)
endif
endif
+# Fix for GH #1134 and GH #1141. We need to add -fno-devirtualize because GCC is removing
+# code we are using. https://github.com/weidai11/cryptopp/issues/1134 and
+# https://github.com/weidai11/cryptopp/issues/1141
+ifeq ($(findstring -fno-devirtualize,$(CXXFLAGS)),)
+ TPROG = TestPrograms/test_nodevirtualize.cpp
+ TOPT = -fno-devirtualize
+ HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
+ ifeq ($(strip $(HAVE_OPT)),0)
+ CRYPTOPP_CXXFLAGS += -fno-devirtualize
+ endif # CRYPTOPP_CXXFLAGS
+endif # -fno-devirtualize
+
# Use -pthread whenever it is available. See http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf
# http://stackoverflow.com/questions/2127797/gcc-significance-of-pthread-flag-when-compiling
ifeq ($(DETECT_FEATURES),1)
@@ -857,7 +869,7 @@ ifeq ($(DETECT_FEATURES),1)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -qthreaded
endif # CRYPTOPP_CXXFLAGS
- endif # qthreaded
+ endif # -qthreaded
else
ifeq ($(findstring -pthread,$(CXXFLAGS)),)
TPROG = TestPrograms/test_pthreads.cpp
@@ -866,7 +878,7 @@ ifeq ($(DETECT_FEATURES),1)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -pthread
endif # CRYPTOPP_CXXFLAGS
- endif # pthread
+ endif # -pthread
endif # XLC/GCC and friends
endif # DETECT_FEATURES