diff options
author | Kevin Enderby <enderby@apple.com> | 2013-08-12 22:45:44 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2013-08-12 22:45:44 +0000 |
commit | ebc573ed5b7d4757d58b3bfdec53fcf9b4cb8c01 (patch) | |
tree | 3f16521c9bb33c1ef2b23f9bc48dec5794d08ccd /lib/Target/X86/MCTargetDesc | |
parent | 4f96b7e1478be0b33cda589db40635a1e3a40c11 (diff) | |
download | external_llvm-ebc573ed5b7d4757d58b3bfdec53fcf9b4cb8c01.zip external_llvm-ebc573ed5b7d4757d58b3bfdec53fcf9b4cb8c01.tar.gz external_llvm-ebc573ed5b7d4757d58b3bfdec53fcf9b4cb8c01.tar.bz2 |
Fix a crash with X86 Mach-O and a subtraction expression where both symbols are
undefined and produce an error message instead as this is a non-relocatable
expression with X86 Mach-O.
rdar://8920876
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188218 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/MCTargetDesc')
-rw-r--r-- | lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp b/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp index 64f005c..6eff224 100644 --- a/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp @@ -175,6 +175,11 @@ void X86MachObjectWriter::RecordX86_64Relocation(MachObjectWriter *Writer, if (A_Base == B_Base && A_Base) report_fatal_error("unsupported relocation with identical base"); + // A subtraction expression where both symbols are undefined is a + // non-relocatable expression. + if (A->isUndefined() && B->isUndefined()) + report_fatal_error("unsupported relocation with subtraction expression"); + Value += Writer->getSymbolAddress(&A_SD, Layout) - (A_Base == NULL ? 0 : Writer->getSymbolAddress(A_Base, Layout)); Value -= Writer->getSymbolAddress(&B_SD, Layout) - |