[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r13802 - in /fsf/trunk/libc: ./ elf/ iconv/ libio/ login/ nscd/



Author: eglibc
Date: Sat May 14 00:03:22 2011
New Revision: 13802

Log:
Import glibc-mainline for 2011-05-14

Added:
    fsf/trunk/libc/libio/bug-fclose1.c   (with props)
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/Makeconfig
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/Rules
    fsf/trunk/libc/elf/Makefile
    fsf/trunk/libc/iconv/loop.c
    fsf/trunk/libc/libio/Makefile
    fsf/trunk/libc/libio/fileops.c
    fsf/trunk/libc/libio/tst_putwc.c
    fsf/trunk/libc/login/Makefile
    fsf/trunk/libc/nscd/Makefile

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat May 14 00:03:22 2011
@@ -1,3 +1,34 @@
+2011-05-14  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before
+	storing incomplete byte sequence in state object.  Avoid testing for
+	guaranteed too small input if we know there is enough data available.
+
+2011-05-11  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* Makeconfig (+link-pie): Indent.
+	* Rules (binaries-pie): Define if $(have-fpie) and
+	$(build-shared).
+	(binaries-shared): Also filter out $(binaries-pie).
+	($(addprefix $(objpfx),$(binaries-pie))): New rule.
+	* nscd/Makefile (others-pie): Add nscd.
+	(LDFLAGS-nscd): Set this instead of relro-LDFLAGS.
+	($(objpfx)nscd): Remove command override.
+	* login/Makefile (others-pie): Add pt_chown.
+	($(objpfx)pt_chown): Remove command override.
+	* elf/Makefile: Add PIE tests to tests and tests-pie variables and
+	remove command overrides.
+
+2011-05-13  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* libio/tst_putwc.c: Fix error messages.
+
+	[BZ #12724]
+	* libio/fileops.c (_IO_new_file_close_it): Always flush when
+	currently writing and seek to current position when not.
+	* libio/Makefile (tests): Add bug-fclose1.
+	* libio/bug-fclose1.c: New file.
+
 2011-05-12  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	[BZ #12511]

Modified: fsf/trunk/libc/Makeconfig
==============================================================================
--- fsf/trunk/libc/Makeconfig (original)
+++ fsf/trunk/libc/Makeconfig Sat May 14 00:03:22 2011
@@ -450,9 +450,9 @@
 	     $(addprefix $(csu-objpfx),S$(start-installed-name)) \
 	     $(+preinit) $(+prectorS) \
 	     $(filter-out $(addprefix $(csu-objpfx),start.o \
-	     S$(start-installed-name))\
-	     $(+preinit) $(link-extra-libs) \
-	     $(common-objpfx)libc% $(+postinit),$^) \
+						    S$(start-installed-name))\
+			  $(+preinit) $(link-extra-libs) \
+			  $(common-objpfx)libc% $(+postinit),$^) \
 	     $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
 endif
 # Command for statically linking programs with the C library.

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sat May 14 00:03:22 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-5-11
+GNU C Library NEWS -- history of user-visible changes.  2011-5-13
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -13,7 +13,8 @@
   12052, 12158, 12178, 12200, 12346, 12393, 12420, 12445, 12449, 12454,
   12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541, 12545,
   12551, 12583, 12587, 12597, 12611, 12625, 12631, 12650, 12653, 12655,
-  12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12734, 12738
+  12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12724, 12734,
+  12738
 
 * The RPC implementation in libc is obsoleted.  Old programs keep working
   but new programs cannot be linked with the routines in libc anymore.

Modified: fsf/trunk/libc/Rules
==============================================================================
--- fsf/trunk/libc/Rules (original)
+++ fsf/trunk/libc/Rules Sat May 14 00:03:22 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2000,2002,2003,2004,2005,2006
+# Copyright (C) 1991-2000,2002,2003,2004,2005,2006,2011
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -106,18 +106,32 @@
 ifeq ($(build-programs),yes)
 binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs)
 binaries-static = $(others-static) $(tests-static) $(xtests-static)
+ifeq (yesyes,$(have-fpie)$(build-shared))
+binaries-pie = $(others-pie) $(tests-pie) $(xtests-pie)
+else
+binaries-pie =
+endif
 else
 binaries-all = $(tests) $(xtests) $(test-srcs)
 binaries-static =
+binaries-pie =
 endif
 
-binaries-shared = $(filter-out $(binaries-static), $(binaries-all))
+binaries-shared = $(filter-out $(binaries-pie) $(binaries-static), \
+			       $(binaries-all))
 
 ifneq "$(strip $(binaries-shared))" ""
 $(addprefix $(objpfx),$(binaries-shared)): %: %.o \
   $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
 	$(+link)
