dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0060-build-sys-add-CFLAGS-and-LDFLAGS-for-daemons-and-sha.patch

05ad79
From 097c66ef2dd4779e01d13ad4a5f9733334fa9d1a Mon Sep 17 00:00:00 2001
05ad79
From: Karel Zak <kzak@redhat.com>
05ad79
Date: Tue, 27 Aug 2013 10:02:04 +0200
05ad79
Subject: [PATCH 60/84] build-sys: add CFLAGS and LDFLAGS for daemons and
05ad79
 shared libs
05ad79
05ad79
This is necessary for paranoid security guys who believe that things
05ad79
like "-Wl,-z,relro" or "-Wl,-z,bind_now" is a way how to make the
05ad79
world a safer place...
05ad79
05ad79
[rhel7: add also SOLIB_* to libfdisk]
05ad79
05ad79
Upstream: http://github.com/karelzak/util-linux/commit/03d00d495f3b505d9cae967c629fb38aca301e01
05ad79
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1092520
05ad79
Signed-off-by: Karel Zak <kzak@redhat.com>
05ad79
---
05ad79
 Documentation/howto-compilation.txt | 10 +++++-----
05ad79
 configure.ac                        | 10 ++++++++++
05ad79
 libblkid/src/Makemodule.am          |  2 ++
05ad79
 libfdisk/src/Makemodule.am          |  3 +++
05ad79
 libmount/src/Makemodule.am          |  2 ++
05ad79
 libuuid/src/Makemodule.am           |  7 ++++++-
05ad79
 misc-utils/Makemodule.am            |  3 ++-
05ad79
 7 files changed, 30 insertions(+), 7 deletions(-)
05ad79
05ad79
diff --git a/Documentation/howto-compilation.txt b/Documentation/howto-compilation.txt
05ad79
index bebe0d2..4b39246 100644
05ad79
--- a/Documentation/howto-compilation.txt
05ad79
+++ b/Documentation/howto-compilation.txt
05ad79
@@ -27,12 +27,12 @@ Compiling
05ad79
 	The SUID_* feature is currently supported for chfn, chsh,
05ad79
 	newgrp, su, write, mount, and umount.
05ad79
 
05ad79
-	Preferred compilation options for developers, when
05ad79
-	using gcc, are:
05ad79
+	Use DAEMON_CFLAGS and DAEMON_LDFLAGS when you want to define
05ad79
+	special compiler options for daemons; supported for uuidd.
05ad79
 
05ad79
-	export CFLAGS="-Wmissing-parameter-type -Wsign-compare
05ad79
-	-Wtype-limits -Wuninitialized -Wunused-parameter
05ad79
-	-Wunused-but-set-parameter -fno-common"
05ad79
+	Use SOLIB_CFLAGS and SOLIB_LDFLAGS when you want to define
05ad79
+	special compiler options for shared libraries; supported for
05ad79
+	libmount, libblkid and libuuid.
05ad79
 
05ad79
 	FIXME: add notes about klib and uClib.
05ad79
 
