Don't be over eager in evaluating a subtraction with a weak symbol.
In a subtraction of the form A - B, if B is weak, there is no way to represent
that on ELF since all relocations add the value of a symbol.
llvm-svn: 233139
diff --git a/llvm/test/MC/ELF/weak-diff.s b/llvm/test/MC/ELF/weak-diff.s
new file mode 100644
index 0000000..d270bbb
--- /dev/null
+++ b/llvm/test/MC/ELF/weak-diff.s
@@ -0,0 +1,12 @@
+// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t 2>&1 | FileCheck %s
+
+// CHECK: error: Cannot represent a subtraction with a weak symbol
+
+.weak f
+.weak g
+f:
+ nop
+g:
+ nop
+
+.quad g - f