@@ -92,6 +92,7 @@ Symbol *SymbolTable::insert(StringRef name) {
9292 memset (sym, 0 , sizeof (Symbol));
9393 sym->setName (name);
9494 sym->partition = 1 ;
95+ sym->verdefIndex = -1 ;
9596 sym->versionId = VER_NDX_GLOBAL;
9697 if (pos != StringRef::npos)
9798 sym->hasVersionSuffix = true ;
@@ -234,9 +235,10 @@ bool SymbolTable::assignExactVersion(SymbolVersion ver, uint16_t versionId,
234235 sym->getName ().contains (' @' ))
235236 continue ;
236237
237- // If the version has not been assigned, assign versionId to the symbol.
238- if (!sym->versionScriptAssigned ) {
239- sym->versionScriptAssigned = true ;
238+ // If the version has not been assigned, verdefIndex is -1. Use an arbitrary
239+ // number (0) to indicate the version has been assigned.
240+ if (sym->verdefIndex == uint16_t (-1 )) {
241+ sym->verdefIndex = 0 ;
240242 sym->versionId = versionId;
241243 }
242244 if (sym->versionId == versionId)
@@ -254,8 +256,8 @@ void SymbolTable::assignWildcardVersion(SymbolVersion ver, uint16_t versionId,
254256 // so we set a version to a symbol only if no version has been assigned
255257 // to the symbol. This behavior is compatible with GNU.
256258 for (Symbol *sym : findAllByVersion (ver, includeNonDefault))
257- if (! sym->versionScriptAssigned ) {
258- sym->versionScriptAssigned = true ;
259+ if (sym->verdefIndex == uint16_t (- 1 ) ) {
260+ sym->verdefIndex = 0 ;
259261 sym->versionId = versionId;
260262 }
261263}
0 commit comments