+endif
+
+ifneq "$(strip $(binaries-pie))" ""
+$(addprefix $(objpfx),$(binaries-pie)): %: %.o \
+  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
+  $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
+	$(+link-pie)
 endif
 
 ifneq "$(strip $(binaries-static))" ""

Modified: fsf/trunk/libc/elf/Makefile
==============================================================================
--- fsf/trunk/libc/elf/Makefile (original)
+++ fsf/trunk/libc/elf/Makefile Sat May 14 00:03:22 2011
@@ -213,9 +213,6 @@
 tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7
 endif
 endif
-ifeq (yesyes,$(have-fpie)$(build-shared))
-tests: $(objpfx)tst-pie1.out
-endif
 tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
@@ -268,8 +265,8 @@
 endif
 ifeq (yesyes,$(have-fpie)$(build-shared))
 modules-names += tst-piemod1
-extra-test-objs += tst-pie1.o
-test-extras += tst-pie1
+tests += tst-pie1
+tests-pie += tst-pie1
 endif
 ifeq (x86_64,$(config-machine))
 modules-names += tst-auditmod3a tst-auditmod3b \
@@ -306,9 +303,8 @@
 ifeq (yes,$(have-fpie))
 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
 		  ifuncmain5pie ifuncmain6pie ifuncmain7pie
-tests: $(patsubst %,$(objpfx)%.out, $(ifunc-pie-tests))
-extra-test-objs += $(ifunc-pie-tests:=.o)
-test-extras += $(ifunc-pie-tests)
+tests += $(ifunc-pie-tests)
+tests-pie += $(ifunc-pie-tests)
 endif
 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
 endif
@@ -911,19 +907,9 @@
 	$(objpfx)tst-array5-static > $@
 	cmp $@ tst-array5-static.exp > /dev/null
 
-ifeq (yesyes,$(have-fpie)$(build-shared))
 CFLAGS-tst-pie1.c += $(pie-ccflag)
 
