diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 19109bfa6d9f..b61f37944355 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -532,7 +532,8 @@ template void SharedFile::parseRest() { if (Versym) { // Ignore local symbols and non-default versions. - if (VersymIndex == 0 || VersymIndex == 1 || (VersymIndex & VERSYM_HIDDEN)) + if (VersymIndex == VER_NDX_LOCAL || VersymIndex == VER_NDX_GLOBAL || + (VersymIndex & VERSYM_HIDDEN)) continue; } elf::Symtab::X->addShared(this, Name, Sym, Verdefs[VersymIndex]); diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 96808d34eb79..bba6b96d1f7d 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -1430,8 +1430,7 @@ template void VersionTableSection::writeTo(uint8_t *Buf) { if (auto *SS = dyn_cast>(P.first)) OutVersym->vs_index = SS->VersionId; else - // The reserved identifier for a non-versioned global symbol. - OutVersym->vs_index = 1; + OutVersym->vs_index = VER_NDX_GLOBAL; ++OutVersym; } }