This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch release/2.22/master updated. glibc-2.22-23-g3cdd4ce


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.22/master has been updated
       via  3cdd4ce75bc4d24aca37edc3ecec2a8890ce2551 (commit)
       via  387011e0b6f9cbefd26691f0df8ce76bb7ddfa03 (commit)
      from  5b319ce2949cf6fb97862ff81558944f76c704f1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3cdd4ce75bc4d24aca37edc3ecec2a8890ce2551

commit 3cdd4ce75bc4d24aca37edc3ecec2a8890ce2551
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Nov 10 12:27:24 2015 -0800

    Add a test for prelink output
    
    This test applies to i386 and x86_64 which set R_386_GLOB_DAT and
    R_X86_64_GLOB_DAT to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA.
    
    	[BZ #19178]
    	* sysdeps/x86/Makefile (tests): Add tst-prelink.
    	(tst-prelink-ENV): New.
    	($(objpfx)tst-prelink-conflict.out): Likewise.
    	($(objpfx)tst-prelink-cmp.out): Likewise.
    	(tests-special): Add $(objpfx)tst-prelink-cmp.out.
    	* sysdeps/x86/tst-prelink.c: New file.
    	* sysdeps/x86/tst-prelink.exp: Likewise.
    
    (cherry picked from commit fe534fe8980fa214c410e3661a4216e781073353)

diff --git a/ChangeLog b/ChangeLog
index 963fc39..1f3cc51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-11-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #19178]
+	* sysdeps/x86/Makefile (tests): Add tst-prelink.
+	(tst-prelink-ENV): New.
+	($(objpfx)tst-prelink-conflict.out): Likewise.
+	($(objpfx)tst-prelink-cmp.out): Likewise.
+	(tests-special): Add $(objpfx)tst-prelink-cmp.out.
+	* sysdeps/x86/tst-prelink.c: New file.
+	* sysdeps/x86/tst-prelink.exp: Likewise.
+
 2015-11-07  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #19178]
diff --git a/NEWS b/NEWS
index 92037ce..30fe67c 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ Version 2.22.1
 * The following bugs are resolved with this release:
 
   18589, 18743, 18778, 18781, 18787, 18796, 18870, 18887, 18921, 18928,
-  18969, 19018.
+  18969, 19018, 19178.
 
 * The LD_POINTER_GUARD environment variable can no longer be used to
   disable the pointer guard feature.  It is always enabled.
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index 19f5eca..032c1e7 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -7,4 +7,19 @@ $(objpfx)tst-ld-sse-use.out: ../sysdeps/x86/tst-ld-sse-use.sh $(objpfx)ld.so
 	@echo "Checking ld.so for SSE register use.  This will take a few seconds..."
 	$(BASH) $< $(objpfx) '$(NM)' '$(OBJDUMP)' '$(READELF)' > $@; \
 	$(evaluate-test)
+
+tests += tst-prelink
+tst-prelink-ENV = LD_TRACE_PRELINKING=1
+
+$(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
+	grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
+
+$(objpfx)tst-prelink-cmp.out: $(..)sysdeps/x86/tst-prelink.exp \
+			      $(objpfx)tst-prelink-conflict.out
+	cmp $^ > $@; \
+	$(evaluate-test)
+
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)tst-prelink-cmp.out
+endif
 endif
diff --git a/sysdeps/x86/tst-prelink.c b/sysdeps/x86/tst-prelink.c
new file mode 100644
index 0000000..ab61c4e
--- /dev/null
+++ b/sysdeps/x86/tst-prelink.c
@@ -0,0 +1,30 @@
+/* Test the output from the environment variable, LD_TRACE_PRELINKING,
+   for prelink.
+   Copyright (C) 2015 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+  fprintf (stdout, "hello\n");
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/sysdeps/x86/tst-prelink.exp b/sysdeps/x86/tst-prelink.exp
new file mode 100644
index 0000000..b35b4c9
--- /dev/null
+++ b/sysdeps/x86/tst-prelink.exp
@@ -0,0 +1 @@
+/0 stdout

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=387011e0b6f9cbefd26691f0df8ce76bb7ddfa03

commit 387011e0b6f9cbefd26691f0df8ce76bb7ddfa03
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Nov 7 06:32:30 2015 -0800

    Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink
    
    prelink runs ld.so with the environment variable LD_TRACE_PRELINKING
    set to dump the relocation type class from _dl_debug_bindings.  prelink
    has the following relocation type classes:
    
     #define RTYPE_CLASS_VALID       8
     #define RTYPE_CLASS_PLT         (8|1)
     #define RTYPE_CLASS_COPY        (8|2)
     #define RTYPE_CLASS_TLS         (8|4)
    
    where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with
    RTYPE_CLASS_TLS.
    
    Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
    bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is
    set.
    
    	[BZ #19178]
    	* elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
    	(RTYPE_CLASS_PLT): Likewise.
    	(RTYPE_CLASS_COPY): Likewise.
    	(RTYPE_CLASS_TLS): Likewise.
    	(_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
    	to set relocation type class for DL_DEBUG_PRELINK.  Keep only
    	ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for
    	DL_DEBUG_PRELINK.
    
    (cherry picked from commit f3d18efb8a720121066dc3401e822043beb98cde)

diff --git a/ChangeLog b/ChangeLog
index b32cd09..963fc39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2015-11-07  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #19178]
+	* elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
+	(RTYPE_CLASS_PLT): Likewise.
+	(RTYPE_CLASS_COPY): Likewise.
+	(RTYPE_CLASS_TLS): Likewise.
+	(_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
+	to set relocation type class for DL_DEBUG_PRELINK.  Keep only
+	ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for
+	DL_DEBUG_PRELINK.
+
 2015-10-20  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
 
 	[BZ #18743]
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 11cb44b..acf5280 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -1016,6 +1016,18 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
 #ifdef SHARED
   if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
     {
+/* ELF_RTYPE_CLASS_XXX must match RTYPE_CLASS_XXX used by prelink with
+   LD_TRACE_PRELINKING.  */
+#define RTYPE_CLASS_VALID	8
+#define RTYPE_CLASS_PLT		(8|1)
+#define RTYPE_CLASS_COPY	(8|2)
+#define RTYPE_CLASS_TLS		(8|4)
+#if ELF_RTYPE_CLASS_PLT != 0 && ELF_RTYPE_CLASS_PLT != 1
+# error ELF_RTYPE_CLASS_PLT must be 0 or 1!
+#endif
+#if ELF_RTYPE_CLASS_COPY != 0 && ELF_RTYPE_CLASS_COPY != 2
+# error ELF_RTYPE_CLASS_COPY must be 0 or 2!
+#endif
       int conflict = 0;
       struct sym_val val = { NULL, NULL };
 
@@ -1071,12 +1083,17 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
 
       if (value->s)
 	{
+	  /* Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
+	     bits since since prelink only uses them.  */
+	  type_class &= ELF_RTYPE_CLASS_PLT | ELF_RTYPE_CLASS_COPY;
 	  if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
 				== STT_TLS))
-	    type_class = 4;
+	    /* Clear the RTYPE_CLASS_VALID bit in RTYPE_CLASS_TLS.  */
+	    type_class = RTYPE_CLASS_TLS & ~RTYPE_CLASS_VALID;
 	  else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
 				     == STT_GNU_IFUNC))
-	    type_class |= 8;
+	    /* Set the RTYPE_CLASS_VALID bit.  */
+	    type_class |= RTYPE_CLASS_VALID;
 	}
 
       if (conflict

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                        |   23 ++++++++++++++++++++++
 NEWS                                             |    2 +-
 elf/dl-lookup.c                                  |   21 ++++++++++++++++++-
 sysdeps/x86/Makefile                             |   15 ++++++++++++++
 stdlib/tst-system.c => sysdeps/x86/tst-prelink.c |   12 +++++-----
 sysdeps/x86/tst-prelink.exp                      |    1 +
 6 files changed, 65 insertions(+), 9 deletions(-)
 copy stdlib/tst-system.c => sysdeps/x86/tst-prelink.c (80%)
 create mode 100644 sysdeps/x86/tst-prelink.exp


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]