-$(objpfx)tst-pie1.out: $(objpfx)tst-pie1
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)tst-pie1: $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so
-	$(+link-pie)
-
-generated += tst-pie1 tst-pie1.out tst-pie1.o
-endif
+$(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
 
 check-textrel-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
 $(objpfx)check-textrel: check-textrel.c
@@ -1086,7 +1072,6 @@
 
 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
 
-ifeq (yesyes,$(have-fpie)$(build-shared))
 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
@@ -1094,66 +1079,11 @@
 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
 
-$(objpfx)ifuncmain1pie.out: $(objpfx)ifuncmain1pie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain1pie: $(objpfx)ifuncmain1pie.o $(objpfx)ifuncmod1.so
-	$(+link-pie)
-
-generated += ifuncmain1pie ifuncmain1pie.out
-
-$(objpfx)ifuncmain1staticpie.out: $(objpfx)ifuncmain1staticpie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain1staticpie: $(objpfx)ifuncmain1staticpie.o $(objpfx)ifuncdep1pic.o
-	$(+link-pie)
-
-generated += ifuncmain1staticpie ifuncmain1staticpie.out
-
-$(objpfx)ifuncmain1vispie.out: $(objpfx)ifuncmain1vispie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain1vispie: $(objpfx)ifuncmain1vispie.o $(objpfx)ifuncmod1.so
-	$(+link-pie)
-
-generated += ifuncmain1vispie ifuncmain1vispie.out
-
-$(objpfx)ifuncmain5pie.out: $(objpfx)ifuncmain5pie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain5pie: $(objpfx)ifuncmain5pie.o $(objpfx)ifuncmod5.so
-	$(+link-pie)
-
-generated += ifuncmain5pie ifuncmain5pie.out
-
-$(objpfx)ifuncmain6pie.out: $(objpfx)ifuncmain6pie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain6pie: $(objpfx)ifuncmain6pie.o $(objpfx)ifuncmod6.so
-	$(+link-pie)
-
-generated += ifuncmain6pie ifuncmain6pie.out
-
-$(objpfx)ifuncmain7pie.out: $(objpfx)ifuncmain7pie
-	$(elf-objpfx)$(rtld-installed-name) \
-	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-	  $< > $@
-
-$(objpfx)ifuncmain7pie: $(objpfx)ifuncmain7pie.o
-	$(+link-pie)
-
-generated += ifuncmain7pie ifuncmain7pie.out
-endif
+$(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
+$(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
+$(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
+$(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
+$(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
 
 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)

Modified: fsf/trunk/libc/iconv/loop.c
==============================================================================
--- fsf/trunk/libc/iconv/loop.c (original)
+++ fsf/trunk/libc/iconv/loop.c Sat May 14 00:03:22 2011
@@ -1,5 +1,5 @@
 /* Conversion loop frame work.
-   Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1998-2003, 2005, 2008, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -395,10 +395,14 @@
 #endif
 
   /* Are there enough bytes in the input buffer?  */
-  if (__builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
+  if (MIN_NEEDED_INPUT > 1
+      && __builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
     {
       *inptrp = inend;
 #ifdef STORE_REST
+      while (inptr < inend)
+	bytebuf[inlen++] = *inptr++;
+
       inptr = bytebuf;
       inptrp = &inptr;
       inend = &bytebuf[inlen];

Modified: fsf/trunk/libc/libio/Makefile
==============================================================================
--- fsf/trunk/libc/libio/Makefile (original)
+++ fsf/trunk/libc/libio/Makefile Sat May 14 00:03:22 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2004,2006,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004,2006-2009,2011 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -58,7 +58,7 @@
 	tst-memstream1 tst-memstream2 \
 	tst-wmemstream1 tst-wmemstream2 \
 	bug-memstream1 bug-wmemstream1 \
-	tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos
+	tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos bug-fclose1
 test-srcs = test-freopen
 
 all: # Make this the default target; it will be defined in Rules.

Added: fsf/trunk/libc/libio/bug-fclose1.c
==============================================================================
--- fsf/trunk/libc/libio/bug-fclose1.c (added)
+++ fsf/trunk/libc/libio/bug-fclose1.c Sat May 14 00:03:22 2011
@@ -1,0 +1,132 @@
+// BZ #12724
+
+static void do_prepare (void);
+#define PREPARE(argc, argv) do_prepare ()
+static int do_test (void);
+#define TEST_FUNCTION do_test()
+#include "../test-skeleton.c"
+
+
+static int fd;
+
+
+static void
+do_prepare (void)
+{
+  fd = create_temp_file ("bug-fclose1.", NULL);
+  if (fd == -1)
+    {
+      printf ("cannot create temporary file: %m\n");
+      exit (1);
+    }
+}
+
+
+static int
+do_test (void)
+{
+  static const char pattern[] = "hello world";
+
+  /* Prepare a seekable file.  */
+  if (write (fd, pattern, sizeof pattern) != sizeof pattern)
+    {
+      printf ("cannot write pattern: %m\n");
+      return 1;
+    }
+  if (lseek (fd, 1, SEEK_SET) != 1)
+    {
+      printf ("cannot seek after write: %m\n");
+      return 1;
+    }
+
+  /* Create an output stream visiting the file; when it is closed, all
+     other file descriptors visiting the file must see the new file
+     position.  */
+  int fd2 = dup (fd);
+  if (fd2 < 0)
+    {
+      printf ("cannot duplicate descriptor for writing: %m\n");
+      return 1;
+    }
+  FILE *f = fdopen (fd2, "w");
+  if (f == NULL)
+    {
+      printf ("first fdopen failed: %m\n");
+      return 1;
+    }
+  if (fputc (pattern[1], f) != pattern[1])
+    {
+      printf ("fputc failed: %m\n");
+      return 1;
+    }
+  if (fclose (f) != 0)
+    {
+      printf ("first fclose failed: %m\n");
+      return 1;
+    }
+  errno = 0;
+  if (lseek (fd2, 0, SEEK_CUR) != -1)
+    {
+      printf ("lseek after fclose after write did not fail\n");
+      return 1;
+    }
+  if (errno != EBADF)
+    {
+      printf ("lseek after fclose after write did not fail with EBADF: %m\n");
+      return 1;
+    }
+  off_t o = lseek (fd, 0, SEEK_CUR);
+  if (o != 2)
+    {
+      printf ("\
+lseek on original descriptor after first fclose returned %ld, expected 2\n",
+	      (long int) o);
+      return 1;
+    }
+
+  /* Likewise for an input stream.  */
+  fd2 = dup (fd);
+  if (fd2 < 0)
+     {
+      printf ("cannot duplicate descriptor for reading: %m\n");
+      return 1;
+    }
+  f = fdopen (fd2, "r");
+   if (f == NULL)
+    {
+      printf ("second fdopen failed: %m\n");
+      return 1;
+    }
+   char c = fgetc (f);
+   if (c != pattern[2])
+     {
+       printf ("getc returned %c, expected %c\n", c, pattern[2]);
+       return 1;
+     }
+  if (fclose (f) != 0)
+    {
+      printf ("second fclose failed: %m\n");
+      return 1;
+    }
+  errno = 0;
+  if (lseek (fd2, 0, SEEK_CUR) != -1)
+    {
+      printf ("lseek after fclose after read did not fail\n");
+      return 1;
+    }
+  if (errno != EBADF)
+    {
+      printf ("lseek after fclose after read did not fail with EBADF: %m\n");
+      return 1;
+    }
+  o = lseek (fd, 0, SEEK_CUR);
+  if (o != 3)
+    {
+      printf ("\
+lseek on original descriptor after second fclose returned %ld, expected 3\n",
+	      (long int) o);
+      return 1;
+    }
+
+  return 0;
+}

Propchange: fsf/trunk/libc/libio/bug-fclose1.c
------------------------------------------------------------------------------
    svn:mime-type = text/cpp

Modified: fsf/trunk/libc/libio/fileops.c
==============================================================================
--- fsf/trunk/libc/libio/fileops.c (original)
+++ fsf/trunk/libc/libio/fileops.c Sat May 14 00:03:22 2011
@@ -160,19 +160,25 @@
 _IO_new_file_close_it (fp)
      _IO_FILE *fp;
 {
-  int write_status, close_status;
   if (!_IO_file_is_open (fp))
     return EOF;
 
-  if ((fp->_flags & _IO_NO_WRITES) == 0
-      && (fp->_flags & _IO_CURRENTLY_PUTTING) != 0)
+  int write_status;
+  if (_IO_in_put_mode (fp))
     write_status = _IO_do_flush (fp);
-  else
-    write_status = 0;
+  else if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
+	   && !_IO_in_backup (fp))
+    {
+      off64_t o = _IO_SEEKOFF (fp, 0, _IO_seek_cur, 0);
+      if (o == WEOF)
+	write_status = EOF;
+      else
+	write_status = _IO_SYSSEEK (fp, o, SEEK_SET) < 0 ? EOF : 0;
+    }
 
   INTUSE(_IO_unsave_markers) (fp);
 
-  close_status = _IO_SYSCLOSE (fp);
+  int close_status = _IO_SYSCLOSE (fp);
 
   /* Free buffer. */
 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T

Modified: fsf/trunk/libc/libio/tst_putwc.c
==============================================================================
--- fsf/trunk/libc/libio/tst_putwc.c (original)
+++ fsf/trunk/libc/libio/tst_putwc.c Sat May 14 00:03:22 2011
@@ -1,5 +1,5 @@
 /* Simple test of putwc in the C locale.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2000.
 
@@ -74,13 +74,16 @@
   /* Now close the file, open it again, and read again.  */
   if (fclose (fp) != 0)
     {
-      printf ("failure during fclose(): %m");
+      printf ("failure during fclose: %m\n");
       res = 1;
     }
 
   fp = fopen (outname, "r");
   if (fp == NULL)
-    error (EXIT_FAILURE, errno, "cannot reopen file");
+    {
+      printf ("cannot reopen file: %m\n");
+      return 1;
+    }
 
   /* We can remove the file now.  */
   remove (outname);
@@ -104,7 +107,7 @@
 
   if (fclose (fp) != 0)
     {
-      puts ("failure during fclose()");
+      printf ("failure during fclose: %m\n");
       res = 1;
     }
 

Modified: fsf/trunk/libc/login/Makefile
==============================================================================
--- fsf/trunk/libc/login/Makefile (original)
+++ fsf/trunk/libc/login/Makefile Sat May 14 00:03:22 2011
@@ -30,6 +30,7 @@
 CFLAGS-grantpt.c = -DLIBEXECDIR='"$(libexecdir)"'
 
 others = utmpdump pt_chown
+others-pie = pt_chown
 install-others-programs = $(inst_libexecdir)/pt_chown
 
 distribute := utmp-private.h utmp-equal.h pty-private.h
@@ -67,9 +68,6 @@
 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.

Modified: fsf/trunk/libc/nscd/Makefile
==============================================================================
--- fsf/trunk/libc/nscd/Makefile (original)
+++ fsf/trunk/libc/nscd/Makefile Sat May 14 00:03:22 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1998,2000,2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 1998,2000,2002-2009,2011 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -38,9 +38,8 @@
 
 ifeq ($(have-thread-library),yes)
 
-ifneq (yesyes,$(have-fpie)$(build-shared))
 others += nscd
-endif
+others-pie += nscd
 install-sbin := nscd
 
 extra-objs := $(nscd-modules:=.o)
@@ -124,10 +123,7 @@
 CFLAGS-res_hconf.c += $(nscd-cflags)
 
 ifeq (yesyes,$(have-fpie)$(build-shared))
-relro-LDFLAGS += -Wl,-z,now
-
-$(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
-	$(+link-pie)
+LDFLAGS-nscd = -Wl,-z,now
 endif
 
 # This makes sure -DNOT_IN_libc is passed for all these modules.