Subject: mdsetimage doesn't like the new bfd
To: None <tech-toolchain@netbsd.org>
From: Tom Spindler <dogcow@babymeat.com>
List: tech-toolchain
Date: 03/03/2003 20:13:34
mdsetimage doesn't seem to like the new bfd much. for whatever reason, it
looks like abfd->outsymbols contains NULL - when bfd reads in
netbsd-RESCUE_TINY, at least - and so elf_map_symbols() barfs.

FWIW, gdb whinges about these, too:
Deprecated bfd_read called at /media/src/src/gnu/dist/toolchain/gdb/dbxread.c line 2638 in elfstab_build_psymtabs
Deprecated bfd_read called at /media/src/src/gnu/dist/toolchain/gdb/dbxread.c line 976 in fill_symbuf

(gdb) run -v netbsd-RESCUE_TINY /media/src/src/distrib/i386/floppies/ramdisk-rescuetiny/obj.i386/ramdisk-rescuetiny.fs
Starting program: /usr/src/tools/mdsetimage/obj.i386/mdsetimage -v netbsd-RESCUE_TINY /media/src/src/distrib/i386/floppies/ramdisk-rescuetiny/obj.i386/ramdisk-rescuetiny.fs
got symbols from netbsd-RESCUE_TINY
mapped netbsd-RESCUE_TINY
copying image /media/src/src/distrib/i386/floppies/ramdisk-rescuetiny/obj.i386/ramdisk-rescuetiny.fs into netbsd-RESCUE_TINY
done copying image
exiting

Program received signal SIGSEGV, Segmentation fault.
0x80641df in elf_map_symbols (abfd=0x80ae000)
    at /media/src/src/tools/toolchain/../../gnu/dist/toolchain/bfd/elf.c:2879
2879          asymbol *sym = syms[idx];
(gdb) print syms
$1 = (asymbol **) 0x0
(gdb) bt
#0  0x80641df in elf_map_symbols (abfd=0x80ae000)
    at /media/src/src/tools/toolchain/../../gnu/dist/toolchain/bfd/elf.c:2879
#1  0x8066add in swap_out_syms (abfd=0x80ae000, sttp=0xbfbef2a4, 
    relocatable_p=0)
    at /media/src/src/tools/toolchain/../../gnu/dist/toolchain/bfd/elf.c:5211
#2  0x8064524 in _bfd_elf_compute_section_file_positions (abfd=0x80ae000, 
    link_info=0x0)
    at /media/src/src/tools/toolchain/../../gnu/dist/toolchain/bfd/elf.c:3063
#3  0x8065c69 in _bfd_elf_write_object_contents (abfd=0x80ae000)
    at /media/src/src/tools/toolchain/../../gnu/dist/toolchain/bfd/elf.c:4342
#4  0x804bd6e in bfd_close ()
#5  0x8049db6 in main ()
#6  0x80493a4 in ___start ()

#0  0x80641df in elf_map_symbols (abfd=0x80ae000)
    at /media/src/src/tools/toolchain/../../gnu/dist/toolchain/bfd/elf.c:2879
2879          asymbol *sym = syms[idx];
(gdb) print syms
$2 = (asymbol **) 0x0
(gdb) up
#1  0x8066add in swap_out_syms (abfd=0x80ae000, sttp=0xbfbef2a4, 
    relocatable_p=0)
    at /media/src/src/tools/toolchain/../../gnu/dist/toolchain/bfd/elf.c:5211
5211      if (!elf_map_symbols (abfd))
(gdb) up
#2  0x8064524 in _bfd_elf_compute_section_file_positions (abfd=0x80ae000,
    link_info=0x0)
    at /media/src/src/tools/toolchain/../../gnu/dist/toolchain/bfd/elf.c:3063
3063          if (! swap_out_syms (abfd, &strtab, relocatable_p))
(gdb) up
#3  0x8065c69 in _bfd_elf_write_object_contents (abfd=0x80ae000)
    at /media/src/src/tools/toolchain/../../gnu/dist/toolchain/bfd/elf.c:4342
4342      if (! abfd->output_has_begun
(gdb) up
#4  0x804bd6e in bfd_close ()

(gdb) print abfd->outsymbols
$19 = (struct symbol_cache_entry **) 0x0