Fix a Mach-O assembler segfault for a subtraction expression with an undefined symbol.
authorKevin Enderby <enderby@apple.com>
Fri, 24 Oct 2014 22:39:40 +0000 (22:39 +0000)
committerKevin Enderby <enderby@apple.com>
Fri, 24 Oct 2014 22:39:40 +0000 (22:39 +0000)
commit44ccedc273eb5a30f51e1cd6bda95e697e754e94
tree2aa387403f21123ea22287c4cfcb1c88325662b6
parentab08da75d70c76fd946483e29366264c92cc092b
Fix a Mach-O assembler segfault for a subtraction expression with an undefined symbol.

In a Mach-O object file a relocatable expression of the form
SymbolA - SymbolB + constant is allowed when both symbols are
defined in a section.  But when either symbol is undefined it
is an error.

The code was crashing when it had an undefined symbol in this case.
And should have printed a error message using the location information
in the relocation entry.

rdar://18678402

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220599 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
test/MC/MachO/bad-darwin-x86_64-reloc-expr1.s [new file with mode: 0644]
test/MC/MachO/bad-darwin-x86_64-reloc-expr2.s [new file with mode: 0644]