From: Ian Lance Taylor Date: Sun, 14 Oct 2007 07:27:10 +0000 (+0000) Subject: Adjust linkonce symbol name algorithm to work for X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8cfcbb55654b71dc161bc8fcdf4db602b63dbf9c;p=pf3gnuchains%2Fpf3gnuchains3x.git Adjust linkonce symbol name algorithm to work for .gnu.linkonce.t.__i686.get_pc_thunk.bx. --- diff --git a/gold/object.cc b/gold/object.cc index d655a4102f..64cecc8376 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -383,7 +383,20 @@ Sized_relobj::include_linkonce_section( const char* name, const elfcpp::Shdr&) { - const char* symname = strrchr(name, '.') + 1; + // In general the symbol name we want will be the string following + // the last '.'. However, we have to handle the case of + // .gnu.linkonce.t.__i686.get_pc_thunk.bx, which was generated by + // some versions of gcc. So we use a heuristic: if the name starts + // with ".gnu.linkonce.t.", we use everything after that. Otherwise + // we look for the last '.'. We can't always simply skip + // ".gnu.linkonce.X", because we have to deal with cases like + // ".gnu.linkonce.d.rel.ro.local". + const char* const linkonce_t = ".gnu.linkonce.t."; + const char* symname; + if (strncmp(name, linkonce_t, strlen(linkonce_t)) == 0) + symname = name + strlen(linkonce_t); + else + symname = strrchr(name, '.') + 1; bool include1 = layout->add_comdat(symname, false); bool include2 = layout->add_comdat(name, true); return include1 && include2;