I realize I just dumped the previous patch without explaining it, so maybe this will help reducing the workload from Daniel, or maybe even finding a new reviewer (yes, that's you! :) ). In a nutshell: In coff based targets, there is a new segfault in parse.c:write_exp_msymbol, at: if (SYMBOL_BFD_SECTION (msymbol)->flags & SEC_THREAD_LOCAL) Easily triggered by just issuing p.ex.: p globalvar The problem is that minimal symbols may have a bfd_section set to NULL at this point. (SYMBOL_BFD_SECTION (msymbol) == NULL). This segfault doesn't happen in elf targets, because in elfread.c, prim_record_minimal_symbol_and_info is always called with a non-NULL bfd_section*, effectively always creating a minimal symbol with a bfd_section set. In coffread.c, prim_record_minimal_symbol_and_info is always called with bfd_section == NULL. The attached patch, (functionally equivalent to the previous one, with just a small cleanup), makes the coff reader match the bfd_section from the coff_symbol, using the symbols' section number and bfd_map_over_sections. This matching was already done in the existing code, in cs_to_section, so it should be correct, unlike the previous versions that used objfile->sections. A few other functions are then adjusted to be able to pass bfd_section while preserving the rest of the existing behavior. I don't thing that the original workaround in the beginning of this thread ...: - if (SYMBOL_BFD_SECTION (msymbol)->flags & SEC_THREAD_LOCAL) + if (SYMBOL_BFD_SECTION (msymbol) + && (SYMBOL_BFD_SECTION (msymbol)->flags & SEC_THREAD_LOCAL)) ... should still be applied. Having it segfault there for other formats and fix them accordingly would be better, than hiding the real bug, IMHO. Hope this helped, Cheers, Pedro Alves --- 2006-11-18 Pedro Alves * symtab.h (prim_record_minimal_symbol_and_bfd_section): Declare. * minsyms.c (prim_record_minimal_symbol_and_bfd_section): Rename from prim_record_minimal_symbol and add bfd_section parameter. (prim_record_minimal_symbol): New version; wraps prim_record_minimal_symbol_and_bfd_section. * coffread.c (cs_to_bfd_section): New function. (cs_to_section): Use cs_to_bfd_section. (record_minimal_symbol): Add bfd_section parameter. Call prim_record_minimal_symbol_and_bfd_section. (coff_symtab_read): Use cs_to_bfd_section.