diff options
author | Daniel Sanders <daniel.sanders@imgtec.com> | 2016-05-12 10:55:00 +0000 |
---|---|---|
committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2016-05-12 10:55:00 +0000 |
commit | 55d383319f94687e641603f66a639a673cd72eb7 (patch) | |
tree | e843b7339a32ff17a497df0cb40ce478aebf1e98 /llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp | |
parent | 10721435d62fa6212caaadedb7adf07c01e59abb (diff) | |
download | bcm5719-llvm-55d383319f94687e641603f66a639a673cd72eb7.tar.gz bcm5719-llvm-55d383319f94687e641603f66a639a673cd72eb7.zip |
[mips][ias] Handle N64 compound relocations and R_MIPS_SUB in needsRelocateWithSymbol()
Summary:
This eliminates the default case for N64 that was left out of r269047.
The change to R_MIPS_SUB is needed in this patch to make this testable since
%lo(%neg(%gp_rel(foo))) and %hi(%neg(%gp_rel(foo))) remain the only ways to get
a compound relocation from the assembler.
Reviewers: sdardis, rafael
Subscribers: dsanders, llvm-commits, sdardis
Differential Revision: http://reviews.llvm.org/D20097
llvm-svn: 269280
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp index 7887a144fb7..e47868db1a4 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp @@ -476,10 +476,12 @@ void MipsELFObjectWriter::sortRelocs(const MCAssembler &Asm, bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym, unsigned Type) const { - // This must be a compound relocation from the N64 ABI. - // FIXME: Return false iff all sub-relocations return false. + // If it's a compound relocation for N64 then we need the relocation if any + // sub-relocation needs it. if (!isUInt<8>(Type)) - return true; + return needsRelocateWithSymbol(Sym, Type & 0xff) || + needsRelocateWithSymbol(Sym, (Type >> 8) & 0xff) || + needsRelocateWithSymbol(Sym, (Type >> 16) & 0xff); switch (Type) { default: @@ -524,6 +526,7 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym, case ELF::R_MIPS_GPREL16: case ELF::R_MIPS_GPREL32: case ELF::R_MIPS_PC16: + case ELF::R_MIPS_SUB: return false; // FIXME: Many of these relocations should probably return false but this @@ -538,7 +541,6 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym, case ELF::R_MIPS_GOT_OFST: case ELF::R_MIPS_GOT_HI16: case ELF::R_MIPS_GOT_LO16: - case ELF::R_MIPS_SUB: case ELF::R_MIPS_INSERT_A: case ELF::R_MIPS_INSERT_B: case ELF::R_MIPS_DELETE: @@ -626,7 +628,6 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym, case ELF::R_MIPS16_TLS_TPREL_LO16: llvm_unreachable("Unsupported MIPS16 relocation"); return true; - } } |