[lld] r233088 - [Mips] Suppress "right shift by too large amount" warning

Simon Atanasyan simon at atanasyan.com
Tue Mar 24 08:49:59 PDT 2015


Author: atanasyan
Date: Tue Mar 24 10:49:59 2015
New Revision: 233088

URL: http://llvm.org/viewvc/llvm-project?rev=233088&view=rev
Log:
[Mips] Suppress "right shift by too large amount" warning

Visual C++ shows the "right shift by too large amount" warning if
`MipsELFReference` is instantiated for 32-bit target and `Elf_Rel_Impl::getType`
method has `unsigned char` return type. We can freely suppress the warning in
that case because MIPS 32-bit ABI does not pack multiple relocation types into
the single field `r_type` and the `MipsELFReference::_tag` should be always
zero in that case.

No functional changes.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=233088&r1=233087&r2=233088&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h Tue Mar 24 10:49:59 2015
@@ -101,13 +101,13 @@ public:
       : ELFReference<ELFT>(
             &rel, rel.r_offset - symValue, Reference::KindArch::Mips,
             rel.getType(_isMips64EL) & 0xff, rel.getSymbol(_isMips64EL)),
-        _tag(rel.getType(_isMips64EL) >> 8) {}
+        _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {}
 
   MipsELFReference(uint64_t symValue, const Elf_Rel &rel)
       : ELFReference<ELFT>(rel.r_offset - symValue, Reference::KindArch::Mips,
                            rel.getType(_isMips64EL) & 0xff,
                            rel.getSymbol(_isMips64EL)),
-        _tag(rel.getType(_isMips64EL) >> 8) {}
+        _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {}
 
   uint32_t tag() const override { return _tag; }
   void setTag(uint32_t tag) { _tag = tag; }





More information about the llvm-commits mailing list