summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-03-31 19:00:23 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-03-31 19:00:23 +0000
commitee1c342ef97afeccd38eddacdb8bea8d99ed4070 (patch)
tree09f81256648d487c46497d0ea2d5ef19bf4d9b3e /llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
parentc0d21793be6d24d520562fc3b7f48e93b9a496f3 (diff)
downloadbcm5719-llvm-ee1c342ef97afeccd38eddacdb8bea8d99ed4070.tar.gz
bcm5719-llvm-ee1c342ef97afeccd38eddacdb8bea8d99ed4070.zip
Don't relocate with sections if there might be a paired relocation.
llvm-svn: 205240
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
index f933962d664..794978b30bf 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
@@ -206,9 +206,25 @@ MipsELFObjectWriter::needsRelocateWithSymbol(unsigned Type) const {
default:
return true;
- case ELF::R_MIPS_26:
- case ELF::R_MIPS_LO16:
+ case ELF::R_MIPS_GOT16:
+ case ELF::R_MIPS16_GOT16:
+ case ELF::R_MICROMIPS_GOT16:
+ llvm_unreachable("Should have been handled already");
+
+ // These relocations might be paired with another relocation. The pairing is
+ // done by the static linker by matching the symbol. Since we only see one
+ // relocation at a time, we have to force them to relocate with a symbol to
+ // avoid ending up with a pair where one points to a section and another
+ // points to a symbol.
case ELF::R_MIPS_HI16:
+ case ELF::R_MIPS16_HI16:
+ case ELF::R_MICROMIPS_HI16:
+ case ELF::R_MIPS_LO16:
+ case ELF::R_MIPS16_LO16:
+ case ELF::R_MICROMIPS_LO16:
+ return true;
+
+ case ELF::R_MIPS_26:
case ELF::R_MIPS_32:
case ELF::R_MIPS_64:
case ELF::R_MIPS_GPREL16:
OpenPOWER on IntegriCloud