File bug-1191734_0005-treewide-try-to-resolve-symbols-at-linking-time.patch of Package libdlm

From 7bb5570aa5b215ebbcd2f8cce88d112d17c0e998 Mon Sep 17 00:00:00 2001
From: Alexander Aring <aahringo@redhat.com>
Date: Tue, 7 Sep 2021 11:44:41 -0400
Subject: [PATCH 05/14] treewide: try to resolve symbols at linking time

This patch passes linker flags to the linker that all symbols should be
resolved at linking time. If this is not possible the linker will fail
to link.
---
 dlm_controld/Makefile | 4 ++--
 dlm_tool/Makefile     | 2 +-
 fence/Makefile        | 2 +-
 libdlm/Makefile       | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlm_controld/Makefile b/dlm_controld/Makefile
index fbc8926c8676..667998076acc 100644
--- a/dlm_controld/Makefile
+++ b/dlm_controld/Makefile
@@ -49,9 +49,9 @@ BIN_CFLAGS += $(CFLAGS) -fPIE -DPIE
 BIN_CFLAGS += -I../include -I../libdlm
 LIB_CFLAGS += $(CFLAGS) -fPIC
 
-BIN_LDFLAGS += $(LDFLAGS) -Wl,-z,relro -pie
+BIN_LDFLAGS += $(LDFLAGS) -Wl,-z,relro -Wl,-z,defs -pie
 BIN_LDFLAGS += -lpthread -lrt -lcpg -lcmap -lcfg -lquorum -luuid
-LIB_LDFLAGS += $(LDFLAGS) -Wl,-z,relro -pie
+LIB_LDFLAGS += $(LDFLAGS) -Wl,-z,relro -Wl,-z,defs -pie
 
 PKG_CONFIG ?= pkg-config
 ifeq ($(USE_SD_NOTIFY),yes)
diff --git a/dlm_tool/Makefile b/dlm_tool/Makefile
index 80d7725791f3..7b42638c0e4a 100644
--- a/dlm_tool/Makefile
+++ b/dlm_tool/Makefile
@@ -20,7 +20,7 @@ CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
 CFLAGS += -fPIE -DPIE
 CFLAGS += -I../include -I../libdlm -I../dlm_controld
 
-LDFLAGS += -Wl,-z,relro -pie
+LDFLAGS += -Wl,-z,relro -Wl,-z,defs -pie
 LDFLAGS += -L../libdlm -L../dlm_controld
 LDFLAGS += -lpthread -ldlm -ldlmcontrol
 
diff --git a/fence/Makefile b/fence/Makefile
index 1f6dd6b2c40e..2b080468eaa0 100644
--- a/fence/Makefile
+++ b/fence/Makefile
@@ -22,7 +22,7 @@ CFLAGS += `xml2-config --cflags`
 CFLAGS += -I../include
 CFLAGS += $(shell pkg-config --cflags pacemaker-fencing)
 
-LDFLAGS += -Wl,-z,relro -pie
+LDFLAGS += -Wl,-z,relro -Wl,-z,defs -pie
 LDFLAGS += `xml2-config --libs`
 LDFLAGS += -ldl
 
diff --git a/libdlm/Makefile b/libdlm/Makefile
index ab32761912b3..313c2a08f17e 100644
--- a/libdlm/Makefile
+++ b/libdlm/Makefile
@@ -84,8 +84,8 @@ CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
 LIB_CFLAGS += $(CFLAGS) -D_REENTRANT
 LLT_CFLAGS += $(CFLAGS)
 
-LIB_LDFLAGS += $(LDFLAGS) -lpthread
-LLT_LDFLAGS += $(LDFLAGS)
+LIB_LDFLAGS += $(LDFLAGS) -lpthread -Wl,-z,defs
+LLT_LDFLAGS += $(LDFLAGS) -Wl,-z,defs
 
 all: $(LIB_TARGET) $(LLT_TARGET) $(LIB_PC) $(LLT_PC)
 
-- 
2.33.0

openSUSE Build Service is sponsored by