summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-06-16 20:46:42 -0700
committerAndreas Schwab <schwab@redhat.com>2009-08-04 10:58:04 +0200
commitc87c885303b406c5f636841b8289425062f3c7c6 (patch)
tree6b9fa4710b5e682a614e17ed9d4e354dd1417fb5
parenta7800930627c2ee5d4d3b373f62c897e0c321c19 (diff)
Build pt_chown as PIE.
(cherry picked from commit f051ddfe22d3db4e77d6a545d5363be8b986cb96)
-rw-r--r--ChangeLog4
-rw-r--r--login/Makefile13
2 files changed, 17 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a714c3eb17..ec8c64aedf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-06-16 Ulrich Drepper <drepper@redhat.com>
+ * login/Makefile: Build pt_chown as PIE.
+
+2009-06-16 Ulrich Drepper <drepper@redhat.com>
+
* login/Makefile: If necessary link pt_chown with -lcap.
2009-06-02 H.J. Lu <hongjiu.lu@intel.com>
diff --git a/login/Makefile b/login/Makefile
index 427c050a89..beb2a5c3a8 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -54,10 +54,23 @@ otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
$(resolvobjdir)/libresolv.a $(common-objpfx)libc.a
endif
+ifeq (yesyes,$(have-fpie)$(build-shared))
+pt_chown-cflags += $(pie-ccflag)
+endif
+ifeq (yes,$(have-ssp))
+pt_chown-cflags += -fstack-protector
+endif
ifeq (yes,$(have-libcap))
libcap = -lcap
endif
+CFLAGS-pt_chown.c = $(pt_chown-cflags)
LDLIBS-pt_chown = $(libcap)
+ifeq (yesyes,$(have-fpie)$(build-shared))
+LDFLAGS-pt_chown = -Wl,-z,now
+
+$(objpfx)pt_chown: $(objpfx)pt_chown.o
+ $(+link-pie)
+endif
# pt_chown needs to be setuid root.
$(inst_libexecdir)/pt_chown: $(objpfx)pt_chown $(+force)