From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEVfl-0000sc-Rs for qemu-devel@nongnu.org; Sun, 19 Jun 2016 01:53:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bEVfh-00051A-JC for qemu-devel@nongnu.org; Sun, 19 Jun 2016 01:53:28 -0400 Received: from [2a03:4000:1::4e2f:c7ac:d] (port=45111 helo=mail.weilnetz.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEVfh-00050V-C3 for qemu-devel@nongnu.org; Sun, 19 Jun 2016 01:53:25 -0400 References: <1466287502-18730-1-git-send-email-pmaydell@chiark.greenend.org.uk> <1466287502-18730-3-git-send-email-pmaydell@chiark.greenend.org.uk> From: Stefan Weil Message-ID: <57663351.50802@weilnetz.de> Date: Sun, 19 Jun 2016 07:53:21 +0200 MIME-Version: 1.0 In-Reply-To: <1466287502-18730-3-git-send-email-pmaydell@chiark.greenend.org.uk> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: patches@linaro.org Am 19.06.2016 um 00:05 schrieb Peter Maydell: > From: Peter Maydell >=20 > The AVX2 optimization test assumes that the object format > is ELF and the system has the readelf utility. If this isn't > true then configure might fail or emit a warning (since in > a pipe "foo | bar >/dev/null 2>&1" does not redirect the > stderr of foo, only of bar). Adjust the check so that if > we don't have readelf or don't have an ELF object then we > just don't enable the AVX2 optimization. >=20 > Reported-by: Stefan Weil > Signed-off-by: Peter Maydell > --- > configure | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/configure b/configure > index 7beefcd..30bca55 100755 > --- a/configure > +++ b/configure > @@ -1792,8 +1792,10 @@ int foo(void *a) __attribute__((ifunc("bar_ifunc= "))); > int main(int argc, char *argv[]) { return foo(argv[0]);} > EOF > if compile_object "" ; then > - if readelf --syms $TMPO |grep "IFUNC.*foo" >/dev/null 2>&1; then > - avx2_opt=3D"yes" > + if has readelf; then > + if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; the= n > + avx2_opt=3D"yes" > + fi > fi > fi > =20 >=20 You could check "has readelf" earlier and avoid the compile test if there is no readelf (saves a little time). The final I/O redirection is still needed (otherwise Linux users will see the grep output). Regards Stefan