From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23793 invoked by alias); 8 Jan 2003 22:24:57 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 23780 invoked from network); 8 Jan 2003 22:24:54 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by 209.249.29.67 with SMTP; 8 Jan 2003 22:24:54 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h08LuwB02337 for ; Wed, 8 Jan 2003 16:56:58 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h08MOga27094; Wed, 8 Jan 2003 17:24:42 -0500 Received: from localhost.localdomain (vpn50-6.rdu.redhat.com [172.16.50.6]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h08MOfe14917; Wed, 8 Jan 2003 17:24:41 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h08MOaS25609; Wed, 8 Jan 2003 15:24:36 -0700 Date: Wed, 08 Jan 2003 22:24:00 -0000 From: Kevin Buettner Message-Id: <1030108222435.ZM25608@localhost.localdomain> In-Reply-To: "Kris Warkentin" "Re: relocation of shared libs not based at 0" (Jan 8, 4:52pm) References: <032c01c2a60a$2368a6e0$0202040a@catdog> <1021218002802.ZM4459@localhost.localdomain> <15871.50596.942339.277490@pkoning.akdesign.com> <08ab01c2b760$2e6612a0$0202040a@catdog> To: "Kris Warkentin" , "Paul Koning" , Subject: Re: relocation of shared libs not based at 0 Cc: , "Peter van der Veen" , "Colin Burgess" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-01/txt/msg00096.txt.bz2 On Jan 8, 4:52pm, Kris Warkentin wrote: > This works fine on QNX and (I assume) NetBSD so it looks rather like we just > have a difference of opinion on how the shared object loader should fill > things in. We wanted to keep our linker's behaviour for some future > enhancements (pre-relocating shared objects on flash memory, etc.) so I was > hoping the fix below (Paul's code with some extra comments) might be > acceptable. That way Paul and I could just define LM_ADDR_IS_NOT_LOAD_BASE > in our tm-.h and we'd be off to the races. > > static void > svr4_relocate_section_addresses (struct so_list *so, > struct section_table *sec) > { > #if LM_ADDR_IS_NOT_LOAD_BASE > /* On some platforms, (ie. QNX, NetBSD) LM_ADDR is the assigned > address, not the offset. > The addresses are formed as follows: > LM_ADDR is the target address where the shared library file > is mapped, so the actual section start address is LM_ADDR plus > the section offset within the shared library file. The end > address is that plus the section length. Note that we pay no > attention to the section start address as recorded in the > library header. > */ > sec->endaddr = svr4_truncate_ptr (sec->endaddr - sec->addr + > sec->the_bfd_section->filepos + > LM_ADDR (so)); > sec->addr = svr4_truncate_ptr (sec->the_bfd_section->filepos + > LM_ADDR (so)); > #else > sec->addr = svr4_truncate_ptr (sec->addr + LM_ADDR (so)); > sec->endaddr = svr4_truncate_ptr (sec->endaddr + LM_ADDR (so)); > #endif > } The problem that I have with the above is that it's not possible to build a cross debugger that'll have shared library support for both Linux and NetBSD. If we could somehow detect (perhaps via the osabi mechanism) that we have one of the lm-addr-is-not-load-base platforms and enable that code at runtime, I wouldn't mind... Kevin