[llvm] r353907 - [MC] Make symbol version errors non-fatal
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 12 17:39:32 PST 2019
Author: rnk
Date: Tue Feb 12 17:39:32 2019
New Revision: 353907
URL: http://llvm.org/viewvc/llvm-project?rev=353907&view=rev
Log:
[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
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/test/MC/ELF/invalid-symver.s
llvm/trunk/test/MC/ELF/multiple-different-symver.s
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=353907&r1=353906&r2=353907&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Tue Feb 12 17:39:32 2019
@@ -1274,14 +1274,20 @@ void ELFObjectWriter::executePostLayoutB
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));
}
Modified: llvm/trunk/test/MC/ELF/invalid-symver.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/invalid-symver.s?rev=353907&r1=353906&r2=353907&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/invalid-symver.s (original)
+++ llvm/trunk/test/MC/ELF/invalid-symver.s Tue Feb 12 17:39:32 2019
@@ -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
Modified: llvm/trunk/test/MC/ELF/multiple-different-symver.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/multiple-different-symver.s?rev=353907&r1=353906&r2=353907&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/multiple-different-symver.s (original)
+++ llvm/trunk/test/MC/ELF/multiple-different-symver.s Tue Feb 12 17:39:32 2019
@@ -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 at 1
.symver foo, foo at 2
More information about the llvm-commits
mailing list