[ELF][MIPS] Fix mask used to parse MIPS 3-in-1 relocation packet

In isPreemptible routine we interested in R_MIPS_GPREL16 relocation
only. This relocation fits 0xf. So the new mask 0xff is just to conform
the ABI specification.

llvm-svn: 272388
This commit is contained in:
Simon Atanasyan 2016-06-10 12:26:09 +00:00
parent f4a5710a80
commit a26a157b0a
1 changed files with 2 additions and 2 deletions

View File

@ -72,11 +72,11 @@ static bool isPreemptible(const SymbolBody &Body, uint32_t Type) {
// if the target symbol is preemptible. There are two two MIPS GP-relative
// relocations R_MIPS_GPREL16 and R_MIPS_GPREL32. But only R_MIPS_GPREL16
// can be against a preemptible symbol.
// To get MIPS relocation type we apply 0xf mask. In case of O32 ABI all
// To get MIPS relocation type we apply 0xff mask. In case of O32 ABI all
// relocation types occupy eight bit. In case of N64 ABI we extract first
// relocation from 3-in-1 packet because only the first relocation can
// be against a real symbol.
if (Config->EMachine == EM_MIPS && (Type & 0xf) == R_MIPS_GPREL16)
if (Config->EMachine == EM_MIPS && (Type & 0xff) == R_MIPS_GPREL16)
return false;
return Body.isPreemptible();
}