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