From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27682 invoked by alias); 28 Sep 2016 07:28:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 27619 invoked by uid 89); 28 Sep 2016 07:28:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=BAYES_20,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=crosscompiled, UD:procfs.h, prfpregset_t, procfs.h X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Sep 2016 07:27:56 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3A34914 for ; Wed, 28 Sep 2016 00:27:55 -0700 (PDT) Received: from [10.2.206.221] (e108033-lin.cambridge.arm.com [10.2.206.221]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D950F3F218 for ; Wed, 28 Sep 2016 00:27:54 -0700 (PDT) From: Matthew Wahab Subject: [GDB] Use AC_CHECK_SIZEOF to test for PRFPREGSET_T_BROKEN To: gdb-patches@sourceware.org Message-ID: <57EB70F9.6050808@foss.arm.com> Date: Wed, 28 Sep 2016 08:39:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050701090207010004060204" X-SW-Source: 2016-09/txt/msg00390.txt.bz2 This is a multi-part message in MIME format. --------------050701090207010004060204 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 900 Hello, If the GDB configure script finds sys/procfs.h and the prfpregset_t type, it checks whether prfpregset_t is usable, setting PRFPREGSET_T_BROKEN if so. It does this using AC_TRY_RUN to test the value of sizeof(prfregset_t). This doesn't work for cross-compiled builds so for those PRFPREGSET_T_BROKEN is always set. This patch replaces the use of AC_TRY_RUN with a test that uses AC_CHECK_SIZEOF to decide whether to set PRFPREGSET_T_BROKEN. This can be run for cross-compiled builds. Tested by cross-compiling for aarch64-none-linux-gnu and recent glibc and by building with the logic inverted, to check the conditional was correctly executing. Also by building for native x86_64-none-linux-gnu. Ok for trunk? Matthew gdb/ 2016-09-26 Matthew Wahab * configure.ac (PRFPREGSET_T_BROKEN): Replace AC_TRY_RUN test with AC_CHECK_SIZEOF. * configure: Regenerate. --------------050701090207010004060204 Content-Type: text/x-patch; name="0001-GDB-Use-AC_CHECK_SIZEOF-to-test-for-PRFPREGSET_T_BRO.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-GDB-Use-AC_CHECK_SIZEOF-to-test-for-PRFPREGSET_T_BRO.pa"; filename*1="tch" Content-length: 1877 >From 568b341cbf730e0323e4add85003a8ab57fab09d Mon Sep 17 00:00:00 2001 From: Matthew Wahab Date: Tue, 23 Aug 2016 11:03:42 +0100 Subject: [PATCH] [GDB] Use AC_CHECK_SIZEOF to test for PRFPREGSET_T_BROKEN This patch replaces the use of AC_TRY_RUN with a test that uses AC_CHECK_SIZEOF to decide whether to set PRFPREGSET_T_BROKEN. This can be run for cross-compiled builds. gdb/ 2016-09-20 Matthew Wahab * configure.ac (PRFPREGSET_T_BROKEN): Replace AC_TRY_RUN test with AC_CHECK_SIZEOF. * configure: Regenerate. --- gdb/configure | 87 ++++++++++++++++++++++++++++++++++++++++++-------------- gdb/configure.ac | 19 ++++--------- 2 files changed, 72 insertions(+), 34 deletions(-) diff --git a/gdb/configure.ac b/gdb/configure.ac index e451e60..b162d87 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1573,21 +1573,14 @@ if test "$ac_cv_header_sys_procfs_h" = yes; then if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then AC_MSG_CHECKING(whether prfpregset_t type is broken) - AC_CACHE_VAL(gdb_cv_prfpregset_t_broken, - [AC_TRY_RUN([#include - int main () - { - if (sizeof (prfpregset_t) == sizeof (void *)) - return 1; - return 0; - }], - gdb_cv_prfpregset_t_broken=no, - gdb_cv_prfpregset_t_broken=yes, - gdb_cv_prfpregset_t_broken=yes)]) - AC_MSG_RESULT($gdb_cv_prfpregset_t_broken) - if test $gdb_cv_prfpregset_t_broken = yes; then + AC_CHECK_SIZEOF(prfpregset_t, [], [ #include ]) + AC_CHECK_SIZEOF(void *) + if test "${ac_cv_sizeof_prfpregset_t}" = "${ac_cv_sizeof_void_p}"; then + AC_MSG_RESULT(yes) AC_DEFINE(PRFPREGSET_T_BROKEN, 1, [Define if the prfpregset_t type is broken.]) + else + AC_MSG_RESULT(no) fi fi fi -- 2.1.4 --------------050701090207010004060204--