[lld][ELF] Fix "enumeral and non-enumeral type in conditional expression" warning (NFC)

GCC warning:
```
/llvm-project/lld/ELF/SyntheticSections.cpp: In member function ‘virtual void lld:🧝:VersionTableSection::writeTo(uint8_t*)’:
/llvm-project/lld/ELF/SyntheticSections.cpp:3128:34: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
 3128 |     write16(buf, s.sym->isLazy() ? VER_NDX_GLOBAL : s.sym->versionId);
      |                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
This commit is contained in:
Yang Fan 2021-04-21 16:00:57 +08:00
parent 4307446e9f
commit c09277b0d8
No known key found for this signature in database
GPG Key ID: 717E4EB972E515EF
1 changed files with 2 additions and 1 deletions

View File

@ -3125,7 +3125,8 @@ void VersionTableSection::writeTo(uint8_t *buf) {
for (const SymbolTableEntry &s : getPartition().dynSymTab->getSymbols()) {
// Use the original versionId for an unfetched lazy symbol (undefined weak),
// which must be VER_NDX_GLOBAL (an undefined versioned symbol is an error).
write16(buf, s.sym->isLazy() ? VER_NDX_GLOBAL : s.sym->versionId);
write16(buf, s.sym->isLazy() ? static_cast<uint16_t>(VER_NDX_GLOBAL)
: s.sym->versionId);
buf += 2;
}
}