From 98c86616dbf082c977c9b9f16f5bddea23f7629c Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 15 Jul 2023 23:37:21 -0700 Subject: dlm: Do not pass -fcf-protection=full via Makefile Pass it via cflags from environment, so it can be controlled for platforms where it is not supported Pass -fstack-clash-protection for clang too, it is available now a days Signed-off-by: Khem Raj --- .../dlm/dlm/0001-Remove-fcf-protection-full.patch | 64 ++++++++++++++++++++++ meta-networking/recipes-extended/dlm/dlm_4.2.0.bb | 11 ++-- 2 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 meta-networking/recipes-extended/dlm/dlm/0001-Remove-fcf-protection-full.patch diff --git a/meta-networking/recipes-extended/dlm/dlm/0001-Remove-fcf-protection-full.patch b/meta-networking/recipes-extended/dlm/dlm/0001-Remove-fcf-protection-full.patch new file mode 100644 index 0000000000..6290aa4c7a --- /dev/null +++ b/meta-networking/recipes-extended/dlm/dlm/0001-Remove-fcf-protection-full.patch @@ -0,0 +1,64 @@ +From e4ae70ae71f88d48cf1ab63810c9f7b4177af3a5 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 15 Jul 2023 19:05:54 -0700 +Subject: [PATCH] Remove -fcf-protection=full + +This option is not available on all architectures e.g. RISC-V +Fixes +| cc1: error: '-fcf-protection=full' is not supported for this target + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + dlm_controld/Makefile | 1 - + dlm_tool/Makefile | 1 - + fence/Makefile | 1 - + libdlm/Makefile | 4 ++-- + 4 files changed, 2 insertions(+), 5 deletions(-) + +--- a/dlm_controld/Makefile ++++ b/dlm_controld/Makefile +@@ -43,7 +43,7 @@ CFLAGS += -D_GNU_SOURCE -O2 -ggdb \ + -Wno-sign-compare -Wno-unused-parameter -Wp,-D_FORTIFY_SOURCE=2 \ + -fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option \ + -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong \ +- -fstack-clash-protection -fcf-protection=full ++ -fstack-clash-protection + + BIN_CFLAGS += $(CFLAGS) -fPIE -DPIE + BIN_CFLAGS += -I../include -I../libdlm +--- a/dlm_tool/Makefile ++++ b/dlm_tool/Makefile +@@ -15,7 +15,7 @@ CFLAGS += -D_GNU_SOURCE -O2 -ggdb \ + -Wno-sign-compare -Wno-unused-parameter -Wp,-D_FORTIFY_SOURCE=2 \ + -fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option \ + -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong \ +- -fstack-clash-protection -fcf-protection=full ++ -fstack-clash-protection + + CFLAGS += -fPIE -DPIE + CFLAGS += -I../include -I../libdlm -I../dlm_controld +--- a/fence/Makefile ++++ b/fence/Makefile +@@ -15,7 +15,7 @@ CFLAGS += -D_GNU_SOURCE -O2 -ggdb \ + -Wno-sign-compare -Wno-unused-parameter -Wp,-D_FORTIFY_SOURCE=2 \ + -fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option \ + -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong \ +- -fstack-clash-protection -fcf-protection=full ++ -fstack-clash-protection + + CFLAGS += -fPIE -DPIE + CFLAGS += -I../include +--- a/libdlm/Makefile ++++ b/libdlm/Makefile +@@ -80,8 +80,8 @@ CFLAGS += -D_GNU_SOURCE -O2 -ggdb \ + -fdiagnostics-show-option \ + -fPIC + +-LIB_CFLAGS += $(CFLAGS) -D_REENTRANT -fcf-protection=full +-LLT_CFLAGS += $(CFLAGS) -fcf-protection=full ++LIB_CFLAGS += $(CFLAGS) -D_REENTRANT ++LLT_CFLAGS += $(CFLAGS) + + LIB_LDFLAGS += $(LDFLAGS) -lpthread -Wl,-z,now + LLT_LDFLAGS += $(LDFLAGS) -Wl,-z,now diff --git a/meta-networking/recipes-extended/dlm/dlm_4.2.0.bb b/meta-networking/recipes-extended/dlm/dlm_4.2.0.bb index 5073192763..bd71f70e3c 100644 --- a/meta-networking/recipes-extended/dlm/dlm_4.2.0.bb +++ b/meta-networking/recipes-extended/dlm/dlm_4.2.0.bb @@ -10,6 +10,7 @@ SRC_URI = "https://pagure.io/dlm/archive/dlm-${PV}/dlm-dlm-${PV}.tar.gz \ file://0001-make-Replace-cp-a-with-mode-preserving-options.patch \ file://0001-dlm_controld-remove-unnecessary-header-include.patch \ file://0001-Disable-annobin-plugin.patch \ + file://0001-Remove-fcf-protection-full.patch \ " SRC_URI[sha256sum] = "90237e18af7422ac15fc756899b3bb6932597b13342296de8e0e120e6d8729ab" @@ -35,14 +36,15 @@ SYSTEMD_AUTO_ENABLE = "enable" export EXTRA_OEMAKE = "" +CFPROTECTION ?= "-fcf-protection=full" +CFPROTECTION:riscv64 = "" + +CFLAGS += "${CFPROTECTION}" + PARALLEL_MAKE = "" DONTBUILD = "${@bb.utils.contains('PACKAGECONFIG', 'pacemaker', '', 'fence', d)}" -do_compile:prepend:toolchain-clang() { - sed -i -e "s/-fstack-clash-protection//g" ${S}/*/Makefile -} - do_compile() { sed -i "s/libsystemd-daemon/libsystemd/g" ${S}/dlm_controld/Makefile sed -i -e "s/ ${DONTBUILD}//g" ${S}/Makefile @@ -59,4 +61,3 @@ do_install() { install -Dm 0644 ${S}/init/dlm.service ${D}${systemd_unitdir}/system/dlm.service fi } - -- cgit v1.2.3-54-g00ecf