[llvm] r238751 - Fix relocation selection for foo-. on mips.
Rafael Espindola
rafael.espindola at gmail.com
Mon Jun 1 08:10:51 PDT 2015
Author: rafael
Date: Mon Jun 1 10:10:51 2015
New Revision: 238751
URL: http://llvm.org/viewvc/llvm-project?rev=238751&view=rev
Log:
Fix relocation selection for foo-. on mips.
This handles only the 32 bit case.
Added:
llvm/trunk/test/MC/Mips/relocation.s
Modified:
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp?rev=238751&r1=238750&r2=238751&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Mon Jun 1 10:10:51 2015
@@ -70,7 +70,7 @@ unsigned MipsELFObjectWriter::GetRelocTy
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;
Added: llvm/trunk/test/MC/Mips/relocation.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/relocation.s?rev=238751&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/relocation.s (added)
+++ llvm/trunk/test/MC/Mips/relocation.s Mon Jun 1 10:10:51 2015
@@ -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
More information about the llvm-commits
mailing list