This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFA: Fix both_direction
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 <dan@codesourcery.com>
> >
> > * 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