From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14093 invoked by alias); 16 May 2005 23:47:56 -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 14071 invoked from network); 16 May 2005 23:47:50 -0000 Received: from unknown (HELO omta04sl.mx.bigpond.com) (144.140.93.156) by sourceware.org with SMTP; 16 May 2005 23:47:50 -0000 Received: from grove.modra.org ([144.136.167.90]) by omta04sl.mx.bigpond.com with ESMTP id <20050516234749.MFVR28740.omta04sl.mx.bigpond.com@grove.modra.org> for ; Mon, 16 May 2005 23:47:49 +0000 Received: by bubble.grove.modra.org (Postfix, from userid 500) id 7AB601AA94B; Tue, 17 May 2005 09:17:49 +0930 (CST) Date: Tue, 17 May 2005 07:39:00 -0000 From: Alan Modra To: binutils@sources.redhat.com Subject: Re: RFA: Fix both_direction Message-ID: <20050516234749.GH27573@bubble.grove.modra.org> Mail-Followup-To: binutils@sources.redhat.com References: <20050511173152.GA29720@nevyn.them.org> <20050516142828.GA24614@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050516142828.GA24614@nevyn.them.org> User-Agent: Mutt/1.4i X-SW-Source: 2005-05/txt/msg00510.txt.bz2 On Mon, May 16, 2005 at 10:28:28AM -0400, Daniel Jacobowitz wrote: > On Wed, May 11, 2005 at 01:31:53PM -0400, Daniel Jacobowitz wrote: > > This patch fixes "gdb -write" support for ELF files. There are two > > problems: > > > > We try to write out the string table even if we didn't create one. If we've > > bypassed the normal output routines, we never initialize elf_shstrtab, which > > is otherwise OK. If it's not set, there's nothing we need to do (except not > > crash). > > > > With that fixed, gdb -write works - as long as you change something, thereby > > encountering the "output_has_begun = TRUE" in bfd_set_section_contents. If > > you don't, then the linker's output routines are called. This causes > > sections to get rearranged, destroys special program headers (like > > PT_GNU_STACK), and loses the static symbol table. I believe that the > > check_format hook is a better place to handle this. > > > > OK? Tested on i686-linux, using the binutils testsuite, the gdb testsuite, > > and manual testing of gdb -write (which needs some testsuite coverage of its > > own). > > > 2005-05-11 Daniel Jacobowitz > > > > * elf.c (_bfd_elf_write_object_contents): Check for non-NULL > > elf_shstrtab. > > * format.c (bfd_check_format_matches): Set output_has_begun > > for both_direction. > > * section.c (bfd_set_section_contents): Use bfd_write_p. Remove > > special case for both_direction. > > Ping? The idea looks OK to me. -- Alan Modra IBM OzLabs - Linux Technology Centre