]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Run tst-prelink test for GLOB_DAT reloc
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 14 Nov 2015 20:00:16 +0000 (12:00 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 14 Nov 2015 20:00:38 +0000 (12:00 -0800)
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.

ChangeLog
config.make.in
configure
configure.ac
elf/Makefile
elf/tst-prelink.c [moved from sysdeps/x86/tst-prelink.c with 100% similarity]
elf/tst-prelink.exp [moved from sysdeps/x86/tst-prelink.exp with 100% similarity]
sysdeps/x86/Makefile

index b911aecafb60f0bf6baf89100040b5afb2f6443f..b1b25c60ec84b55e19953cb03abd0eac81450547 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2015-11-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * 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.
+
 2015-11-13  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #14551]
index 75bb9cc69e3c0680b9cc7985d84647ae812a73e5..ba9c60dcaada7062229df16b72d5fe40b8407dad 100644 (file)
@@ -50,6 +50,7 @@ enable-werror = @enable_werror@
 have-z-combreloc = @libc_cv_z_combreloc@
 have-z-execstack = @libc_cv_z_execstack@
 have-protected-data = @libc_cv_protected_data@
+have-glob-dat-reloc = @libc_cv_has_glob_dat@
 with-fp = @with_fp@
 enable-timezone-tools = @enable_timezone_tools@
 unwind-find-fde = @libc_cv_gcc_unwind_find_fde@
index 01f507576790118129dc7736bb68b691306dc8e5..90953f0fbda6f98264136ff3f42a0da3e987e6ef 100755 (executable)
--- a/configure
+++ b/configure
@@ -622,6 +622,7 @@ libc_cv_cc_nofma
 stack_protector
 fno_unit_at_a_time
 libc_cv_output_format
+libc_cv_has_glob_dat
 libc_cv_hashstyle
 libc_cv_fpie
 libc_cv_z_execstack
@@ -5693,6 +5694,39 @@ $as_echo "$libc_cv_use_default_link" >&6; }
   use_default_link=$libc_cv_use_default_link
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_DAT reloc" >&5
+$as_echo_n "checking for GLOB_DAT reloc... " >&6; }
+if ${libc_cv_has_glob_dat+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.c <<EOF
+extern int mumble;
+int foo (void) { return mumble; }
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+                       -fPIC -shared -o conftest.so conftest.c
+                       -nostdlib -nostartfiles
+                       1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
+    libc_cv_has_glob_dat=yes
+  else
+    libc_cv_has_glob_dat=no
+  fi
+else
+  libc_cv_has_glob_dat=no
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_has_glob_dat" >&5
+$as_echo "$libc_cv_has_glob_dat" >&6; }
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker output format" >&5
 $as_echo_n "checking linker output format... " >&6; }
 if ${libc_cv_output_format+:} false; then :
index 3fdf992f79a56c75990dff45f51117ab002bc21d..cd37433cae1a4c96dd77fdf5eaad1739871362f2 100644 (file)
@@ -1340,6 +1340,29 @@ $ac_try"
   use_default_link=$libc_cv_use_default_link
 fi
 
+AC_CACHE_CHECK(for GLOB_DAT reloc,
+              libc_cv_has_glob_dat, [dnl
+cat > conftest.c <<EOF
+extern int mumble;
+int foo (void) { return mumble; }
+EOF
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+                       -fPIC -shared -o conftest.so conftest.c
+                       -nostdlib -nostartfiles
+                       1>&AS_MESSAGE_LOG_FD])
+then
+dnl look for GLOB_DAT relocation.
+  if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
+    libc_cv_has_glob_dat=yes
+  else
+    libc_cv_has_glob_dat=no
+  fi
+else
+  libc_cv_has_glob_dat=no
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_has_glob_dat)
+
 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
 if libc_cv_output_format=`
 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
index 76985ccd16042c26e9d0e74813d89d979605b024..9d2dc5c1bafd48a1779fbfb36450cbbf69d0c2ce 100644 (file)
@@ -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)
similarity index 100%
rename from sysdeps/x86/tst-prelink.c
rename to elf/tst-prelink.c
index a2f4f8adf52c7e3bd5c789c7253d890412e0788d..0de4f42168c0d3b601aebfe27dfd9d30df514bd7 100644 (file)
@@ -7,19 +7,4 @@ 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