[PATCH] D21681: [ELF] - Implemented support of default/non-default symbols versions

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 26 02:07:46 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/SymbolTable.cpp:166
@@ -165,1 +165,3 @@
 
+static void setupVersionAttributes(Symbol *Sym, StringRef Name) {
+  size_t VersionBegin = Name.find('@');
----------------
grimar wrote:
> ruiu wrote:
> > You can make this function side-effect-free.
> > 
> >   static uint16_t getVersionId(Symbol *Sym, StringRef Name)
> > 
> > which returns a version ID. Then use it in insert() like this.
> > 
> >   Sym->VersionId = getVersionId(Sym, Name);
> I can, but what about VersionedName flag ?
> I need to set it too, I think the only way to do that without second search of '@' would be:
> 
> ```
> Sym->VersionId = getVersionId(Sym, Name); //search is inside
> Sym->VersionedName = Sym->VersionId != VER_NDX_LOCAL && 
>                                             Sym->VersionId != VER_NDX_GLOBAL;
> ```
> 
> Looks ok ?
Well, if you can compute `VersionedName` from `VersionId`,  you don't need to store it to a symbol. Instead, you can define `bool isVersioned()`.


http://reviews.llvm.org/D21681





More information about the llvm-commits mailing list