summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2016-05-11 15:44:23 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2016-05-11 15:44:23 +0000
commit45533b4060c781a7925faec9f9a933e568e0480b (patch)
tree7c4758195af6072ccc9afe485660a0435befb9e2 /llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
parent79acc976ea001ce8138a191c8ab90562c8d9990a (diff)
downloadbcm5719-llvm-45533b4060c781a7925faec9f9a933e568e0480b.tar.gz
bcm5719-llvm-45533b4060c781a7925faec9f9a933e568e0480b.zip
[mips][ias] Work around incorrect microMIPS relocation evaluation exposed by r268900
microMIPS has a special case that is not correctly implemented in LLVM. If we have a symbol 'foo' which is equivalent to '.text+0x10'. The value of an R_MICROMIPS_LO16 relocation using 'foo' is 'foo+0x11' and not 'foo+0x10'. The in-place addend should therefore be 0x11. Work around this by partially reverting the effect of r268900 by keeping the symbol when the STO_MIPS_MICROMIPS flag is set. This fixes SingleSource/Regression/C/PR640 for microMIPS. llvm-svn: 269196
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
index 59313916965..7887a144fb7 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
@@ -507,6 +507,11 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
case ELF::R_MIPS_LO16:
case ELF::R_MIPS16_LO16:
case ELF::R_MICROMIPS_LO16:
+ // FIXME: It should be safe to return false for the STO_MIPS_MICROMIPS but
+ // we neglect to handle the adjustment to the LSB of the addend that
+ // it causes in applyFixup() and similar.
+ if (cast<MCSymbolELF>(Sym).getOther() & ELF::STO_MIPS_MICROMIPS)
+ return true;
return false;
case ELF::R_MIPS_16:
OpenPOWER on IntegriCloud