This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR5692


Alan Modra wrote:

> 	* elflink.c: Replace all accesses to hash->creator field with
> 	output_bfd->xvec.
> 	* cofflink.c: Likewise.
> 	* coff-h8300.c: Likewise.
> 	* ecoff.c: Likewise.
> 	* elf32-m68hc1x.c: Likewise.
> 	* elf32-ppc.c: Likewise.
> 	* elf64-alpha.c: Likewise.
> 	* elf64-ppc.c: Likewise.
> 	* elf64-sparc.c: Likewise.
> 	* elfxx-mips.c: Likewise.
> 	* i386linux.c: Likewise.
> 	* m68klinux.c: Likewise.
> 	* sparclinux.c: Likewise.
> 	* sunos.c: Likewise.
> 	* xcofflink.c: Likewise.
> 	* linker.c: Likewise.

This change causes GDB to crash in generic_link_add_symbol_list
when called from bfd_simple_get_relocated_section_contents because
of a NULL output_bfd field:

#0  0x0000000000616dd8 in generic_link_add_symbol_list (abfd=0x9e8d20, info=0x7fffd952d4d0,
    symbol_count=<value optimized out>, symbols=<value optimized out>, collect=0)
    at /home/uweigand/fsf/gdb-head/bfd/linker.c:1361
#1  0x00000000005ac583 in bfd_simple_get_relocated_section_contents (abfd=0x9e8d20,
    sec=<value optimized out>, outbuf=0x9fedb0 "", symbol_table=0x0)
    at /home/uweigand/fsf/gdb-head/bfd/simple.c:239
#2  0x0000000000509c22 in dwarf2_read_section (objfile=<value optimized out>, sectp=0x9eb508)
    at /home/uweigand/fsf/gdb-head/gdb/dwarf2read.c:5250

This appears to fix the crash:

diff -c -p -r1.29 simple.c
*** simple.c    10 Jul 2007 13:49:04 -0000      1.29
--- simple.c    16 Feb 2008 16:17:50 -0000
*************** bfd_simple_get_relocated_section_content
*** 188,193 ****
--- 188,194 ----
    memset (&link_info, 0, sizeof (link_info));
    link_info.input_bfds = abfd;
    link_info.input_bfds_tail = &abfd->link_next;
+   link_info.output_bfd = abfd;

    link_info.hash = _bfd_generic_link_hash_table_create (abfd);
    link_info.callbacks = &callbacks;

However, I'm not sure this is really the right thing to do here ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]