llvm-6502/lib/Target/X86/MCTargetDesc
Rafael Espindola 0a70f9b3b9 Look through variables when computing relocations.
Given

bar = foo + 4
	.long bar

MC would eat the 4. GNU as includes it in the relocation. The rule seems to be
that a variable that defines a symbol is used in the relocation and one that
does not define a symbol is evaluated and the result included in the relocation.

Fixing this unfortunately required some other changes:

* Since the variable is now evaluated, it would prevent the ELF writer from
  noticing the weakref marker the elf streamer uses. This patch then replaces
  that with a VariantKind in MCSymbolRefExpr.

* Using VariantKind then requires us to look past other VariantKind to see

	.weakref	bar,foo
	call	bar@PLT

  doing this also fixes

	zed = foo +2
	call zed@PLT

  so that is a good thing.

* Looking past VariantKind means that the relocation selection has to use
  the fixup instead of the target.

This is a reboot of the previous fixes for MC. I will watch the sanitizer
buildbot and wait for a build before adding back the previous fixes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204294 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 02:12:01 +00:00
..
CMakeLists.txt [CMake] Let add_public_tablegen_target responsible to provide dependency to CommonTableGen. 2013-11-28 17:04:04 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
Makefile
X86AsmBackend.cpp Simplify a really complicated check for Arch == X86_64. 2014-03-11 21:22:57 +00:00
X86BaseInfo.h Prune includes in X86 target. 2014-03-19 06:53:25 +00:00
X86ELFObjectWriter.cpp Look through variables when computing relocations. 2014-03-20 02:12:01 +00:00
X86ELFRelocationInfo.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-09 18:03:14 +00:00
X86FixupKinds.h Emacs-tag and some comment fix for all ARM, CellSPU, Hexagon, MBlaze, MSP430, PPC, PTX, Sparc, X86, XCore. 2012-02-18 12:03:15 +00:00
X86MachObjectWriter.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-09 18:03:14 +00:00
X86MachORelocationInfo.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-09 18:03:14 +00:00
X86MCAsmInfo.cpp Re-commit: Demote EmitRawText call in AsmPrinter::EmitInlineAsm() and remove hasRawTextSupport() call 2014-02-13 14:44:26 +00:00
X86MCAsmInfo.h [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-09 18:03:14 +00:00
X86MCCodeEmitter.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-09 18:03:14 +00:00
X86MCTargetDesc.cpp Support: split object format out of environment 2014-03-06 20:47:11 +00:00
X86MCTargetDesc.h Generate compact unwind encoding from CFI directives. 2013-09-09 02:37:14 +00:00
X86WinCOFFObjectWriter.cpp [C++11] Remove 'virtual' keyword from methods marked with 'override' keyword. 2014-03-10 05:29:18 +00:00