05ad79
diff --git a/configure.ac b/configure.ac
05ad79
index f7c27cd..f3c7214 100644
05ad79
--- a/configure.ac
05ad79
+++ b/configure.ac
05ad79
@@ -1538,6 +1538,16 @@ AC_ARG_VAR([SUID_CFLAGS],
05ad79
 AC_ARG_VAR([SUID_LDFLAGS],
05ad79
 	   [LDFLAGS used for binaries which are usually with the suid bit])
05ad79
 
05ad79
+AC_ARG_VAR([DAEMON_CFLAGS],
05ad79
+	   [CFLAGS used for binaries which are usually executed as daemons])
05ad79
+AC_ARG_VAR([DAEMON_LDFLAGS],
05ad79
+	   [LDFLAGS used for binaries which are usually executed as daemons])
05ad79
+
05ad79
+AC_ARG_VAR([SOLIB_CFLAGS],
05ad79
+	   [CFLAGS used for shared libraries])
05ad79
+AC_ARG_VAR([SOLIB_LDFLAGS],
05ad79
+	   [LDFLAGS used for shared libraries])
05ad79
+
05ad79
 LIBS=""
05ad79
 
05ad79
 
05ad79
diff --git a/libblkid/src/Makemodule.am b/libblkid/src/Makemodule.am
05ad79
index 04d8621..1563976 100644
05ad79
--- a/libblkid/src/Makemodule.am
05ad79
+++ b/libblkid/src/Makemodule.am
05ad79
@@ -113,6 +113,7 @@ libblkid_la_LIBADD = libcommon.la
05ad79
 
05ad79
 
05ad79
 libblkid_la_CFLAGS = \
05ad79
+	$(SOLIB_CFLAGS) \
05ad79
 	-I$(ul_libblkid_incdir) \
05ad79
 	-I$(top_srcdir)/libblkid/src
05ad79
 
05ad79
@@ -128,6 +129,7 @@ libblkid_la_DEPENDENCIES = \
05ad79
 	libblkid/src/blkid.h.in
05ad79
 
05ad79
 libblkid_la_LDFLAGS = \
05ad79
+	$(SOLIB_LDFLAGS) \
05ad79
 	-Wl,--version-script=$(top_srcdir)/libblkid/src/blkid.sym \
05ad79
 	-version-info $(LIBBLKID_VERSION_INFO)
05ad79
 
05ad79
diff --git a/libfdisk/src/Makemodule.am b/libfdisk/src/Makemodule.am
05ad79
index fbfb1b4..5c50001 100644
05ad79
--- a/libfdisk/src/Makemodule.am
05ad79
+++ b/libfdisk/src/Makemodule.am
05ad79
@@ -25,6 +25,8 @@ nodist_libfdisk_la_SOURCES = libfdisk/src/fdiskP.h
05ad79
 libfdisk_la_LIBADD = libcommon.la
05ad79
 
05ad79
 libfdisk_la_CFLAGS = \
05ad79
+	$(AM_CFLAGS) \
05ad79
+	$(SOLIB_CFLAGS) \
05ad79
 	-I$(ul_libfdisk_incdir) \
05ad79
 	-I$(top_srcdir)/libfdisk/src
05ad79
 
05ad79
@@ -39,6 +41,7 @@ libfdisk_la_CFLAGS += -I$(ul_libuuid_incdir)
05ad79
 endif
05ad79
 
05ad79
 libfdisk_la_DEPENDENCIES = $(libfdisk_la_LIBADD)
05ad79
+libfdisk_la_LDFLAGS = $(SOLIB_LDFLAGS)
05ad79
 
05ad79
 
05ad79
 check_PROGRAMS += \
05ad79
diff --git a/libmount/src/Makemodule.am b/libmount/src/Makemodule.am
05ad79
index 494e02a..8ef07e5 100644
05ad79
--- a/libmount/src/Makemodule.am
05ad79
+++ b/libmount/src/Makemodule.am
05ad79
@@ -33,6 +33,7 @@ nodist_libmount_la_SOURCES = libmount/src/mountP.h
05ad79
 libmount_la_LIBADD = libcommon.la libblkid.la $(SELINUX_LIBS)
05ad79
 
05ad79
 libmount_la_CFLAGS = \
05ad79
+	$(SOLIB_CFLAGS) \
05ad79
 	-I$(ul_libblkid_incdir) \
05ad79
 	-I$(ul_libmount_incdir) \
05ad79
 	-I$(top_srcdir)/libmount/src
05ad79
@@ -43,6 +44,7 @@ libmount_la_DEPENDENCIES = \
05ad79
 	libmount/src/libmount.h.in
05ad79
 
05ad79
 libmount_la_LDFLAGS = \
05ad79
+	$(SOLIB_LDFLAGS) \
05ad79
 	-Wl,--version-script=$(top_srcdir)/libmount/src/libmount.sym \
05ad79
 	-version-info $(LIBMOUNT_VERSION_INFO)
05ad79
 
05ad79
diff --git a/libuuid/src/Makemodule.am b/libuuid/src/Makemodule.am
05ad79
index 73f1ba9..a20cb4c 100644
05ad79
--- a/libuuid/src/Makemodule.am
05ad79
+++ b/libuuid/src/Makemodule.am
05ad79
@@ -29,9 +29,14 @@ libuuid_la_SOURCES = \
05ad79
 
05ad79
 libuuid_la_DEPENDENCIES = libuuid/src/uuid.sym
05ad79
 libuuid_la_LIBADD       = $(SOCKET_LIBS)
05ad79
-libuuid_la_CFLAGS       = -I$(ul_libuuid_incdir) -Ilibuuid/src
05ad79
+
05ad79
+libuuid_la_CFLAGS = \
05ad79
+	 $(SOLIB_CFLAGS) \
05ad79
+	 -I$(ul_libuuid_incdir) \
05ad79
+	 -Ilibuuid/src
05ad79
 
05ad79
 libuuid_la_LDFLAGS = \
05ad79
+	$(SOLIB_LDFLAGS) \
05ad79
 	-Wl,--version-script=$(top_srcdir)/libuuid/src/uuid.sym \
05ad79
 	-version-info $(LIBUUID_VERSION_INFO)
05ad79
 
05ad79
diff --git a/misc-utils/Makemodule.am b/misc-utils/Makemodule.am
05ad79
index a615047..70a78f2 100644
05ad79
--- a/misc-utils/Makemodule.am
05ad79
+++ b/misc-utils/Makemodule.am
05ad79
@@ -77,7 +77,8 @@ if BUILD_UUIDD
05ad79
 usrsbin_exec_PROGRAMS += uuidd
05ad79
 dist_man_MANS += misc-utils/uuidd.8
05ad79
 uuidd_LDADD = $(LDADD) libuuid.la
05ad79
-uuidd_CFLAGS = $(AM_CFLAGS) -I$(ul_libuuid_incdir)
05ad79
+uuidd_CFLAGS = $(DAEMON_CFLAGS) $(AM_CFLAGS) -I$(ul_libuuid_incdir)
05ad79
+uuidd_LDFLAGS = $(DAEMON_LDFLAGS) $(AM_LDFLAGS)
05ad79
 uuidd_SOURCES = misc-utils/uuidd.c
05ad79
 if USE_SOCKET_ACTIVATION
05ad79
 uuidd_SOURCES += misc-utils/sd-daemon.c misc-utils/sd-daemon.h
05ad79
-- 
05ad79
2.7.4
05ad79