Skip to contentSkip to conversation

treewide: try to resolve symbols at linking time

PATCH New Alexander Aring 1 participant 2 messages Sep 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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(-)
dlm_controld/Makefile +2 -2
index fbc8926c..66799807 100644
@@ -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)
dlm_tool/Makefile +1 -1
index 80d77257..7b42638c 100644
@@ -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
 
fence/Makefile +1 -1
index 1f6dd6b2..2b080468 100644
@@ -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
 
libdlm/Makefile +2 -2
index ab327619..313c2a08 100644
@@ -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)
 
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/2 dlm_controld: add version check for libquorum

This patch adds a simple version check for libquorum. Since commit 2e893b98 ("dlm_controld: use new quorum api to detect missed failures") dlm_controld uses functionality which is only available in libquorum 3.1.0 and upwards.

---
 dlm_controld/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
dlm_controld/Makefile +4 -0
index 66799807..8cfc97e6 100644
@@ -60,6 +60,10 @@ ifeq ($(USE_SD_NOTIFY),yes)
 	BIN_LDFLAGS += $(shell $(PKG_CONFIG) --libs libsystemd)
 endif
 
+ifeq (, $(shell $(PKG_CONFIG) --libs "libquorum >= 3.1.0"))
+	 $(error "Requires libquorum at least version 3.1.0")
+endif
+
 all: $(LIB_TARGET) $(BIN_TARGET) $(LIB_PC)
 
 $(BIN_TARGET): $(BIN_SOURCE)
Signature · 1 line
2.27.0