[PATCH] D21930: [ELF] - Implement extern "c++" version script tag

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 13:50:16 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/SymbolTable.cpp:572
@@ +571,3 @@
+static void setVersionId(SymbolBody *Body, StringRef VersionName,
+                         StringRef Name, uint16_t Version) {
+  if (!Body || Body->isUndefined()) {
----------------
If you pass a SymbolBody, do you have to pass `Name`? I think you can obtain it by `Body->getName()`.

================
Comment at: ELF/SymbolTable.cpp:589
@@ +588,3 @@
+  std::map<std::string, SymbolBody *> Result;
+  for (auto I = Symtab.begin(); I != Symtab.end(); ++I)
+    Result[demangle(I->first.Val)] = SymVector[I->second]->body();
----------------
Why don't you use a range-based for?

================
Comment at: ELF/SymbolTable.cpp:627-628
@@ -598,7 +626,4 @@
         continue;
 
-      SymbolBody *B = find(Name);
-      if (!B || B->isUndefined()) {
-        if (Config->NoUndefinedVersion)
-          error("version script assignment of " + V.Name + " to symbol " +
-                Name + " failed: symbol not defined");
+      HasExternCpp |= Sym.IsExternCpp;
+      if (Sym.IsExternCpp)
----------------
I'd disagree -- that rule doesn't make sense to me. If you specify a mangled name (that contains no wildcards), then that is as specific/strict as demangled names. I don't see a reason to look for extern C++ names after non-extern-C++ names.


http://reviews.llvm.org/D21930





More information about the llvm-commits mailing list