diff options
author | Kevin Enderby <enderby@apple.com> | 2013-09-05 20:25:06 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2013-09-05 20:25:06 +0000 |
commit | d8e2f1757d9ececd7937406596fec8e4ebfb7d46 (patch) | |
tree | e744909e39496f956ea5f98c8d908b4f5b0cae24 /lib/Target/X86/MCTargetDesc | |
parent | 596aa123f46158639c836f1d53b89a9d7898c4b7 (diff) | |
download | external_llvm-d8e2f1757d9ececd7937406596fec8e4ebfb7d46.zip external_llvm-d8e2f1757d9ececd7937406596fec8e4ebfb7d46.tar.gz external_llvm-d8e2f1757d9ececd7937406596fec8e4ebfb7d46.tar.bz2 |
Fixed a crash in the integrated assembler for Mach-O when a symbol difference
expression uses an assembler temporary symbol from an assignment. In this case
the symbol does not have a fragment so the use of getFragment() would be NULL
and caused a crash. In the case of an assembler temporary symbol we want to use
the AliasedSymbol (if any) which will create a local relocation entry, but if
it is not an assembler temporary symbol then let it use that symbol with an
external relocation entry.
rdar://9356266
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190096 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/MCTargetDesc')
-rw-r--r-- | lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp b/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp index b6f10ba..eb7c0b1 100644 --- a/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp @@ -144,10 +144,14 @@ void X86MachObjectWriter::RecordX86_64Relocation(MachObjectWriter *Writer, } } else if (Target.getSymB()) { // A - B + constant const MCSymbol *A = &Target.getSymA()->getSymbol(); + if (A->isTemporary()) + A = &A->AliasedSymbol(); MCSymbolData &A_SD = Asm.getSymbolData(*A); const MCSymbolData *A_Base = Asm.getAtom(&A_SD); const MCSymbol *B = &Target.getSymB()->getSymbol(); + if (B->isTemporary()) + B = &B->AliasedSymbol(); MCSymbolData &B_SD = Asm.getSymbolData(*B); const MCSymbolData *B_Base = Asm.getAtom(&B_SD); |