From patchwork Fri Sep 12 07:02:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 388496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 90A4B14013B for ; Fri, 12 Sep 2014 17:02:53 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=exHo ZYw98boZUbL0vbSq1hxsnSbSdpFzKkBZPQA12bcrUGDsFbGTJhOpxZHRNXfCZQzj Hv8bXZ3ohRh4KfN1xZdV95BCQ3Bks6Bt80KC2BWjYlNzVtdNaS6MSN4vJg0Usret FtqDgCZg/NKEzeBiclBy7gmxC5bA7rFBlUTOYmg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=AB86e2w46v 2otSgl7WiY8j5itJI=; b=SSyxmQGWnFJ2xTNvKT6ZMPgfwd+Niloo/4kbllar6T zDDnhtgjHltK9D2QMqMnklDQJRKJYfsZxixFNxYQ/lZnGGRcddW3TufR+Qhr6OVY y1RE+Cybj8IsN6mBuo8oU7LOI6dKhDelB+twCWWiS9Yo77H2k7mAEtWgkr/ZBIgw c= Received: (qmail 6643 invoked by alias); 12 Sep 2014 07:02:46 -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 6616 invoked by uid 89); 12 Sep 2014 07:02:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Date: Fri, 12 Sep 2014 12:32:00 +0530 From: Siddhesh Poyarekar To: "Carlos O'Donell" Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Enhance tst-xmmymm.sh to detect zmm register usage in ld.so Message-ID: <20140912070200.GL14885@spoyarek.pnq.redhat.com> References: <20140911173002.GJ14885@spoyarek.pnq.redhat.com> <5411FA64.9060509@redhat.com> <5412012A.5020206@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5412012A.5020206@redhat.com> User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) On Thu, Sep 11, 2014 at 04:08:10PM -0400, Carlos O'Donell wrote: > On 09/11/2014 03:39 PM, Carlos O'Donell wrote: > > Please rename to tst-zmmxmmymm.sh and commit, otherwise it still > > looks like it only checks for xmmymm, and that's misleading. > > I meant tst-xmmymmzmm.sh. > This is what I have pushed. I renamed the test to tst-ld-sse-use.sh instead so that we don't have to rename the test again if another SSE register set is added :) Siddhesh commit 5379aebddd0a35c052e7149fb4ff88b49676516e Author: Siddhesh Poyarekar Date: Fri Sep 12 12:31:05 2014 +0530 Enhance tst-xmmymm.sh to detect zmm register usage in ld.so (BZ #16194) 2d63a517e4084ec80403cd9f278690fa8b676cc4 added support to save and restore zmm register in the dynamic linker, but did not enhance test-xmmymm.sh to detect accidental usage of these registers. The patch below adds that check. The script has also been renamed to tst-ld-sse-use.sh. To see the minimal changes, run `git show -M`. [BZ #16194] * sysdeps/x86/tst-xmmymm.sh: Rename file to... * sysdeps/x86/tst-ld-sse-use.sh: ... this. Check for zmm register usage. * sysdeps/x86/Makefile: Adjust. diff --git a/ChangeLog b/ChangeLog index d528cab..7a3346a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-09-12 Siddhesh Poyarekar + + [BZ #16194] + * sysdeps/x86/tst-xmmymm.sh: Rename file to... + * sysdeps/x86/tst-ld-sse-use.sh: ... this. Check for zmm + register usage. + * sysdeps/x86/Makefile: Adjust. + 2014-09-11 Kostya Serebryany Roland McGrath diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index a96c8bd..087bbde 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -2,8 +2,8 @@ ifeq ($(subdir),elf) CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\ -mno-sse -mno-mmx) -tests-special += $(objpfx)tst-xmmymm.out -$(objpfx)tst-xmmymm.out: ../sysdeps/x86/tst-xmmymm.sh $(objpfx)ld.so +tests-special += $(objpfx)tst-ld-sse-use.out +$(objpfx)tst-ld-sse-use.out: ../sysdeps/x86/tst-ld-sse-use.sh $(objpfx)ld.so @echo "Checking ld.so for SSE register use. This will take a few seconds..." $(SHELL) $< $(objpfx) '$(NM)' '$(OBJDUMP)' '$(READELF)' > $@; \ $(evaluate-test) diff --git a/sysdeps/x86/tst-xmmymm.sh b/sysdeps/x86/tst-ld-sse-use.sh similarity index 90% rename from sysdeps/x86/tst-xmmymm.sh rename to sysdeps/x86/tst-ld-sse-use.sh index 69ddb58..c707ca9 100755 --- a/sysdeps/x86/tst-xmmymm.sh +++ b/sysdeps/x86/tst-ld-sse-use.sh @@ -1,5 +1,5 @@ #! /bin/bash -# Make sure no code in ld.so uses xmm/ymm registers on x86-64. +# Make sure no code in ld.so uses xmm/ymm/zmm registers on x86-64. # Copyright (C) 2009-2014 Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -24,7 +24,7 @@ NM="$2" OBJDUMP="$3" READELF="$4" -tmp=$(mktemp ${objpfx}tst-xmmymm.XXXXXX) +tmp=$(mktemp ${objpfx}tst-ld-sse-use.XXXXXX) trap 'rm -f "$tmp"' 1 2 3 15 # List of object files we have to test @@ -80,12 +80,12 @@ 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} }' | + awk 'BEGIN { last="" } /^[[:xdigit:]]* <[_[:alnum:]]*>:$/ { fct=substr($2, 2, length($2)-3) } /,%[xyz]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" + echo "function $fct in $f modifies xmm/ymm/zmm" >> "$tmp" result=1 done done