@@ -60,6 +60,11 @@ static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
6060 case Mips::fixup_MIPS_PCLO16:
6161 Value &= 0xffff ;
6262 break ;
63+ case Mips::fixup_Mips_AnyImm16:
64+ if (!isInt<16 >(Value) && !isUInt<16 >(Value))
65+ Ctx.reportError (Fixup.getLoc (),
66+ " fixup value out of range [-32768, 65535]" );
67+ break ;
6368 case FK_DTPRel_4:
6469 case FK_DTPRel_8:
6570 case FK_TPRel_4:
@@ -351,16 +356,18 @@ std::optional<MCFixupKind> MipsAsmBackend::getFixupKind(StringRef Name) const {
351356const MCFixupKindInfo &MipsAsmBackend::
352357getFixupKindInfo (MCFixupKind Kind) const {
353358 const static MCFixupKindInfo LittleEndianInfos[] = {
354- // This table *must* be in same the order of fixup_* kinds in
355- // MipsFixupKinds.h.
356- //
357- // name offset bits flags
359+ // This table *must* be in same the order of fixup_* kinds in
360+ // MipsFixupKinds.h.
361+ //
362+ // name offset bits flags
363+ // clang-format off
358364 { " fixup_Mips_16" , 0 , 16 , 0 },
359365 { " fixup_Mips_32" , 0 , 32 , 0 },
360366 { " fixup_Mips_REL32" , 0 , 32 , 0 },
361367 { " fixup_Mips_26" , 0 , 26 , 0 },
362368 { " fixup_Mips_HI16" , 0 , 16 , 0 },
363369 { " fixup_Mips_LO16" , 0 , 16 , 0 },
370+ { " fixup_Mips_AnyImm16" , 0 , 16 , 0 },
364371 { " fixup_Mips_GPREL16" , 0 , 16 , 0 },
365372 { " fixup_Mips_LITERAL" , 0 , 16 , 0 },
366373 { " fixup_Mips_GOT" , 0 , 16 , 0 },
@@ -424,22 +431,24 @@ getFixupKindInfo(MCFixupKind Kind) const {
424431 { " fixup_Mips_SUB" , 0 , 64 , 0 },
425432 { " fixup_MICROMIPS_SUB" , 0 , 64 , 0 },
426433 { " fixup_Mips_JALR" , 0 , 32 , 0 },
427- { " fixup_MICROMIPS_JALR" , 0 , 32 , 0 }
434+ { " fixup_MICROMIPS_JALR" , 0 , 32 , 0 } // clang-format on
428435 };
429436 static_assert (std::size (LittleEndianInfos) == Mips::NumTargetFixupKinds,
430437 " Not all MIPS little endian fixup kinds added!" );
431438
432439 const static MCFixupKindInfo BigEndianInfos[] = {
433- // This table *must* be in same the order of fixup_* kinds in
434- // MipsFixupKinds.h.
435- //
436- // name offset bits flags
440+ // This table *must* be in same the order of fixup_* kinds in
441+ // MipsFixupKinds.h.
442+ //
443+ // name offset bits flags
444+ // clang-format off
437445 { " fixup_Mips_16" , 16 , 16 , 0 },
438446 { " fixup_Mips_32" , 0 , 32 , 0 },
439447 { " fixup_Mips_REL32" , 0 , 32 , 0 },
440448 { " fixup_Mips_26" , 6 , 26 , 0 },
441449 { " fixup_Mips_HI16" , 16 , 16 , 0 },
442450 { " fixup_Mips_LO16" , 16 , 16 , 0 },
451+ { " fixup_Mips_AnyImm16" , 16 , 16 , 0 },
443452 { " fixup_Mips_GPREL16" , 16 , 16 , 0 },
444453 { " fixup_Mips_LITERAL" , 16 , 16 , 0 },
445454 { " fixup_Mips_GOT" , 16 , 16 , 0 },
@@ -503,7 +512,7 @@ getFixupKindInfo(MCFixupKind Kind) const {
503512 { " fixup_Mips_SUB" , 0 , 64 , 0 },
504513 { " fixup_MICROMIPS_SUB" , 0 , 64 , 0 },
505514 { " fixup_Mips_JALR" , 0 , 32 , 0 },
506- { " fixup_MICROMIPS_JALR" , 0 , 32 , 0 }
515+ { " fixup_MICROMIPS_JALR" , 0 , 32 , 0 } // clang-format on
507516 };
508517 static_assert (std::size (BigEndianInfos) == Mips::NumTargetFixupKinds,
509518 " Not all MIPS big endian fixup kinds added!" );
0 commit comments