From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21595 invoked by alias); 1 Jun 2012 18:24:33 -0000 Received: (qmail 21576 invoked by uid 22791); 1 Jun 2012 18:24:32 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ra.se.axis.com (HELO ra.se.axis.com) (195.60.68.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jun 2012 18:24:19 +0000 Received: from localhost (localhost [127.0.0.1]) by ra.se.axis.com (Postfix) with ESMTP id B3D491672EA; Fri, 1 Jun 2012 20:24:17 +0200 (CEST) Received: from ra.se.axis.com ([127.0.0.1]) by localhost (ra.se.axis.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AFvII1+oNGZg; Fri, 1 Jun 2012 20:24:16 +0200 (CEST) Received: from seth.se.axis.com (seth.se.axis.com [10.0.2.172]) by ra.se.axis.com (Postfix) with ESMTP id 2AC761672E7; Fri, 1 Jun 2012 20:24:16 +0200 (CEST) Received: from ignucius.se.axis.com (ignucius.se.axis.com [10.88.21.50]) by seth.se.axis.com (Postfix) with ESMTP id 282113E107; Fri, 1 Jun 2012 20:24:16 +0200 (CEST) Received: from ignucius.se.axis.com (localhost [127.0.0.1]) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) with ESMTP id q51IOFmt029011; Fri, 1 Jun 2012 20:24:16 +0200 Received: (from hp@localhost) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) id q51IOEA8029007; Fri, 1 Jun 2012 20:24:14 +0200 Date: Fri, 01 Jun 2012 18:24:00 -0000 Message-Id: <201206011824.q51IOEA8029007@ignucius.se.axis.com> From: Hans-Peter Nilsson To: siddhesh@redhat.com CC: binutils@sourceware.org, gdb-patches@sourceware.org In-reply-to: <20120528143520.29254d79@spoyarek> (message from Siddhesh Poyarekar on Mon, 28 May 2012 11:05:20 +0200) Subject: Re: [PATCH] bfd: Use size_t for length argument totarget_read_memory function passed into bfd_elf_bfd_from_remote_memory MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT 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/msg00033.txt.bz2 > From: Siddhesh Poyarekar > The target_read_memory function pointer that > bfd_elf_bfd_from_remote_memory accepts current accepts int for length. > I have attached a patch which changes this argument to size_t. This > change is needed because I'm looking to make analogous changes in gdb to > ensure consistency of storage sizes passed across functions to ensure > that larger values are not truncated. There's always bfd_size_type, though I haven't checked if it fits your needs. > 2012-05-28 Siddhesh Poyarekar > > * bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument > of target_read_memory as size_t. > * bfd-in2.h: Regenerate. > * elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN > argument of target_read_memory as size_t. > (_bfd_elf32_bfd_from_remote_memory): Likewise. > (_bfd_elf64_bfd_from_remote_memory): Likewise. > * elf.c (bfd_elf_bfd_from_remote_memory): Likewise. > * enfcode.h (NAME): Likewise. This caused failure to build for simulators for (at least) the following targets: cris-elf, frv-elf, h8300-elf, iq2000-elf, m32r-elf, mips-elf, and mn10300-elf. They fail building either of sim/common/cgen-utils.c, sim/common/sim-command.c, sim/mips/interp.c, or sim/common/nrun.c all due to lack of size_t definition; a missing include of stddef.h before its use. Should bfd.h include sysdep.h or what is missing? For reference, the m32r-elf fail: gcc -DHAVE_CONFIG_H -DWITH_DEFAULT_MODEL='"m32r/d"' -DPROFILE=1 -DWITH_PROFILE=-1 -DWITH_ALIGNMENT=STRICT_ALIGNMENT -DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN -DWITH_ENVIRONMENT=ALL_ENVIRONMENT -DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN -DWITH_SCACHE=16384 -DM32R_ELF -I. -I/tmp/hpautotest-sim/src/sim/m32r -I../common -I/tmp/hpautotest-sim/src/sim/m32r/../common -I../../include -I/tmp/hpautotest-sim/src/sim/m32r/../../include -I../../bfd -I/tmp/hpautotest-sim/src/sim/m32r/../../bfd -I../../opcodes -I/tmp/hpautotest-sim/src/sim/m32r/../../opcodes -g -O2 -c -o cgen-utils.o -MT cgen-utils.o -MMD -MP -MF .deps/cgen-utils.Tpo /tmp/hpautotest-sim/src/sim/m32r/../common/cgen-utils.c In file included from /tmp/hpautotest-sim/src/sim/m32r/../common/cgen-utils.c:21: ../../bfd/bfd.h:708: error: expected declaration specifiers or '...' before 'size_t' brgds, H-P