svn commit: r344112 - head/contrib/llvm/lib/MC

Dimitry Andric dim at FreeBSD.org
Wed Feb 13 20:13:41 UTC 2019


Author: dim
Date: Wed Feb 13 20:13:40 2019
New Revision: 344112
URL: https://svnweb.freebsd.org/changeset/base/344112

Log:
  Pull in r353907 from upstream llvm trunk (by Reid Kleckner):
  
    [MC] Make symbol version errors non-fatal
  
    We stil don't have a source location, which is pretty lame, but at
    least we won't tell the user to file a clang bug report anymore.
  
    Fixes PR40712
  
  This will make errors for symbols with @@ versions that are not defined
  non-fatal.  For example:
  
    void f(void)
    {
      __asm__(".symver foo,bar@@baz");
    }
  
  will now result in:
  
    error: versioned symbol bar@@baz must be defined
  
  instead of clang crashing with a diagnostic report.
  
  PR:		234671
  Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40712
  MFC after:	3 days

Modified:
  head/contrib/llvm/lib/MC/ELFObjectWriter.cpp

Modified: head/contrib/llvm/lib/MC/ELFObjectWriter.cpp
==============================================================================
--- head/contrib/llvm/lib/MC/ELFObjectWriter.cpp	Wed Feb 13 19:00:06 2019	(r344111)
+++ head/contrib/llvm/lib/MC/ELFObjectWriter.cpp	Wed Feb 13 20:13:40 2019	(r344112)
@@ -1258,14 +1258,20 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssem
     if (!Symbol.isUndefined() && !Rest.startswith("@@@"))
       continue;
 
-    // FIXME: produce a better error message.
+    // FIXME: Get source locations for these errors or diagnose them earlier.
     if (Symbol.isUndefined() && Rest.startswith("@@") &&
-        !Rest.startswith("@@@"))
-      report_fatal_error("A @@ version cannot be undefined");
+        !Rest.startswith("@@@")) {
+      Asm.getContext().reportError(SMLoc(), "versioned symbol " + AliasName +
+                                                " must be defined");
+      continue;
+    }
 
-    if (Renames.count(&Symbol) && Renames[&Symbol] != Alias)
-      report_fatal_error(llvm::Twine("Multiple symbol versions defined for ") +
-                         Symbol.getName());
+    if (Renames.count(&Symbol) && Renames[&Symbol] != Alias) {
+      Asm.getContext().reportError(
+          SMLoc(), llvm::Twine("multiple symbol versions defined for ") +
+                       Symbol.getName());
+      continue;
+    }
 
     Renames.insert(std::make_pair(&Symbol, Alias));
   }


More information about the svn-src-head mailing list