Skip to content

Commit

Permalink
Refine testing for xmm/ymm register use in x86-64 ld.so.
Browse files Browse the repository at this point in the history
The test now takes the callgraph into account.  Only code called
during runtime relocation is affected by the limitation.  We now
determine the affected object files as closely as possible from
the outside.  This allowed to remove some the specializations
for some of the string functions as they are only used in other
code paths.
  • Loading branch information
Ulrich Drepper committed Jul 27, 2009
1 parent 87cfd82 commit e83c1a8
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 12 deletions.
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
2009-07-27 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/tst-xmmymm.sh: Refine testing. The script now
determines which files are used in runtime lookups and only checks
those for SSE use.
* sysdeps/x86_64/rtld-memchr.c: Removed. Not needed with refined
testing.
* sysdeps/x86_64/rtld-rawmemchr.c: Removed.
* sysdeps/x86_64/multiarch/rtld-rawmemchr.c: Removed
* sysdeps/x86_64/Makefile: Emit warning that tst-xmmymm.sh might
take a while.

* elf/dl-open.c: Move _dl_scope_free to...
* elf/dl-scope.c: ...here. New file.
* elf/Makefile (dl-routines): Add scope.

* resolv/resolv.h (RES_USE_DNSSEC): Define.
* resolv/res_debug.c (p_option): Handle RES_USE_EDNS0 and
RES_USE_DNSSEC.
Expand Down
1 change: 1 addition & 0 deletions sysdeps/x86_64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ sysdep-rtld-routines += tlsdesc dl-tlsdesc

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) -e $< $(objpfx) > $@
endif

Expand Down
1 change: 0 additions & 1 deletion sysdeps/x86_64/multiarch/rtld-rawmemchr.c

This file was deleted.

1 change: 0 additions & 1 deletion sysdeps/x86_64/rtld-memchr.c

This file was deleted.

1 change: 0 additions & 1 deletion sysdeps/x86_64/rtld-rawmemchr.c

This file was deleted.

80 changes: 71 additions & 9 deletions sysdeps/x86_64/tst-xmmymm.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,79 @@
#! /bin/sh
#! /bin/bash
objpfx="$1"

tmp=$(mktemp ${objpfx}tst-xmmymm.XXXXXX)
trap 'rm -f "$tmp"' 1 2 3 15

objdump -d "${objpfx}ld.so" |
awk 'BEGIN { last="" } /^[[:xdigit:]]* <[_[:alnum:]]*>:$/ { fct=substr($2, 2, length($2)-3) } /,%[xy]mm[[:digit:]]*$/ { if (last != fct) { print fct; last=fct} }' |
tee "$tmp"
# 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)"

echo "Functions which incorrectly modify xmm/ymm registers:"
err=1
egrep -vs '^_dl_runtime_profile$' "$tmp" || err=0
if test $err -eq 0; then echo "None"; fi
# 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"; then
echo "function $fct in $f modifies xmm/ymm" >> "$tmp"
result=1
fi
done
done

if test -s "$tmp"; then
echo
echo
cat "$tmp"
result=1
else
result=0
fi

rm "$tmp"
exit $err
exit $result

0 comments on commit e83c1a8

Please sign in to comment.