llvm-6502/lib/Target/SystemZ/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 [SystemZ] Add back end 2013-05-06 16:15:19 +00:00
Makefile [SystemZ] Add back end 2013-05-06 16:15:19 +00:00
SystemZMCAsmBackend.cpp [SystemZ] Remove "virtual" from override methods 2014-03-06 12:03:36 +00:00
SystemZMCAsmInfo.cpp Refactor the setting of PrivateGlobalPrefix. 2013-12-02 23:39:26 +00:00
SystemZMCAsmInfo.h [SystemZ] Remove "virtual" from override methods 2014-03-06 12:03:36 +00:00
SystemZMCCodeEmitter.cpp [SystemZ] Remove "virtual" from override methods 2014-03-06 12:03:36 +00:00
SystemZMCFixups.h [SystemZ] Update namespace formatting to match current guidelines 2014-03-06 10:38:30 +00:00
SystemZMCObjectWriter.cpp Look through variables when computing relocations. 2014-03-20 02:12:01 +00:00
SystemZMCTargetDesc.cpp Pass a MCSubtargetInfo down to the TargetStreamer creation. 2014-01-26 06:38:58 +00:00
SystemZMCTargetDesc.h [SystemZ] Update namespace formatting to match current guidelines 2014-03-06 10:38:30 +00:00