Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Feb 2019 20:13:40 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344112 - head/contrib/llvm/lib/MC
Message-ID:  <201902132013.x1DKDe6N017537@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));
   }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902132013.x1DKDe6N017537>