From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7206 invoked by alias); 1 Jun 2012 20:31:52 -0000 Received: (qmail 7190 invoked by uid 22791); 1 Jun 2012 20:31:48 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL,BAYES_00,FAKE_REPLY_C,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jun 2012 20:31:30 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q51KVSfh000478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 1 Jun 2012 16:31:28 -0400 Received: from host2.jankratochvil.net (ovpn-116-47.ams2.redhat.com [10.36.116.47]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q51KVNAM030681 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 1 Jun 2012 16:31:26 -0400 Date: Fri, 01 Jun 2012 20:31:00 -0000 From: Jan Kratochvil To: Hans-Peter Nilsson , Siddhesh Poyarekar Cc: binutils@sourceware.org, gdb-patches@sourceware.org Subject: Re: [PATCH] bfd: Use size_t for length argument totarget_read_memory function passed into bfd_elf_bfd_from_remote_memory Message-ID: <20120601203123.GA14319@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120602012410.43f5fdf6@spoyarek> <201206011824.q51IOEA8029007@ignucius.se.axis.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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-06/txt/msg00043.txt.bz2 On Fri, 01 Jun 2012 20:24:14 +0200, Hans-Peter Nilsson wrote: > There's always bfd_size_type, though I haven't checked if it > fits your needs. bfd_size_type seems to be always >= size_t so it should work. > For reference, the m32r-elf fail: I can confirm it with ./configure --target=m32r-elf; make On Fri, 01 Jun 2012 21:54:10 +0200, Siddhesh Poyarekar wrote: > On Fri, 1 Jun 2012 20:24:14 +0200, Hans-Peter wrote: > > There's always bfd_size_type, though I haven't checked if it > > fits your needs. > > Should be OK as long as it always matches the size_t definition in the > stddef.h that gcc ships. It is larger in some cases than size_t; but GDB can adapt, it is still better than it was smaller before. > They're both typically unsigned long, but if > that is so, then bfd_size_type should have been typedef'd to size_t > anyway. Unfortunately bfd_size_type is not always type-compatible with size_t so passing pointers to prototyped functions would not work. > > Should bfd.h include sysdep.h or what is missing? sysdep.h inclusion has caused problems which were avoided by Re: recent change broke gdb build http://sourceware.org/ml/binutils/2012-05/msg00224.html but they can be hit in other cases like here, so I do not think bfd.h can include sysdep.h. > An stddef.h include in bfd.h should fix this. stddef.h may not exist on the host system, it should include sysdep.h instead. > That or I can fix my patch to use bfd_size_type provided its size is always > equal to size_t, so that the include is not needed. Which way would be > preferable? I think the bfd/ part should use bfd_size_type and the gdb/ part should continue to use size_t where possible, only in some few cases it needs to be prototype-compatible with bfd/ it would use bfd_size_type. Going to post a patch today as keeping HEAD broken is not good. Thanks, Jan