[PATCH] [mips][microMIPS] Relocate with symbol for micromips function symbols
Zoran Jovanovic
zoran.jovanovic at imgtec.com
Mon Dec 29 07:44:47 PST 2014
Hi sstankovic,
Section name is not marked as microMIPS, thus for function symbols relocations should use symbol - not section name.
http://reviews.llvm.org/D6796
Files:
lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
test/MC/Mips/micromips-func-addr.s
Index: lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
===================================================================
--- lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
@@ -12,6 +12,7 @@
#include "MCTargetDesc/MipsMCTargetDesc.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCELFObjectWriter.h"
+#include "llvm/MC/MCELF.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCValue.h"
@@ -244,8 +245,14 @@
case ELF::R_MICROMIPS_LO16:
return true;
+ case ELF::R_MIPS_32: {
+ uint8_t Type = MCELF::GetType(SD);
+ if ((Type == ELF::STT_FUNC) &&
+ (MCELF::getOther(SD) & (ELF::STO_MIPS_MICROMIPS >> 2)))
+ return true;
+ }
+ // falltrough
case ELF::R_MIPS_26:
- case ELF::R_MIPS_32:
case ELF::R_MIPS_64:
case ELF::R_MIPS_GPREL16:
return false;
Index: test/MC/Mips/micromips-func-addr.s
===================================================================
--- /dev/null
+++ test/MC/Mips/micromips-func-addr.s
@@ -0,0 +1,11 @@
+# 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
+
+ .set micromips
+ .type bar, at function
+bar:
+ .4byte bar
+
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6796.17671.patch
Type: text/x-patch
Size: 1360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141229/a49c85fb/attachment.bin>
More information about the llvm-commits
mailing list