mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
9eed3f671f
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. llvm-svn: 204294
21 lines
547 B
ArmAsm
21 lines
547 B
ArmAsm
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %s -o - | llvm-readobj -r | FileCheck --check-prefix=ELF %s
|
|
// RUN: llvm-mc -filetype=obj -triple x86_64-apple-darwin %s -o - | llvm-readobj -r | FileCheck --check-prefix=MACHO %s
|
|
|
|
|
|
bar = foo + 4
|
|
.globl bar
|
|
.long bar
|
|
|
|
// ELF: Relocations [
|
|
// ELF-NEXT: Section (2) .rela.text {
|
|
// ELF-NEXT: 0x0 R_X86_64_32 foo 0x4
|
|
// ELF-NEXT: }
|
|
// ELF-NEXT: ]
|
|
|
|
|
|
// MACHO: Relocations [
|
|
// MACHO: Section __text {
|
|
// MACHO: 0x0 0 2 1 X86_64_RELOC_UNSIGNED 0 bar
|
|
// MACHO: }
|
|
// MACHO: ]
|