Fix global version handling.

We should not ignore the symbol, just the version.

Fixes error with -z defs.

llvm-svn: 272270
This commit is contained in:
Rafael Espindola 2016-06-09 15:45:49 +00:00
parent 1aa20e9b4c
commit d2454d66e3
2 changed files with 6 additions and 4 deletions

View File

@ -529,11 +529,13 @@ template <class ELFT> void SharedFile<ELFT>::parseRest() {
if (Versym) {
// Ignore local symbols and non-default versions.
if (VersymIndex == VER_NDX_LOCAL || VersymIndex == VER_NDX_GLOBAL ||
(VersymIndex & VERSYM_HIDDEN))
if (VersymIndex == VER_NDX_LOCAL || (VersymIndex & VERSYM_HIDDEN))
continue;
}
elf::Symtab<ELFT>::X->addShared(this, Name, Sym, Verdefs[VersymIndex]);
const Elf_Verdef *V =
VersymIndex == VER_NDX_GLOBAL ? nullptr : Verdefs[VersymIndex];
elf::Symtab<ELFT>::X->addShared(this, Name, Sym, V);
}
}

View File

@ -1,6 +1,6 @@
// REQUIRES: x86
// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
// RUN: ld.lld %t.o %p/Inputs/version-use.so -o %t.so -shared
// RUN: ld.lld %t.o %p/Inputs/version-use.so -o %t.so -shared -z defs
// RUN: llvm-readobj -s %t.so | FileCheck %s