From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11315 invoked by alias); 19 May 2003 20:30:05 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 11112 invoked from network); 19 May 2003 20:30:03 -0000 Received: from unknown (63.201.54.26) by sources.redhat.com with QMTP; 19 May 2003 20:30:03 -0000 Received: (qmail 23157 invoked by uid 10); 19 May 2003 20:30:03 -0000 Received: (qmail 9159 invoked by uid 500); 19 May 2003 20:29:58 -0000 Mail-Followup-To: nickc@redhat.com, binutils@sources.redhat.com, gdb-patches@sources.redhat.com, roland@redhat.com To: Roland McGrath Cc: Nick Clifton , binutils@sources.redhat.com, gdb-patches@sources.redhat.com Subject: Re: bfd function to read ELF file image from memory References: <200305192023.h4JKNt512940@magilla.sf.frob.com> From: Ian Lance Taylor Date: Mon, 19 May 2003 20:30:00 -0000 In-Reply-To: <200305192023.h4JKNt512940@magilla.sf.frob.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-05/txt/msg00347.txt.bz2 Roland McGrath writes: > > > Still, I would just to have one calling interface that handles > > > 32-bit and 64-bit ELF. To implement that front-end function I need > > > a compile-time check I can use in elfcode.h that tells me whether > > > 32-bit and/or 64-bit targets are being built. What works? > > > > You can check "#if ARCH_SIZE == 64" or "#if ARCH_SIZE == 32". > > I must be misunderstanding you, or else that can't be right. I asked about > how front-end source code can know whether it needs to call just the 32-bit > function from the 32-bit compile of elfcode.h, just the 64-bit function > from the 64-bit compile of elfcode.h, or switch between the two at runtime > based on bfd_get_arch_size. I doubt there are any publically visible functions with name changes from 32-bit to 64-bit. But there are certainly functions like bfd_get_gp_size() which look at the BFD to decide where to get the backend specific information. You could do something like that, assuming you put the appropriate hook in the elf_backend_data struct, which is less intrusive than putting it in the bfd_target struct. Ian