Skip to content

Commit 582004e

Browse files
committed
Limit fcf-protection to gcc
1 parent 582886a commit 582004e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

configure.ac

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,15 @@ AC_ARG_WITH([hardening],[AS_HELP_STRING([--without-hardening],
7777
])
7878
if test $harden = 1; then
7979
AS_CASE([$CFLAGS], [*-O[[1-6]]*], [CPPFLAGS="-D_FORTIFY_SOURCE=2 ${CPPFLAGS}"])
80-
AX_APPEND_COMPILE_FLAGS([-fPIE -fstack-protector-strong -fstack-clash-protection -fcf-protection=full -mshstk -fexceptions -ftrapv],[CFLAGS],[$CLANG_WERROR])
80+
AX_APPEND_COMPILE_FLAGS([-fPIE -fstack-protector-strong -fstack-clash-protection -fexceptions -ftrapv],[CFLAGS],[$CLANG_WERROR])
81+
if test $CLANG != yes; then
82+
# We'll only turn this on by default for real GCC-8 for now, because at
83+
# least clang-7 seems to cause all binutils (ranlib, ar, ld) to emit
84+
# strange errors on Linux with fcf-protection (yet linking succeeds
85+
# anyways, which is odd in itself). The errors look like:
86+
# /usr/bin/ld: error: src/src_gdnsd-main.o: <corrupt x86 feature size: 0x8>
87+
AX_APPEND_COMPILE_FLAGS([-mshstk -fcf-protection=full],[CFLAGS],[])
88+
fi
8189
AX_APPEND_LINK_FLAGS([-pie -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack],[LDFLAGS],[$CLANG_WERROR])
8290
fi
8391

0 commit comments

Comments
 (0)