aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2015-06-14 15:45:45 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2015-06-14 15:45:45 +0000
commit59c03cf791569e424cafb5b2479662911815edbf (patch)
tree26d05f36c69f6ce182a143b094bdf6dc260e7abb
parenta83d904ec0503da30632e6495a63a8baae6c7c37 (diff)
downloadllvm-59c03cf791569e424cafb5b2479662911815edbf.zip
llvm-59c03cf791569e424cafb5b2479662911815edbf.tar.gz
llvm-59c03cf791569e424cafb5b2479662911815edbf.tar.bz2
Merging r238751:
------------------------------------------------------------------------ r238751 | rafael | 2015-06-01 16:10:51 +0100 (Mon, 01 Jun 2015) | 3 lines Fix relocation selection for foo-. on mips. This handles only the 32 bit case. ------------------------------------------------------------------------ llvm-svn: 239700
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp3
-rw-r--r--llvm/test/MC/Mips/relocation.s10
2 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
index 56aac4e..ec796a3 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
@@ -55,8 +55,7 @@ unsigned MipsELFObjectWriter::GetRelocType(const MCValue &Target,
default:
llvm_unreachable("invalid fixup kind!");
case FK_Data_4:
- Type = ELF::R_MIPS_32;
- break;
+ return IsPCRel ? ELF::R_MIPS_PC32 : ELF::R_MIPS_32;
case FK_Data_8:
Type = ELF::R_MIPS_64;
break;
diff --git a/llvm/test/MC/Mips/relocation.s b/llvm/test/MC/Mips/relocation.s
new file mode 100644
index 0000000..642b409
--- /dev/null
+++ b/llvm/test/MC/Mips/relocation.s
@@ -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