[PATCH] D33680: [ELF] - Resolve references properly when using .symver directive

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 13:47:50 PDT 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> -  if (!Config->VersionDefinitions.empty())
> -    for (Symbol *Sym : SymVector)
> -      Sym->body()->parseSymbolVersion();
> +  std::vector<Symbol *> DefaultV;
> +  for (Symbol *Sym : SymVector)
> +    if (Sym->body()->parseSymbolVersion())
> +      DefaultV.push_back(Sym);
> +

You need the vector because addRegular can resize SymVector. Please add
a comment. The vector can be a vector of DefinedRegulars.

> +  // <name>@@<version> means symbol has 'default' version. We should use it to
> +  // resolve references to <name>.
> +  for (Symbol *Sym : DefaultV) {
> +    SymbolBody *Body = find(Sym->body()->getName());
> +    if (!Body)
> +      continue;
> +    DefinedRegular *D = cast<DefinedRegular>(Sym->body());
> +    addRegular(D->getName(), D->StOther, D->Type, D->Value, D->Size,
> +               Sym->Binding, D->Section, D->File);
> +  }
>  
>    // Handle edge cases first.
>    handleAnonymousVersion();


More information about the llvm-commits mailing list