]> granicus.if.org Git - llvm/commitdiff
Merging r353907:
authorHans Wennborg <hans@hanshq.net>
Mon, 18 Feb 2019 10:39:35 +0000 (10:39 +0000)
committerHans Wennborg <hans@hanshq.net>
Mon, 18 Feb 2019 10:39:35 +0000 (10:39 +0000)
------------------------------------------------------------------------
r353907 | rnk | 2019-02-13 02:39:32 +0100 (Wed, 13 Feb 2019) | 6 lines

[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
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_80@354257 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/ELFObjectWriter.cpp
test/MC/ELF/invalid-symver.s
test/MC/ELF/multiple-different-symver.s

index 89f3b30cddd6f44087340e3ab40d84c4e51ee1a1..ade858113a300944a3e2e8dd8cc3b9bca99268e7 100644 (file)
@@ -1275,14 +1275,20 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssembler &Asm,
     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));
   }
index 3c4f8c084b94b6da55ff1cc918fb0677ef353d49..d9f97b102b579b1cd89bef20630a7be9f36bbec9 100644 (file)
@@ -1,7 +1,7 @@
 // RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t 2> %t.out
 // RUN: FileCheck --input-file=%t.out %s
 
-// CHECK: A @@ version cannot be undefined
+// CHECK: error: versioned symbol foo@@bar must be defined
 
         .symver undefined, foo@@bar
         .long undefined
index d7706f89f41982ad209974f23bb0a25d869e7e06..c34626c08173c200eae33d688b4dd3dcae06941e 100644 (file)
@@ -1,6 +1,6 @@
 // RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t 2>&1 | FileCheck %s
 
-// CHECK: Multiple symbol versions defined for foo
+// CHECK: error: multiple symbol versions defined for foo
 
 .symver foo, foo@1
 .symver foo, foo@2