[llvm] r225008 - [mips][microMIPS] Relocate with symbol for micromips symbols

Zoran Jovanovic zoran.jovanovic at imgtec.com
Tue Dec 30 14:04:16 PST 2014


Author: zjovanovic
Date: Tue Dec 30 16:04:16 2014
New Revision: 225008

URL: http://llvm.org/viewvc/llvm-project?rev=225008&view=rev
Log:
[mips][microMIPS] Relocate with symbol for micromips symbols
Differential Revision: http://reviews.llvm.org/D6796

Added:
    llvm/trunk/test/MC/Mips/micromips-func-addr.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=225008&r1=225007&r2=225008&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Tue Dec 30 16:04:16 2014
@@ -11,6 +11,7 @@
 #include "MCTargetDesc/MipsFixupKinds.h"
 #include "MCTargetDesc/MipsMCTargetDesc.h"
 #include "llvm/MC/MCAssembler.h"
+#include "llvm/MC/MCELF.h"
 #include "llvm/MC/MCELFObjectWriter.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCSection.h"
@@ -244,8 +245,11 @@ MipsELFObjectWriter::needsRelocateWithSy
   case ELF::R_MICROMIPS_LO16:
     return true;
 
-  case ELF::R_MIPS_26:
   case ELF::R_MIPS_32:
+    if (MCELF::getOther(SD) & (ELF::STO_MIPS_MICROMIPS >> 2))
+      return true;
+    // falltrough
+  case ELF::R_MIPS_26:
   case ELF::R_MIPS_64:
   case ELF::R_MIPS_GPREL16:
     return false;

Added: llvm/trunk/test/MC/Mips/micromips-func-addr.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/micromips-func-addr.s?rev=225008&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/micromips-func-addr.s (added)
+++ llvm/trunk/test/MC/Mips/micromips-func-addr.s Tue Dec 30 16:04:16 2014
@@ -0,0 +1,16 @@
+# RUN: llvm-mc %s -filetype=obj -triple=mipsel-unknown-linux \
+# RUN: -mattr=micromips | llvm-readobj -r \
+# RUN: | FileCheck %s -check-prefix=CHECK
+# CHECK: Relocations [
+# CHECK:     0x0 R_MIPS_32 bar 0x0
+# CHECK:     0x4 R_MIPS_32 L1 0x0
+
+  .set    micromips
+  .type   bar, at function
+bar:
+L1:
+  nop
+  .data
+  .4byte bar 
+  .4byte L1 
+





More information about the llvm-commits mailing list