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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 16:27:23 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/SymbolTable.cpp:719-721
+  if (!Body->isInCurrentDSO())
+    return false;
+  return Body->getName().find("@@") != StringRef::npos;
----------------
You can do

  return B->isInCurrentDSO() && B->getName().find("@@") != StringRef::npos;


================
Comment at: ELF/SymbolTable.cpp:733
+  std::vector<DefinedRegular *> DefaultV;
+  for (Symbol *Sym : SymVector) {
+    if (isDefaultVersion(Sym->body()))
----------------
You can do

  for (size_t I = 0; I < SymVector.size(); ++I)

to remove `DefaultV`, no?


================
Comment at: ELF/SymbolTable.cpp:734
+  for (Symbol *Sym : SymVector) {
+    if (isDefaultVersion(Sym->body()))
+      DefaultV.push_back(cast<DefinedRegular>(Sym->body()));
----------------
What is the cost of doing this for each symbol?


================
Comment at: ELF/Symbols.cpp:259
   // It is an error if the specified version is not defined.
-  error(toString(File) + ": symbol " + S + " has undefined version " + Verstr);
+  if (Config->Shared)
+    error(toString(File) + ": symbol " + S + " has undefined version " +
----------------
Why did you add this?


https://reviews.llvm.org/D33680





More information about the llvm-commits mailing list