[ELF][MIPS] Ignore incorrect version definition index for _gp_disp symbol

MIPS BFD linker puts _gp_disp symbol into DSO files and assigns zero
version definition index to it. This value means 'unversioned local
symbol' while _gp_disp is a section global symbol. We have to handle
this bug in the LLD because BFD linker is used for building MIPS
toolchain libraries.

Differential revision: https://reviews.llvm.org/D42486

llvm-svn: 324467
This commit is contained in:
Simon Atanasyan
2018-02-07 10:02:49 +00:00
parent 10003e31f4
commit 85815a3149
4 changed files with 35 additions and 0 deletions

View File

@@ -862,6 +862,14 @@ template <class ELFT> void SharedFile<ELFT>::parseRest() {
continue;
}
if (Config->EMachine == EM_MIPS) {
// FIXME: MIPS BFD linker puts _gp_disp symbol into DSO files
// and incorrectly assigns VER_NDX_LOCAL to this section global
// symbol. Here is a workaround for this bug.
if (Versym && VersymIndex == VER_NDX_LOCAL && Name == "_gp_disp")
continue;
}
const Elf_Verdef *Ver = nullptr;
if (VersymIndex != VER_NDX_GLOBAL) {
if (VersymIndex >= Verdefs.size() || VersymIndex == VER_NDX_LOCAL) {