1
0
mirror of https://github.com/c64scene-ar/llvm-6502.git synced 2025-04-14 06:37:33 +00:00

Fix relocation selection for foo-. on mips.

This handles only the 32 bit case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238751 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-06-01 15:10:51 +00:00
parent 30e43fe1a9
commit 872808e946
2 changed files with 11 additions and 1 deletions
lib/Target/Mips/MCTargetDesc
test/MC/Mips

@ -70,7 +70,7 @@ unsigned MipsELFObjectWriter::GetRelocType(const MCValue &Target,
switch (Kind) {
case Mips::fixup_Mips_32:
case FK_Data_4:
return ELF::R_MIPS_32;
return IsPCRel ? ELF::R_MIPS_PC32 : ELF::R_MIPS_32;
case Mips::fixup_Mips_64:
case FK_Data_8:
return ELF::R_MIPS_64;

10
test/MC/Mips/relocation.s Normal file

@ -0,0 +1,10 @@
// RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux < %s | llvm-readobj -r | FileCheck %s
// Test that we produce the correct relocation.
// FIXME: move more relocation only tests here.
.long foo
// CHECK: R_MIPS_32 foo
.long foo-.
// CHECK: R_MIPS_PC32 foo