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 <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2023-07-15 23:37:21 -07:00
parent 225e584841
commit 98c86616db
2 changed files with 70 additions and 5 deletions
@@ -0,0 +1,64 @@
From e4ae70ae71f88d48cf1ab63810c9f7b4177af3a5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
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 <raj.khem@gmail.com>
---
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
@@ -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-make-Replace-cp-a-with-mode-preserving-options.patch \
file://0001-dlm_controld-remove-unnecessary-header-include.patch \ file://0001-dlm_controld-remove-unnecessary-header-include.patch \
file://0001-Disable-annobin-plugin.patch \ file://0001-Disable-annobin-plugin.patch \
file://0001-Remove-fcf-protection-full.patch \
" "
SRC_URI[sha256sum] = "90237e18af7422ac15fc756899b3bb6932597b13342296de8e0e120e6d8729ab" SRC_URI[sha256sum] = "90237e18af7422ac15fc756899b3bb6932597b13342296de8e0e120e6d8729ab"
@@ -35,14 +36,15 @@ SYSTEMD_AUTO_ENABLE = "enable"
export EXTRA_OEMAKE = "" export EXTRA_OEMAKE = ""
CFPROTECTION ?= "-fcf-protection=full"
CFPROTECTION:riscv64 = ""
CFLAGS += "${CFPROTECTION}"
PARALLEL_MAKE = "" PARALLEL_MAKE = ""
DONTBUILD = "${@bb.utils.contains('PACKAGECONFIG', 'pacemaker', '', 'fence', d)}" 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() { do_compile() {
sed -i "s/libsystemd-daemon/libsystemd/g" ${S}/dlm_controld/Makefile sed -i "s/libsystemd-daemon/libsystemd/g" ${S}/dlm_controld/Makefile
sed -i -e "s/ ${DONTBUILD}//g" ${S}/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 install -Dm 0644 ${S}/init/dlm.service ${D}${systemd_unitdir}/system/dlm.service
fi fi
} }