* [GDB] Use AC_CHECK_SIZEOF to test for PRFPREGSET_T_BROKEN
@ 2016-09-26 14:17 Matthew Wahab
2016-09-26 14:29 ` Andreas Schwab
2016-09-27 23:42 ` Yao Qi
0 siblings, 2 replies; 4+ messages in thread
From: Matthew Wahab @ 2016-09-26 14:17 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 899 bytes --]
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 <matthew.wahab@arm.com>
* configure.ac (PRFPREGSET_T_BROKEN): Replace AC_TRY_RUN test with
AC_CHECK_SIZEOF.
* configure: Regenerate.
[-- Attachment #2: 0001-GDB-Use-AC_CHECK_SIZEOF-to-test-for-PRFPREGSET_T_BRO.patch --]
[-- Type: text/x-patch, Size: 1875 bytes --]
From 568b341cbf730e0323e4add85003a8ab57fab09d Mon Sep 17 00:00:00 2001
From: Matthew Wahab <matthew.wahab@arm.com>
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 <matthew.wahab@arm.com>
* 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 <sys/procfs.h>
- 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 <sys/procfs.h> ])
+ 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GDB] Use AC_CHECK_SIZEOF to test for PRFPREGSET_T_BROKEN
2016-09-26 14:17 [GDB] Use AC_CHECK_SIZEOF to test for PRFPREGSET_T_BROKEN Matthew Wahab
@ 2016-09-26 14:29 ` Andreas Schwab
2016-09-27 23:42 ` Yao Qi
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2016-09-26 14:29 UTC (permalink / raw)
To: Matthew Wahab; +Cc: binutils
On Sep 26 2016, Matthew Wahab <matthew.wahab@foss.arm.com> wrote:
> 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 <sys/procfs.h>
> - 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 <sys/procfs.h> ])
> + 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)
That will mangle the configure output, interspersing the results from
AC_CHECK_SIZEOF with the output of this test. You should not nest
configure checks.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GDB] Use AC_CHECK_SIZEOF to test for PRFPREGSET_T_BROKEN
2016-09-26 14:17 [GDB] Use AC_CHECK_SIZEOF to test for PRFPREGSET_T_BROKEN Matthew Wahab
2016-09-26 14:29 ` Andreas Schwab
@ 2016-09-27 23:42 ` Yao Qi
2016-09-28 7:28 ` Matthew Wahab
1 sibling, 1 reply; 4+ messages in thread
From: Yao Qi @ 2016-09-27 23:42 UTC (permalink / raw)
To: Matthew Wahab; +Cc: binutils
On Mon, Sep 26, 2016 at 3:17 PM, Matthew Wahab
<matthew.wahab@foss.arm.com> wrote:
> 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?
Hi Matthew,
Thanks for the follow-up patch. The patch should be sent gdb-patches@ mailing
list.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GDB] Use AC_CHECK_SIZEOF to test for PRFPREGSET_T_BROKEN
2016-09-27 23:42 ` Yao Qi
@ 2016-09-28 7:28 ` Matthew Wahab
0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wahab @ 2016-09-28 7:28 UTC (permalink / raw)
To: Yao Qi; +Cc: binutils
On 28/09/16 00:41, Yao Qi wrote:
> On Mon, Sep 26, 2016 at 3:17 PM, Matthew Wahab
> <matthew.wahab@foss.arm.com> wrote:
>> 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?
>
> Hi Matthew,
> Thanks for the follow-up patch. The patch should be sent gdb-patches@ mailing
> list.
>
Sorry about that. Now done.
Matthew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-28 7:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26 14:17 [GDB] Use AC_CHECK_SIZEOF to test for PRFPREGSET_T_BROKEN Matthew Wahab
2016-09-26 14:29 ` Andreas Schwab
2016-09-27 23:42 ` Yao Qi
2016-09-28 7:28 ` Matthew Wahab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).