Produce an error for an invalid use of .symver.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 27 Oct 2010 17:56:18 +0000 (17:56 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 27 Oct 2010 17:56:18 +0000 (17:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117462 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/ELFObjectWriter.cpp
test/MC/ELF/invalid-symver.s [new file with mode: 0644]

index 54d8123da02f813c5cf6e7d013c9fd82a50abb05..1904397fe11f5c6a8edb9874357d17971b49e357 100644 (file)
@@ -468,6 +468,11 @@ void ELFObjectWriterImpl::ExecutePostLayoutBinding(MCAssembler &Asm) {
     if (!Symbol.isUndefined() && !Rest.startswith("@@@"))
       continue;
 
+    // FIXME: produce a better error message.
+    if (Symbol.isUndefined() && Rest.startswith("@@") &&
+        !Rest.startswith("@@@"))
+      report_fatal_error("A @@ version cannot be undefined");
+
     std::pair<const MCSymbol *, const MCSymbol *> t(&Symbol, &Alias);
     Renames.insert(t);
   }
diff --git a/test/MC/ELF/invalid-symver.s b/test/MC/ELF/invalid-symver.s
new file mode 100644 (file)
index 0000000..3c4f8c0
--- /dev/null
@@ -0,0 +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
+
+        .symver undefined, foo@@bar
+        .long undefined