From 542d72d39de4a82adcec21621fa24e6307f0704c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Fri, 29 Sep 2023 17:34:48 +0200 Subject: [PATCH] Do not try to disable CTE support if gcc does not have the corresponding flag. [CONFIGURATION] * BUG: Do not try to disable CTE support if gcc does not have the corresponding flag. [INTERPRETER] * BUG: Do not try to disable CTE support if gcc does not have the corresponding flag. --- acinclude.m4 | 11 +++++++++++ main/gbx/Makefile.am | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 187f161b4..baecaab75 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -382,6 +382,16 @@ AC_DEFUN([GB_INIT], AC_DEFINE(HAVE_GCC_VISIBILITY, 1, [Whether gcc supports -fvisibility=hidden]) fi + dnl ---- check for -fcf-protection=return compiler flag + + have_gcc_nocte=no + + GB_CFLAGS_GCC_OPTION([-fcf-protection=return],, + [ + GB_CFLAGS_NOCTE=" -fcf-protection=return" + have_gcc_nocte=yes + ]) + dnl ---- check for -flto compiler flag GB_CFLAGS_GCC_OPTION([-flto],, @@ -465,6 +475,7 @@ AC_DEFUN([GB_INIT], AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CXXFLAGS_OPT) AC_SUBST(GB_CFLAGS_LTO) + AC_SUBST(GB_CFLAGS_NOCTE) AC_SUBST(GB_CXXFLAGS_STD_CPP11) AC_SUBST(GB_CXXFLAGS_STD_CPP17) diff --git a/main/gbx/Makefile.am b/main/gbx/Makefile.am index 0dba407eb..3250ed707 100644 --- a/main/gbx/Makefile.am +++ b/main/gbx/Makefile.am @@ -5,7 +5,7 @@ bin_PROGRAMS = gbx3 noinst_LIBRARIES = libgbx.a gblib_LTLIBRARIES = gb.la -libgbx_a_CFLAGS = -DGAMBAS_PATH="\"$(bindir)\"" -Wno-address-of-packed-member -Wno-stringop-truncation -fcf-protection=return $(AM_CFLAGS) +libgbx_a_CFLAGS = -DGAMBAS_PATH="\"$(bindir)\"" -Wno-address-of-packed-member -Wno-stringop-truncation $(GB_CFLAGS_NOCTE) $(AM_CFLAGS) gbx3_LDADD = @C_LIB@ @GBX_THREAD_LIB@ libgbx.a @MATH_LIB@ @INTL_LIB@ @CONV_LIB@ @GETTEXT_LIB@ @DL_LIB@ @FFI_LIB@ @RT_LIB@ gbx3_LDFLAGS = @LD_FLAGS@ @GBX_THREAD_LDFLAGS@ @INTL_LDFLAGS@ @CONV_LDFLAGS@ @GETTEXT_LDFLAGS@ @FFI_LDFLAGS@ @RT_LDFLAGS@