Roland Baumann <roland.baum...@coware.com> writes: >>> >>> I compile this with: >>> >>>> g++-4.1.2 -c test_shared.cc -o test_shared.o >>>> g++-4.1.2 -B <path_to_gold> -shared -s test_shared.o -o test_shared.so >> >> I'm not able to recreate this problem with either binutils 2.19 or >> with the development version. Can you post the output of your -shared >> command line with the -v option? That will show precisely how the >> linker is being invoked. >> > > Here it comes:
Thanks. Unfortunately I still can't recreate it. I took a closer look at the code, and I found a possible problem if there are local symbols which have to go into the dynamic symbol table. I committed this patch, which may fix your problem. Ian 2009-01-15 Ian Lance Taylor <i...@google.com> * object.cc (Sized_relobj::write_local_symbols): Don't write out local symbols when stripping all symbols.
Index: object.cc =================================================================== RCS file: /cvs/src/src/gold/object.cc,v retrieving revision 1.79 diff -p -u -r1.79 object.cc --- object.cc 23 Dec 2008 02:02:20 -0000 1.79 +++ object.cc 15 Jan 2009 18:01:55 -0000 @@ -1416,9 +1416,13 @@ Sized_relobj<size, big_endian>::write_lo Output_symtab_xindex* symtab_xindex, Output_symtab_xindex* dynsym_xindex) { - if (parameters->options().strip_all() - && this->output_local_dynsym_count_ == 0) - return; + const bool strip_all = parameters->options().strip_all(); + if (strip_all) + { + if (this->output_local_dynsym_count_ == 0) + return; + this->output_local_symbol_count_ = 0; + } gold_assert(this->symtab_shndx_ != -1U); if (this->symtab_shndx_ == 0) @@ -1487,7 +1491,7 @@ Sized_relobj<size, big_endian>::write_lo st_shndx = out_sections[st_shndx]->out_shndx(); if (st_shndx >= elfcpp::SHN_LORESERVE) { - if (lv.needs_output_symtab_entry()) + if (lv.needs_output_symtab_entry() && !strip_all) symtab_xindex->add(lv.output_symtab_index(), st_shndx); if (lv.needs_output_dynsym_entry()) dynsym_xindex->add(lv.output_dynsym_index(), st_shndx); @@ -1496,8 +1500,7 @@ Sized_relobj<size, big_endian>::write_lo } // Write the symbol to the output symbol table. - if (!parameters->options().strip_all() - && lv.needs_output_symtab_entry()) + if (!strip_all && lv.needs_output_symtab_entry()) { elfcpp::Sym_write<size, big_endian> osym(ov);
_______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils