svn commit: r344217 - in stable: 11/contrib/llvm/lib/MC 12/contrib/llvm/lib/MC

Dimitry Andric dim at FreeBSD.org
Sat Feb 16 19:49:14 UTC 2019


Author: dim
Date: Sat Feb 16 19:49:12 2019
New Revision: 344217
URL: https://svnweb.freebsd.org/changeset/base/344217

Log:
  MFC r344112:
  
  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

Modified:
  stable/12/contrib/llvm/lib/MC/ELFObjectWriter.cpp
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/llvm/lib/MC/ELFObjectWriter.cpp
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/contrib/llvm/lib/MC/ELFObjectWriter.cpp
==============================================================================
--- stable/12/contrib/llvm/lib/MC/ELFObjectWriter.cpp	Sat Feb 16 16:34:23 2019	(r344216)
+++ stable/12/contrib/llvm/lib/MC/ELFObjectWriter.cpp	Sat Feb 16 19:49:12 2019	(r344217)
@@ -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-all mailing list