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)
commit2813f496d98f3e6d2c9c2774601999e147af34ef
treec73a9ccdc2add188e187092dfb54f09e5197a5d4
parent4183dbcc0327e9ef54447143c0073aa2593a5618
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

llvm-svn: 220599
llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
llvm/test/MC/MachO/bad-darwin-x86_64-reloc-expr1.s [new file with mode: 0644]
llvm/test/MC/MachO/bad-darwin-x86_64-reloc-expr2.s [new file with mode: 0644]