From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19169 invoked by alias); 3 Jun 2002 05:06:01 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 19152 invoked from network); 3 Jun 2002 05:05:58 -0000 Received: from unknown (HELO branoic) (66.19.120.60) by sources.redhat.com with SMTP; 3 Jun 2002 05:05:58 -0000 Received: from drow by branoic with local (Exim 3.35 #1 (Debian)) id 17Ek25-0004wm-00; Mon, 03 Jun 2002 01:05:29 -0400 Date: Sun, 02 Jun 2002 22:06:00 -0000 From: Daniel Jacobowitz To: Camm Maguire Cc: binutils@sources.redhat.com Subject: Re: BFD relocations Message-ID: <20020603050518.GA18965@branoic.them.org> Mail-Followup-To: Camm Maguire , binutils@sources.redhat.com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-SW-Source: 2002-06/txt/msg00019.txt.bz2 On Sun, Jun 02, 2002 at 11:42:37PM -0400, Camm Maguire wrote: > Greetings! I saw your post about bfd_get_relocated_section_contents > usage in gdb, and was pleasantly surprised that you had found the same > approach I've been trying to implement over the past few days in gcl > for loading, relocating, and executing objects at runtime in Lisp. > > Problem is, it only seems to work in x86 :-(, at least as far as I can > tell. Kind of defeats the purpose of using bfd for portability :-). > I've gone through the mips case in detail, and one cannot even call > this routine unless one sets the relocateable argument to true, as it > will result in trying to call _bfd_get_gp_value with a null > argument. Likewise on ppc, the relocation apparently succeeds, but > the source is not correctly relocated. I've noticed that ld doesn't > seem to actually use this routine, but rather uses a variety of > backend specific routines ...._relocate_section. Arguments to this no > longer seem canonical, alas. > > Just wanted to tap your experience. Have you tested your gdb patch on > other archs? Any work beside x86? Is there another path through the > bfd labyrinth that would simply allow one to load a correctly relocated > section at an arbitrary address, after defining the symbols of course? I used it on PPC, which is where it was originally targetted. Worked fine. I'm going to clean up parts of the GDB support for that and move them into BFD this week if I can find a cleaner way. If you search the gdb-patches archive for (I believe) April, you can find the way I invoke this. As for the GP bits, MIPS may need an additional hack. BFD is not layed out to do what we are doing; I had to fake a great number of callbacks. Be sure to have output sections and output VMAs for every section set. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer