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

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