http://sourceware.org/bugzilla/show_bug.cgi?id=15758
Bug ID: 15758 Summary: Gold segfault when using -q option Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: gold Assignee: ian at airs dot com Reporter: law at redhat dot com CC: ccoutant at google dot com gold is segfaulting when linking the following testcode. t.c (compile with -fPIC): __thread int a; void _start(void) { a = 2; } Starting program: /tmp/binutils/gold/ld-new t.o -q Breakpoint 3, gold::Sized_relobj_file<64, false>::emit_relocs_scan (this=0xa644f0, symtab=0x7fffffff7980, layout=0x7fffffff7be0, plocal_syms=0x7ffff7ffb468 "", p=...) at /home/law/UPSTREAM/binutils/gold/reloc.cc:550 550 gold_assert(rr != NULL); (gdb) c Continuing. Breakpoint 3, gold::Sized_relobj_file<64, false>::emit_relocs_scan (this=0xa644f0, symtab=0x7fffffff7980, layout=0x7fffffff7be0, plocal_syms=0x7ffff7ffb468 "", p=...) at /home/law/UPSTREAM/binutils/gold/reloc.cc:550 550 gold_assert(rr != NULL); (gdb) bt #0 gold::Sized_relobj_file<64, false>::emit_relocs_scan (this=0xa644f0, symtab=0x7fffffff7980, layout=0x7fffffff7be0, plocal_syms=0x7ffff7ffb468 "", p=...) at /home/law/UPSTREAM/binutils/gold/reloc.cc:550 #1 0x00000000006c5d68 in gold::Sized_relobj_file<64, false>::do_scan_relocs (this=0xa644f0, symtab=0x7fffffff7980, layout=0x7fffffff7be0, rd=0xa4a770) at /home/law/UPSTREAM/binutils/gold/reloc.cc:469 #2 0x00000000006c2c7a in gold::Relobj::scan_relocs (this=0xa644f0, symtab=0x7fffffff7980, layout=0x7fffffff7be0, rd=0xa4a770) at /home/law/UPSTREAM/binutils/gold/object.h:1057 #3 0x00000000006c27c1 in gold::Scan_relocs::run (this=0xa69020) at /home/law/UPSTREAM/binutils/gold/reloc.cc:188 #4 0x000000000073e38b in gold::Workqueue::find_and_run_task (this=0x7fffffff7630, thread_number=0) at /home/law/UPSTREAM/binutils/gold/workqueue.cc:319 #5 0x000000000073e9b4 in gold::Workqueue::process (this=0x7fffffff7630, thread_number=0) at /home/law/UPSTREAM/binutils/gold/workqueue.cc:495 #6 0x0000000000404016 in main (argc=3, argv=0x7fffffffdb68) at /home/law/UPSTREAM/binutils/gold/main.cc:252 (gdb) p rr $5 = (gold::Relocatable_relocs *) 0x0 It appears the relocatable_relocs are set up in: gold::Sized_relobj_file for (std::vector<unsigned int>::const_iterator p = reloc_sections.begin(); p != reloc_sections.end(); ++p) [ ... ] Output_section* data_section = out_sections[data_shndx]; if (data_section == reinterpret_cast<Output_section*>(2)) { // The layout for the data section was deferred, so we need // to defer the relocation section, too. const char* name = pnames + shdr.get_sh_name(); this->deferred_layout_relocs_.push_back( Deferred_layout(i, name, pshdr, 0, elfcpp::SHT_NULL)); out_sections[i] = reinterpret_cast<Output_section*>(2); out_section_offsets[i] = invalid_address; continue; } if (data_section == NULL) { out_sections[i] = NULL; out_section_offsets[i] = invalid_address; continue; } Relocatable_relocs* rr = new Relocatable_relocs(); this->set_relocatable_relocs(i, rr); We have no appropriate out_section for the section reloc section. Thus data_section is NULL and we call this->set_relocatable_relocs, ultimately leading to the assertion failure. I'm not at all familiar with the gold code, so I'm not sure how to proceed at the moment. Your thoughts would be appreciated. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils