]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add a test for prelink output
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 10 Nov 2015 20:27:24 +0000 (12:27 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 10 Nov 2015 21:25:23 +0000 (13:25 -0800)
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)

ChangeLog
NEWS
sysdeps/x86/Makefile
sysdeps/x86/tst-prelink.c [new file with mode: 0644]
sysdeps/x86/tst-prelink.exp [new file with mode: 0644]

index 963fc390a75a9e707a4735d9677f047083078d12..1f3cc515b3b42ac33029688638a288c0e8d3056c 100644 (file)
--- 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 92037cee0880cd55fbfb7dd33d2f86cff1674370..30fe67c074be3d02a809f80b88541cd5a985a0ec 100644 (file)
--- 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.
index 19f5eca741af4e686748157586aea67e9357254e..032c1e73b8d1b82c991ed072f2187e973a8fa1c0 100644 (file)
@@ -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 (file)
index 0000000..ab61c4e
--- /dev/null
@@ -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 (file)
index 0000000..b35b4c9
--- /dev/null
@@ -0,0 +1 @@
+/0 stdout