GNU Binutils with patches for OS216
修訂 | 94de2a2c57b7f6b2870f72ecdcacc6d909c6421a (tree) |
---|---|
時間 | 2017-06-20 17:31:52 |
作者 | James Clarke <jrtc27@jrtc...> |
Commiter | Alan Modra |
[GOLD] Avoid duplicate PLT stub symbols on ppc32
If two objects are compiled with -fPIC or -fPIE and call the same
function, two different PLT entries are created, one for each object,
but the same stub symbol name is used for both.
* powerpc.cc (Stub_table::define_stub_syms): Always include object's
uniq_ value.
@@ -1,3 +1,8 @@ | ||
1 | +2017-06-20 James Clarke <jrtc27@jrtc27.com> | |
2 | + | |
3 | + * powerpc.cc (Stub_table::define_stub_syms): Always include object's | |
4 | + uniq_ value. | |
5 | + | |
1 | 6 | 2017-06-15 Eric Christopher <echristo@gmail.com> |
2 | 7 | |
3 | 8 | * aarch64.cc: Fix a few typos and grammar-os. |
@@ -4656,19 +4656,25 @@ Stub_table<size, big_endian>::define_stub_syms(Symbol_table* symtab) | ||
4656 | 4656 | add[0] = 0; |
4657 | 4657 | if (cs->first.addend_ != 0) |
4658 | 4658 | sprintf(add, "+%x", static_cast<uint32_t>(cs->first.addend_)); |
4659 | - char localname[18]; | |
4660 | - const char *symname; | |
4661 | - if (cs->first.sym_ == NULL) | |
4659 | + char obj[10]; | |
4660 | + obj[0] = 0; | |
4661 | + if (cs->first.object_) | |
4662 | 4662 | { |
4663 | 4663 | const Powerpc_relobj<size, big_endian>* ppcobj = static_cast |
4664 | 4664 | <const Powerpc_relobj<size, big_endian>*>(cs->first.object_); |
4665 | - sprintf(localname, "%x:%x", ppcobj->uniq(), cs->first.locsym_); | |
4665 | + sprintf(obj, "%x:", ppcobj->uniq()); | |
4666 | + } | |
4667 | + char localname[9]; | |
4668 | + const char *symname; | |
4669 | + if (cs->first.sym_ == NULL) | |
4670 | + { | |
4671 | + sprintf(localname, "%x", cs->first.locsym_); | |
4666 | 4672 | symname = localname; |
4667 | 4673 | } |
4668 | 4674 | else |
4669 | 4675 | symname = cs->first.sym_->name(); |
4670 | - char* name = new char[8 + 10 + strlen(symname) + strlen(add) + 1]; | |
4671 | - sprintf(name, "%08x.plt_call.%s%s", this->uniq_, symname, add); | |
4676 | + char* name = new char[8 + 10 + strlen(obj) + strlen(symname) + strlen(add) + 1]; | |
4677 | + sprintf(name, "%08x.plt_call.%s%s%s", this->uniq_, obj, symname, add); | |
4672 | 4678 | Address value = this->stub_address() - this->address() + cs->second; |
4673 | 4679 | unsigned int stub_size = this->plt_call_size(cs); |
4674 | 4680 | this->targ_->define_local(symtab, name, this, value, stub_size); |