From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29566 invoked by alias); 28 Mar 2012 00:12:13 -0000 Received: (qmail 29378 invoked by uid 22791); 28 Mar 2012 00:12:06 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-yw0-f41.google.com (HELO mail-yw0-f41.google.com) (209.85.213.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Mar 2012 00:11:52 +0000 Received: by yhr47 with SMTP id 47so483852yhr.0 for ; Tue, 27 Mar 2012 17:11:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :organization:content-type:x-mailer:content-transfer-encoding :mime-version:x-gm-message-state; bh=lMwoYUQxK3eRFejFdHz7TDlGWqoL7edVXHJrnR1vVAA=; b=W28dlQAuOBlPCCRPNCyO35LBtzXme9rrHkNKuq7XjAZZW7dVh2BQdxHyd1VZ3Mh2TV gJjSkFJhnXMK2dAkrVfU6Qg+647ATC9XEO4ct6WErJMgqcE1XLxPZN8gypVCkoMak5Sg Ussh5SUpvgCaGYG2TrOyx+bP/Tc04rPqEcBMinBnlxQ6h34rCtwr9C7azZHYZ8vMj3Kc UswtjaknnVAKsfvb7jM6ONDMEolun6D5YAUsdwwYV2RgP5piQCNnfe4F2ZuFxBIeMTD0 6nnQgOClmc0rU5ltH63ydqcn0/UBU5hrn3HwlDTgcR39ZLTPtCqlHreAJfKqTHQmBXtB m41g== Received: by 10.236.178.102 with SMTP id e66mr28513341yhm.30.1332893511608; Tue, 27 Mar 2012 17:11:51 -0700 (PDT) Received: from [192.168.1.50] (189.26.35.35.dynamic.adsl.gvt.net.br. [189.26.35.35]) by mx.google.com with ESMTPS id t66sm3457480yhh.6.2012.03.27.17.11.48 (version=SSLv3 cipher=OTHER); Tue, 27 Mar 2012 17:11:50 -0700 (PDT) Message-ID: <1332893506.16415.4.camel@hactar> Subject: Re: [RFA] Define Elf32_auxv_t and Elf64_auxv_t if not available. From: Thiago Jung Bauermann To: Joel Brobecker Cc: gdb-patches ml Date: Wed, 28 Mar 2012 00:12:00 -0000 In-Reply-To: <20120327152058.GF2701@adacore.com> References: <1332787763.30339.10.camel@hactar> <20120327152058.GF2701@adacore.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 X-Gm-Message-State: ALoCoQlUux+QkpyhDG74fDOyr9XS8ehynS2MzgcbZRKbbIR+zzx8zUSxV7S0lWskrEWETJpkUhdf 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 X-SW-Source: 2012-03/txt/msg00929.txt.bz2 Hello Joel, On Tue, 2012-03-27 at 08:20 -0700, Joel Brobecker wrote: > > 2012-03-26 Thiago Jung Bauermann > > > > * configure.ac: Check whether Elf32_auxv_t and Elf64_auxv_t > > are available. > > * linux-low.c [HAVE_ELF32_AUXV_T] (Elf32_auxv_t): Add typedef. > > [HAVE_ELF64_AUXV_T] (Elf64_auxv_t): Likewise. > > (you'll need to mention the fact that configure and config.in need > to be regenerated) Oops, I forgot. Fixed. > I am not very familiar with this area, so I am hoping someone else > might provide feedback as well. Thanks for your review! > > diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac > > index e6e9162..6b98dc0 100644 > > --- a/gdb/gdbserver/configure.ac > > +++ b/gdb/gdbserver/configure.ac > > @@ -163,9 +163,10 @@ fi > > > > AC_CHECK_DECLS([strerror, perror, memmem, vasprintf, vsnprintf]) > > > > -AC_CHECK_TYPES(socklen_t, [], [], > > +AC_CHECK_TYPES([socklen_t, Elf32_auxv_t, Elf64_auxv_t], [], [], > > [#include > > #include > > +#include > > ]) > > I wonder if we shouldn't be using two separate checks here. Seems > unlikely to be a problem in practice, but we're looking for for > a type is + , and then looking for another > collection of types in . We know we're most likely not going > to get any "cross-polination" finding socklen_t in , but if > this sort of thing were to happen, we would be in a situation where > the configure check finds the type, but the code (which presumably > might only include types.h and sockets.h) does not, leading to a build > error. That's a good point, I didn't think of that. Like you say it's unlikely to happen in practice but it's cleaner indeed. > (let's wait for more feedback before we make any change - someone > might disagree) It's an easy change so I did it anyway. Here's the new version. -- []'s Thiago Jung Bauermann Linaro Toolchain Working Group 2012-03-27 Thiago Jung Bauermann * configure.ac: Check whether Elf32_auxv_t and Elf64_auxv_t are available. linux-low.c [HAVE_ELF32_AUXV_T] (Elf32_auxv_t): Add typedef. [HAVE_ELF64_AUXV_T] (Elf64_auxv_t): Likewise. * config.in: Regenerate. * configure: Likewise. diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index e6e9162..5d1e094 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -168,6 +168,10 @@ AC_CHECK_TYPES(socklen_t, [], [], #include ]) +AC_CHECK_TYPES([Elf32_auxv_t, Elf64_auxv_t], [], [], +#include +) + ACX_PKGVERSION([GDB]) ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/]) AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description]) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 8becf78..1caff5a 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -82,6 +82,34 @@ #endif #endif +#ifndef HAVE_ELF32_AUXV_T +typedef struct +{ + uint32_t a_type; /* Entry type */ + union + { + uint32_t a_val; /* Integer value */ + /* We use to have pointer elements added here. We cannot do that, + though, since it does not work when using 32-bit definitions + on 64-bit platforms and vice versa. */ + } a_un; +} Elf32_auxv_t; +#endif + +#ifndef HAVE_ELF64_AUXV_T +typedef struct +{ + uint64_t a_type; /* Entry type */ + union + { + uint64_t a_val; /* Integer value */ + /* We use to have pointer elements added here. We cannot do that, + though, since it does not work when using 32-bit definitions + on 64-bit platforms and vice versa. */ + } a_un; +} Elf64_auxv_t; +#endif + /* ``all_threads'' is keyed by the LWP ID, which we use as the GDB protocol representation of the thread ID.