From patchwork Sat Nov 7 14:55:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lu, Hongjiu" X-Patchwork-Id: 9598 Received: (qmail 15750 invoked by alias); 7 Nov 2015 14:55:05 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 15739 invoked by uid 89); 7 Nov 2015 14:55:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mga14.intel.com X-ExtLoop1: 1 Date: Sat, 7 Nov 2015 06:55:02 -0800 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] [BZ #19178] Add a test for prelink output Message-ID: <20151107145502.GA959@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) 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. OK for master? H.J. [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. --- sysdeps/x86/Makefile | 15 +++++++++++++++ sysdeps/x86/tst-prelink.c | 14 ++++++++++++++ sysdeps/x86/tst-prelink.exp | 1 + 3 files changed, 30 insertions(+) create mode 100644 sysdeps/x86/tst-prelink.c create mode 100644 sysdeps/x86/tst-prelink.exp diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index 0de4f42..a2f4f8a 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -7,4 +7,19 @@ sysdep-dl-routines += dl-get-cpu-features tests += tst-get-cpu-features tests-static += tst-get-cpu-features-static + +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..482285c --- /dev/null +++ b/sysdeps/x86/tst-prelink.c @@ -0,0 +1,14 @@ +/* Test the output from the environment variable, LD_TRACE_PRELINKING, + for prelink. */ + +#include + +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