[mips][microMIPS] Relocate with symbol for micromips symbols

Differential Revision: http://reviews.llvm.org/D6796


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225008 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zoran Jovanovic 2014-12-30 22:04:16 +00:00
parent ab63a4c95e
commit 25547ee83c
2 changed files with 21 additions and 1 deletions

View File

@ -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::needsRelocateWithSymbol(const MCSymbolData &SD,
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;

View File

@ -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,@function
bar:
L1:
nop
.data
.4byte bar
.4byte L1