From 89569c8bb6b386db4881af0e96514d2ec5c35478 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 14 Nov 2015 12:00:16 -0800 Subject: Run tst-prelink test for GLOB_DAT reloc Run tst-prelink test on targets with GLOB_DAT relocaton. * config.make.in (have-glob-dat-reloc): New. * configure.ac (libc_cv_has_glob_dat): New. Set to yes if target supports GLOB_DAT relocaton. AC_SUBST. * configure: Regenerated. * elf/Makefile (tests): Add tst-prelink. (tests-special): Add $(objpfx)tst-prelink-cmp.out. (tst-prelink-ENV): New. ($(objpfx)tst-prelink-conflict.out): Likewise. ($(objpfx)tst-prelink-cmp.out): Likewise. * sysdeps/x86/tst-prelink.c: Moved to ... * elf/tst-prelink.c: Here. * sysdeps/x86/tst-prelink.exp: Moved to ... * elf/tst-prelink.exp: Here. * sysdeps/x86/Makefile (tests): Don't add tst-prelink. (tst-prelink-ENV): Removed. ($(objpfx)tst-prelink-conflict.out): Likewise. ($(objpfx)tst-prelink-cmp.out): Likewise. (tests-special): Don't add $(objpfx)tst-prelink-cmp.out. --- elf/Makefile | 17 +++++++++++++++++ elf/tst-prelink.c | 30 ++++++++++++++++++++++++++++++ elf/tst-prelink.exp | 1 + 3 files changed, 48 insertions(+) create mode 100644 elf/tst-prelink.c create mode 100644 elf/tst-prelink.exp (limited to 'elf') diff --git a/elf/Makefile b/elf/Makefile index 76985cc..9d2dc5c 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -302,6 +302,13 @@ check-abi: $(objpfx)check-abi-ld.out tests-special += $(objpfx)check-abi-ld.out update-abi: update-abi-ld +ifeq ($(have-glob-dat-reloc),yes) +tests += tst-prelink +ifeq ($(run-built-tests),yes) +tests-special += $(objpfx)tst-prelink-cmp.out +endif +endif + include ../Rules ifeq (yes,$(build-shared)) @@ -1234,3 +1241,13 @@ $(objpfx)tst-audit12: $(libdl) tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map + +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: tst-prelink.exp \ + $(objpfx)tst-prelink-conflict.out + cmp $^ > $@; \ + $(evaluate-test) diff --git a/elf/tst-prelink.c b/elf/tst-prelink.c new file mode 100644 index 0000000..ab61c4e --- /dev/null +++ b/elf/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 + . */ + +#include + +static int +do_test (void) +{ + fprintf (stdout, "hello\n"); + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/elf/tst-prelink.exp b/elf/tst-prelink.exp new file mode 100644 index 0000000..b35b4c9 --- /dev/null +++ b/elf/tst-prelink.exp @@ -0,0 +1 @@ +/0 stdout -- cgit v1.1