[llvm] r269294 - [mips][ias] Work around incorrect another microMIPS relocation evaluation exposed by r268900
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Thu May 12 06:39:13 PDT 2016
Author: dsanders
Date: Thu May 12 08:39:13 2016
New Revision: 269294
URL: http://llvm.org/viewvc/llvm-project?rev=269294&view=rev
Log:
[mips][ias] Work around incorrect another microMIPS relocation evaluation exposed by r268900
As explained in r269196, 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.
This commit reverts a little more of the effect of r268900 by keeping the
symbol when the STO_MIPS_MICROMIPS flag is set for R_MIPS_GPREL32 relocations.
This fixes SingleSource/UnitTests/2003-08-11-VaListArg, and
SingleSource/UnitTests/2003-05-07-VarArgs for microMIPS.
I believe there are additional relocations that have the same issue (e.g.
R_MIPS_64, and R_MIPS_GPREL16) but for now I'm focusing on restoring our
internal buildbots back to the green state we had in r268899.
Modified:
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
llvm/trunk/test/MC/Mips/relocation-xfail.s
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=269294&r1=269293&r2=269294&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Thu May 12 08:39:13 2016
@@ -518,13 +518,13 @@ bool MipsELFObjectWriter::needsRelocateW
case ELF::R_MIPS_16:
case ELF::R_MIPS_32:
+ case ELF::R_MIPS_GPREL32:
if (cast<MCSymbolELF>(Sym).getOther() & ELF::STO_MIPS_MICROMIPS)
return true;
// fallthrough
case ELF::R_MIPS_26:
case ELF::R_MIPS_64:
case ELF::R_MIPS_GPREL16:
- case ELF::R_MIPS_GPREL32:
case ELF::R_MIPS_PC16:
case ELF::R_MIPS_SUB:
return false;
Modified: llvm/trunk/test/MC/Mips/relocation-xfail.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/relocation-xfail.s?rev=269294&r1=269293&r2=269294&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/relocation-xfail.s (original)
+++ llvm/trunk/test/MC/Mips/relocation-xfail.s Thu May 12 08:39:13 2016
@@ -9,12 +9,21 @@
// baz is equivalent to .text+0x8 and is recorded in the symbol table as such
// but it refers to microMIPS code so the addend must indicate this in the LSB.
// The addend must therefore be 0x9.
+// DATA-LABEL: Name: .text
+// DATA: SectionData (
// DATA: 0000: 30430000 30420009
addiu $2, $3, %got(baz)
addiu $2, $2, %lo(baz)
baz:
+// DATA-LABEL: Name: .data
+// DATA: SectionData (
.data
.word 0
bar:
.word 1
+// baz is equivalent to .text+0x8 and is recorded in the symbol table as such
+// but it refers to microMIPS code so the addend must indicate this in the LSB.
+// The addend must therefore be 0x9.
+// DATA: 0000: 00000000 00000001 00000009
+ .gpword baz
More information about the llvm-commits
mailing list