From nobody Sun May 12 20:06:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1626338445; cv=none; d=zohomail.com; s=zohoarc; b=K13G8DGErrGmsIL55qk+NT7WHJoTGBBheCUOjo1Ijk2oWlqTMokhxiWq3i2fS4jZK0EIg1xUwiw/FUpNyH832mB+SkUK5EqoIHoM/RLQDs5Vi4P49KX2orYz8h6kZocQ8167yR7B6kV14lEFhIZQFL+Q9UOdV2rD/ue4Pn0SazE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626338445; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=QREW6eJiKePs8iKSHOzPEB6ae+1SB9+ilnVl8fdO3PQ=; b=NqFp4HIH78HHKyTz037gX0e5Hh0mhnbEMp/qdy3ts7VFbIs3iikqjbRENiU0HN3x4nHOTz93bTsYQ2qbHAtFrf5uLFmE2Z6Oj2Plu170JcLUz50lMw6KihFMGHCu9hbWv2pzR2qX84VCjAEAFAAZtEt7tl8Xltm1ZwgWzVpFQLU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162633844523217.887554546472188; Thu, 15 Jul 2021 01:40:45 -0700 (PDT) Received: from localhost ([::1]:48212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3wvC-0005bF-Sm for importer@patchew.org; Thu, 15 Jul 2021 04:40:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3wuF-0004up-6c for qemu-devel@nongnu.org; Thu, 15 Jul 2021 04:39:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3wu9-0004Rs-4x for qemu-devel@nongnu.org; Thu, 15 Jul 2021 04:39:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-_nZ0y0cqNH6RAUv-MIX4Rw-1; Thu, 15 Jul 2021 04:39:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E73871084F5B; Thu, 15 Jul 2021 08:39:31 +0000 (UTC) Received: from thuth.com (ovpn-113-128.ams2.redhat.com [10.36.113.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8E8D5D9DD; Thu, 15 Jul 2021 08:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626338376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QREW6eJiKePs8iKSHOzPEB6ae+1SB9+ilnVl8fdO3PQ=; b=NCk4YoDQHeou01HMckMF01367FYMEY+PNabMlsfVAuqS3dgMBnyf0fRWFww2UJh477h3ZT HRIYgIHowre1oZkmGT4AdhYHc2yQijhKQGdwK+u1u1h8VGQxrF/klXOfX9KQ+1BkLbSV6f iKm8DwSd/nR1xWjS1D3wqhbS8Fp3SyY= X-MC-Unique: _nZ0y0cqNH6RAUv-MIX4Rw-1 From: Thomas Huth To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Paolo Bonzini Subject: [PATCH for-6.1] configure: Fix endianess test with LTO Date: Thu, 15 Jul 2021 10:39:28 +0200 Message-Id: <20210715083928.933806-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cohuck@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626338446978100001 Content-Type: text/plain; charset="utf-8" If a user is trying to compile QEMU with link-time optimization enabled by running the configure script like this: .../configure --extra-cflags=3D"-flto" then the endianess test is failing since the magic values do not show up in the intermediate object files there. If the host is a big endian machine (like s390x), the QEMU binary is then unusable since the corresponding variable "bigendian" is pre-initialized with "no". To fix this issue, we should rather create a full binary and look for the magic strings there instead. And we really should not continue the build if the endianess check failed, to make it clear right from the start that something went wrong here, thus let's also add some "exit 1" statements here after emitting the error message. Signed-off-by: Thomas Huth Reviewed-by: Richard Henderson --- configure | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/configure b/configure index eee1356814..b3f37a3bf1 100755 --- a/configure +++ b/configure @@ -2349,24 +2349,27 @@ feature_not_found() { # --- # big/little endian test cat > $TMPC << EOF +#include short big_endian[] =3D { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; short little_endian[] =3D { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41= , 0, }; -extern int foo(short *, short *); -int main(int argc, char *argv[]) { - return foo(big_endian, little_endian); +int main(int argc, char *argv[]) +{ + return printf("%s %s\n", (char *)big_endian, (char *)little_endian); } EOF =20 -if compile_object ; then - if strings -a $TMPO | grep -q BiGeNdIaN ; then +if compile_prog ; then + if strings -a $TMPE | grep -q BiGeNdIaN ; then bigendian=3D"yes" - elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then + elif strings -a $TMPE | grep -q LiTtLeEnDiAn ; then bigendian=3D"no" else echo big/little test failed + exit 1 fi else echo big/little test failed + exit 1 fi =20 ########################################## --=20 2.27.0