This is the mail archive of the libc-alpha@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]

PATCH: Also run tst-xmmymm.sh on i386 ld.so


Hi,

i386 GCC may use XMM/YMM registers for passing function parameters.  But
ld.so doesn't save and restore them.  We have tst-xmmymm.sh to check
x86-64 ld.so and we should do same for i386.  Tested on i386 and x86-64.
OK to install?

Thanks.


H.J.
--
2012-10-31  H.J. Lu  <hongjiu.lu@intel.com>

	* sysdeps/x86_64/Makefile ($(objpfx)tst-xmmymm.out): Moved to ...
	* sysdeps/x86/Makefile: Here.  New file.
	* sysdeps/x86_64/tst-xmmymm.sh: Renamed to ...
	* sysdeps/x86/tst-xmmymm.sh: This.

diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
new file mode 100644
index 0000000..7589b25
--- /dev/null
+++ b/sysdeps/x86/Makefile
@@ -0,0 +1,6 @@
+ifeq ($(subdir),elf)
+tests: $(objpfx)tst-xmmymm.out
+$(objpfx)tst-xmmymm.out: ../sysdeps/x86/tst-xmmymm.sh $(objpfx)ld.so
+	@echo "Checking ld.so for SSE register use.  This will take a few seconds..."
+	$(SHELL) $< $(objpfx) > $@
+endif
diff --git a/sysdeps/x86/tst-xmmymm.sh b/sysdeps/x86/tst-xmmymm.sh
new file mode 100755
index 0000000..64efc6e
--- /dev/null
+++ b/sysdeps/x86/tst-xmmymm.sh
@@ -0,0 +1,100 @@
+#! /bin/bash
+# Make sure no code in ld.so uses xmm/ymm registers on x86-64.
+# Copyright (C) 2009-2012 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/>.
+
+set -e
+
+objpfx="$1"
+
+tmp=$(mktemp ${objpfx}tst-xmmymm.XXXXXX)
+trap 'rm -f "$tmp"' 1 2 3 15
+
+# List of object files we have to test
+rtldobjs=$(readelf -W -wi ${objpfx}dl-allobjs.os |
+    awk '/^ </ { if ($5 == "(DW_TAG_compile_unit)") c=1; else c=0 } $2 == "DW_AT_name" { if (c == 1) print $NF }' |
+    sed 's,\(.*/\|\)\([_[:alnum:]-]*[.]\).$,\2os,')
+rtldobjs="$rtldobjs $(ar t ${objpfx}rtld-libc.a)"
+
+# OBJECT symbols can be ignored.
+readelf -sW ${objpfx}dl-allobjs.os ${objpfx}rtld-libc.a |
+egrep " OBJECT  *GLOBAL " |
+awk '{if ($7 != "ABS") print $8 }' |
+sort -u > "$tmp"
+declare -a objects
+objects=($(cat "$tmp"))
+
+objs="dl-runtime.os"
+tocheck="dl-runtime.os"
+
+while test -n "$objs"; do
+  this="$objs"
+  objs=""
+
+  for f in $this; do
+    undef=$(nm -u "$objpfx"../*/"$f" | awk '{print $2}')
+    if test -n "$undef"; then
+      for s in $undef; do
+	for obj in ${objects[*]} "_GLOBAL_OFFSET_TABLE_"; do
+	  if test "$obj" = "$s"; then
+	    continue 2
+	  fi
+	done
+        for o in $rtldobjs; do
+	  ro=$(echo "$objpfx"../*/"$o")
+	  if nm -g --defined-only "$ro" | egrep -qs " $s\$"; then
+	    if ! (echo "$tocheck $objs" | fgrep -qs "$o"); then
+	      echo "$o needed for $s"
+	      objs="$objs $o"
+	    fi
+	    break;
+	  fi
+	done
+      done
+    fi
+  done
+  tocheck="$tocheck$objs"
+done
+
+echo
+echo
+echo "object files needed: $tocheck"
+
+cp /dev/null "$tmp"
+for f in $tocheck; do
+  objdump -d "$objpfx"../*/"$f" |
+  awk 'BEGIN { last="" } /^[[:xdigit:]]* <[_[:alnum:]]*>:$/ { fct=substr($2, 2, length($2)-3) } /,%[xy]mm[[:digit:]]*$/ { if (last != fct) { print fct; last=fct} }' |
+  while read fct; do
+    if test "$fct" = "_dl_runtime_profile" -o "$fct" = "_dl_x86_64_restore_sse"; then
+      continue;
+    fi
+    echo "function $fct in $f modifies xmm/ymm" >> "$tmp"
+    result=1
+  done
+done
+
+if test -s "$tmp"; then
+  echo
+  echo
+  cat "$tmp"
+  result=1
+else
+  result=0
+fi
+
+rm "$tmp"
+exit $result
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index 0acb69a..78c98e7 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -37,11 +37,6 @@ tests-pie += $(quad-pie-test)
 
 $(objpfx)tst-quad1pie: $(objpfx)tst-quadmod1pie.o
 $(objpfx)tst-quad2pie: $(objpfx)tst-quadmod2pie.o
-
-tests: $(objpfx)tst-xmmymm.out
-$(objpfx)tst-xmmymm.out: ../sysdeps/x86_64/tst-xmmymm.sh $(objpfx)ld.so
-	@echo "Checking ld.so for SSE register use.  This will take a few seconds..."
-	$(SHELL) $< $(objpfx) > $@
 endif
 
 ifeq ($(subdir),csu)
diff --git a/sysdeps/x86_64/tst-xmmymm.sh b/sysdeps/x86_64/tst-xmmymm.sh
deleted file mode 100755
index 64efc6e..0000000
--- a/sysdeps/x86_64/tst-xmmymm.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#! /bin/bash
-# Make sure no code in ld.so uses xmm/ymm registers on x86-64.
-# Copyright (C) 2009-2012 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/>.
-
-set -e
-
-objpfx="$1"
-
-tmp=$(mktemp ${objpfx}tst-xmmymm.XXXXXX)
-trap 'rm -f "$tmp"' 1 2 3 15
-
-# List of object files we have to test
-rtldobjs=$(readelf -W -wi ${objpfx}dl-allobjs.os |
-    awk '/^ </ { if ($5 == "(DW_TAG_compile_unit)") c=1; else c=0 } $2 == "DW_AT_name" { if (c == 1) print $NF }' |
-    sed 's,\(.*/\|\)\([_[:alnum:]-]*[.]\).$,\2os,')
-rtldobjs="$rtldobjs $(ar t ${objpfx}rtld-libc.a)"
-
-# OBJECT symbols can be ignored.
-readelf -sW ${objpfx}dl-allobjs.os ${objpfx}rtld-libc.a |
-egrep " OBJECT  *GLOBAL " |
-awk '{if ($7 != "ABS") print $8 }' |
-sort -u > "$tmp"
-declare -a objects
-objects=($(cat "$tmp"))
-
-objs="dl-runtime.os"
-tocheck="dl-runtime.os"
-
-while test -n "$objs"; do
-  this="$objs"
-  objs=""
-
-  for f in $this; do
-    undef=$(nm -u "$objpfx"../*/"$f" | awk '{print $2}')
-    if test -n "$undef"; then
-      for s in $undef; do
-	for obj in ${objects[*]} "_GLOBAL_OFFSET_TABLE_"; do
-	  if test "$obj" = "$s"; then
-	    continue 2
-	  fi
-	done
-        for o in $rtldobjs; do
-	  ro=$(echo "$objpfx"../*/"$o")
-	  if nm -g --defined-only "$ro" | egrep -qs " $s\$"; then
-	    if ! (echo "$tocheck $objs" | fgrep -qs "$o"); then
-	      echo "$o needed for $s"
-	      objs="$objs $o"
-	    fi
-	    break;
-	  fi
-	done
-      done
-    fi
-  done
-  tocheck="$tocheck$objs"
-done
-
-echo
-echo
-echo "object files needed: $tocheck"
-
-cp /dev/null "$tmp"
-for f in $tocheck; do
-  objdump -d "$objpfx"../*/"$f" |
-  awk 'BEGIN { last="" } /^[[:xdigit:]]* <[_[:alnum:]]*>:$/ { fct=substr($2, 2, length($2)-3) } /,%[xy]mm[[:digit:]]*$/ { if (last != fct) { print fct; last=fct} }' |
-  while read fct; do
-    if test "$fct" = "_dl_runtime_profile" -o "$fct" = "_dl_x86_64_restore_sse"; then
-      continue;
-    fi
-    echo "function $fct in $f modifies xmm/ymm" >> "$tmp"
-    result=1
-  done
-done
-
-if test -s "$tmp"; then
-  echo
-  echo
-  cat "$tmp"
-  result=1
-else
-  result=0
-fi
-
-rm "$tmp"
-exit $result


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