From d6fcdd123cbf05735c894c81599a0926c3427d4f Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 11 Jan 2022 10:36:44 -0800 Subject: [PATCH] x86: Append -z cet-report=error to LDFLAGS Append -z cet-report=error to LDFLAGS if -fcf-protection is enabled by default in compiler to catch the missing Intel CET marker: compiling multi-threaded dynamic library 1.5.1 /usr/local/bin/ld: obj/conf_f408b4c825de923ffc88f7f21b6884b1/dynamic/huf_decompress_amd64.o: error: missing IBT and SHSTK properties collect2: error: ld returned 1 exit status ... LINK obj/conf_dbc0b41e36c44111bb0bb918e093d7c1/zstd /usr/local/bin/ld: obj/conf_dbc0b41e36c44111bb0bb918e093d7c1/huf_decompress_amd64.o: error: missing IBT and SHSTK properties collect2: error: ld returned 1 exit status --- lib/libzstd.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libzstd.mk b/lib/libzstd.mk index 6e9a64395..df298d789 100644 --- a/lib/libzstd.mk +++ b/lib/libzstd.mk @@ -114,6 +114,10 @@ CFLAGS += -Qunused-arguments -Wa,--noexecstack endif endif +ifeq ($(shell echo "int main(int argc, char* argv[]) { (void)argc; (void)argv; return 0; }" | $(CC) $(FLAGS) -z cet-report=error -x c -Werror - -o $(VOID) 2>$(VOID) && echo 1 || echo 0),1) +LDFLAGS += -z cet-report=error +endif + HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) GREP_OPTIONS ?= ifeq ($HAVE_COLORNEVER, 1) -- 2.47.2