Fix pr24486.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 5 Oct 2015 12:07:05 +0000 (12:07 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 5 Oct 2015 12:07:05 +0000 (12:07 +0000)
commit0eba49c22e81ffb6aa9290684f383e7352f00574
treecec99d100edd7407970f012256528bb6ec7a48cb
parentdeb80b5397fd53debca9a8f6afa5a35c29420287
Fix pr24486.

This extends the work done in r233995 so that now getFragment (in addition to
getSection) also works for variable symbols.

With that the existing logic to decide if a-b can be computed works even if
a or b are variables. Given that, the expression evaluation can avoid expanding
variables as aggressively and that in turn lets the relocation code see the
original variable.

In order for this to work with the asm streamer, there is now a dummy fragment
per section. It is used to assign a section to a symbol when no other fragment
exists.

This patch is a joint work by Maxim Ostapenko andy myself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249303 91177308-0d34-0410-b5e6-96231b3b80d8
30 files changed:
include/llvm/MC/MCAssembler.h
include/llvm/MC/MCExpr.h
include/llvm/MC/MCMachObjectWriter.h
include/llvm/MC/MCObjectWriter.h
include/llvm/MC/MCSection.h
include/llvm/MC/MCStreamer.h
include/llvm/MC/MCSymbol.h
lib/MC/ELFObjectWriter.cpp
lib/MC/MCAsmStreamer.cpp
lib/MC/MCAssembler.cpp
lib/MC/MCELFStreamer.cpp
lib/MC/MCExpr.cpp
lib/MC/MCMachOStreamer.cpp
lib/MC/MCObjectStreamer.cpp
lib/MC/MCObjectWriter.cpp
lib/MC/MCSection.cpp
lib/MC/MCStreamer.cpp
lib/MC/MCSymbol.cpp
lib/MC/MachObjectWriter.cpp
lib/MC/WinCOFFStreamer.cpp
lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h
lib/Target/ARM/MCTargetDesc/ARMMCExpr.h
lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
lib/Target/NVPTX/NVPTXMCExpr.h
lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
test/MC/COFF/alias.s
test/MC/ELF/relocation.s