pub const REL = struct {
/// x64 Processors
/// The following relocation type indicators are defined for x64 and compatible processors.
pub const AMD64 = enum(u16) {
/// The relocation is ignored.
ABSOLUTE = 0x0000,
/// The 64-bit VA of the relocation target.
ADDR64 = 0x0001,
/// The 32-bit VA of the relocation target.
ADDR32 = 0x0002,
/// The 32-bit address without an image base (RVA).
ADDR32NB = 0x0003,
/// The 32-bit relative address from the byte following the relocation.
REL32 = 0x0004,
/// The 32-bit address relative to byte distance 1 from the relocation.
REL32_1 = 0x0005,
/// The 32-bit address relative to byte distance 2 from the relocation.
REL32_2 = 0x0006,
/// The 32-bit address relative to byte distance 3 from the relocation.
REL32_3 = 0x0007,
/// The 32-bit address relative to byte distance 4 from the relocation.
REL32_4 = 0x0008,
/// The 32-bit address relative to byte distance 5 from the relocation.
REL32_5 = 0x0009,
/// The 16-bit section index of the section that contains the target.
/// This is used to support debugging information.
SECTION = 0x000A,
/// The 32-bit offset of the target from the beginning of its section.
/// This is used to support debugging information and static thread local storage.
SECREL = 0x000B,
/// A 7-bit unsigned offset from the base of the section that contains the target.
SECREL7 = 0x000C,
/// CLR tokens.
TOKEN = 0x000D,
/// A 32-bit signed span-dependent value emitted into the object.
SREL32 = 0x000E,
/// A pair that must immediately follow every span-dependent value.
PAIR = 0x000F,
/// A 32-bit signed span-dependent value that is applied at link time.
SSPAN32 = 0x0010,
_,
};
/// ARM Processors
/// The following relocation type indicators are defined for ARM processors.
pub const ARM = enum(u16) {
/// The relocation is ignored.
ABSOLUTE = 0x0000,
/// The 32-bit VA of the target.
ADDR32 = 0x0001,
/// The 32-bit RVA of the target.
ADDR32NB = 0x0002,
/// The 24-bit relative displacement to the target.
BRANCH24 = 0x0003,
/// The reference to a subroutine call.
/// The reference consists of two 16-bit instructions with 11-bit offsets.
BRANCH11 = 0x0004,
/// The 32-bit relative address from the byte following the relocation.
REL32 = 0x000A,
/// The 16-bit section index of the section that contains the target.
/// This is used to support debugging information.
SECTION = 0x000E,
/// The 32-bit offset of the target from the beginning of its section.
/// This is used to support debugging information and static thread local storage.
SECREL = 0x000F,
/// The 32-bit VA of the target.
/// This relocation is applied using a MOVW instruction for the low 16 bits followed by a MOVT for the high 16 bits.
MOV32 = 0x0010,
/// The 32-bit VA of the target.
/// This relocation is applied using a MOVW instruction for the low 16 bits followed by a MOVT for the high 16 bits.
THUMB_MOV32 = 0x0011,
/// The instruction is fixed up with the 21-bit relative displacement to the 2-byte aligned target.
/// The least significant bit of the displacement is always zero and is not stored.
/// This relocation corresponds to a Thumb-2 32-bit conditional B instruction.
THUMB_BRANCH20 = 0x0012,
Unused = 0x0013,
/// The instruction is fixed up with the 25-bit relative displacement to the 2-byte aligned target.
/// The least significant bit of the displacement is zero and is not stored.This relocation corresponds to a Thumb-2 B instruction.
THUMB_BRANCH24 = 0x0014,
/// The instruction is fixed up with the 25-bit relative displacement to the 4-byte aligned target.
/// The low 2 bits of the displacement are zero and are not stored.
/// This relocation corresponds to a Thumb-2 BLX instruction.
THUMB_BLX23 = 0x0015,
/// The relocation is valid only when it immediately follows a ARM_REFHI or THUMB_REFHI.
/// Its SymbolTableIndex contains a displacement and not an index into the symbol table.
PAIR = 0x0016,
_,
};
/// ARM64 Processors
/// The following relocation type indicators are defined for ARM64 processors.
pub const ARM64 = enum(u16) {
/// The relocation is ignored.
ABSOLUTE = 0x0000,
/// The 32-bit VA of the target.
ADDR32 = 0x0001,
/// The 32-bit RVA of the target.
ADDR32NB = 0x0002,
/// The 26-bit relative displacement to the target, for B and BL instructions.
BRANCH26 = 0x0003,
/// The page base of the target, for ADRP instruction.
PAGEBASE_REL21 = 0x0004,
/// The 12-bit relative displacement to the target, for instruction ADR
REL21 = 0x0005,
/// The 12-bit page offset of the target, for instructions ADD/ADDS (immediate) with zero shift.
PAGEOFFSET_12A = 0x0006,
/// The 12-bit page offset of the target, for instruction LDR (indexed, unsigned immediate).
PAGEOFFSET_12L = 0x0007,
/// The 32-bit offset of the target from the beginning of its section.
/// This is used to support debugging information and static thread local storage.
SECREL = 0x0008,
/// Bit 0:11 of section offset of the target, for instructions ADD/ADDS (immediate) with zero shift.
SECREL_LOW12A = 0x0009,
/// Bit 12:23 of section offset of the target, for instructions ADD/ADDS (immediate) with zero shift.
SECREL_HIGH12A = 0x000A,
/// Bit 0:11 of section offset of the target, for instruction LDR (indexed, unsigned immediate).
SECREL_LOW12L = 0x000B,
/// CLR token.
TOKEN = 0x000C,
/// The 16-bit section index of the section that contains the target.
/// This is used to support debugging information.
SECTION = 0x000D,
/// The 64-bit VA of the relocation target.
ADDR64 = 0x000E,
/// The 19-bit offset to the relocation target, for conditional B instruction.
BRANCH19 = 0x000F,
/// The 14-bit offset to the relocation target, for instructions TBZ and TBNZ.
BRANCH14 = 0x0010,
/// The 32-bit relative address from the byte following the relocation.
REL32 = 0x0011,
_,
};
/// Hitachi SuperH Processors
/// The following relocation type indicators are defined for SH3 and SH4 processors.
/// SH5-specific relocations are noted as SHM (SH Media).
pub const SH = enum(u16) {
/// The relocation is ignored.
@"3_ABSOLUTE" = 0x0000,
/// A reference to the 16-bit location that contains the VA of the target symbol.
@"3_DIRECT16" = 0x0001,
/// The 32-bit VA of the target symbol.
@"3_DIRECT32" = 0x0002,
/// A reference to the 8-bit location that contains the VA of the target symbol.
@"3_DIRECT8" = 0x0003,
/// A reference to the 8-bit instruction that contains the effective 16-bit VA of the target symbol.
@"3_DIRECT8_WORD" = 0x0004,
/// A reference to the 8-bit instruction that contains the effective 32-bit VA of the target symbol.
@"3_DIRECT8_LONG" = 0x0005,
/// A reference to the 8-bit location whose low 4 bits contain the VA of the target symbol.
@"3_DIRECT4" = 0x0006,
/// A reference to the 8-bit instruction whose low 4 bits contain the effective 16-bit VA of the target symbol.
@"3_DIRECT4_WORD" = 0x0007,
/// A reference to the 8-bit instruction whose low 4 bits contain the effective 32-bit VA of the target symbol.
@"3_DIRECT4_LONG" = 0x0008,
/// A reference to the 8-bit instruction that contains the effective 16-bit relative offset of the target symbol.
@"3_PCREL8_WORD" = 0x0009,
/// A reference to the 8-bit instruction that contains the effective 32-bit relative offset of the target symbol.
@"3_PCREL8_LONG" = 0x000A,
/// A reference to the 16-bit instruction whose low 12 bits contain the effective 16-bit relative offset of the target symbol.
@"3_PCREL12_WORD" = 0x000B,
/// A reference to a 32-bit location that is the VA of the section that contains the target symbol.
@"3_STARTOF_SECTION" = 0x000C,
/// A reference to the 32-bit location that is the size of the section that contains the target symbol.
@"3_SIZEOF_SECTION" = 0x000D,
/// The 16-bit section index of the section that contains the target.
/// This is used to support debugging information.
@"3_SECTION" = 0x000E,
/// The 32-bit offset of the target from the beginning of its section.
/// This is used to support debugging information and static thread local storage.
@"3_SECREL" = 0x000F,
/// The 32-bit RVA of the target symbol.
@"3_DIRECT32_NB" = 0x0010,
/// GP relative.
@"3_GPREL4_LONG" = 0x0011,
/// CLR token.
@"3_TOKEN" = 0x0012,
/// The offset from the current instruction in longwords.
/// If the NOMODE bit is not set, insert the inverse of the low bit at bit 32 to select PTA or PTB.
M_PCRELPT = 0x0013,
/// The low 16 bits of the 32-bit address.
M_REFLO = 0x0014,
/// The high 16 bits of the 32-bit address.
M_REFHALF = 0x0015,
/// The low 16 bits of the relative address.
M_RELLO = 0x0016,
/// The high 16 bits of the relative address.
M_RELHALF = 0x0017,
/// The relocation is valid only when it immediately follows a REFHALF, RELHALF, or RELLO relocation.
/// The SymbolTableIndex field of the relocation contains a displacement and not an index into the symbol table.
M_PAIR = 0x0018,
/// The relocation ignores section mode.
M_NOMODE = 0x8000,
_,
};
/// IBM PowerPC Processors
/// The following relocation type indicators are defined for PowerPC processors.
pub const PPC = enum(u16) {
/// The relocation is ignored.
ABSOLUTE = 0x0000,
/// The 64-bit VA of the target.
ADDR64 = 0x0001,
/// The 32-bit VA of the target.
ADDR32 = 0x0002,
/// The low 24 bits of the VA of the target.
/// This is valid only when the target symbol is absolute and can be sign-extended to its original value.
ADDR24 = 0x0003,
/// The low 16 bits of the target's VA.
ADDR16 = 0x0004,
/// The low 14 bits of the target's VA.
/// This is valid only when the target symbol is absolute and can be sign-extended to its original value.
ADDR14 = 0x0005,
/// A 24-bit PC-relative offset to the symbol's location.
REL24 = 0x0006,
/// A 14-bit PC-relative offset to the symbol's location.
REL14 = 0x0007,
/// The 32-bit RVA of the target.
ADDR32NB = 0x000A,
/// The 32-bit offset of the target from the beginning of its section.
/// This is used to support debugging information and static thread local storage.
SECREL = 0x000B,
/// The 16-bit section index of the section that contains the target.
/// This is used to support debugging information.
SECTION = 0x000C,
/// The 16-bit offset of the target from the beginning of its section.
/// This is used to support debugging information and static thread local storage.
SECREL16 = 0x000F,
/// The high 16 bits of the target's 32-bit VA.
/// This is used for the first instruction in a two-instruction sequence that loads a full address.
/// This relocation must be immediately followed by a PAIR relocation whose SymbolTableIndex contains a signed 16-bit displacement that is added to the upper 16 bits that was taken from the location that is being relocated.
REFHI = 0x0010,
/// The low 16 bits of the target's VA.
REFLO = 0x0011,
/// A relocation that is valid only when it immediately follows a REFHI or SECRELHI relocation.
/// Its SymbolTableIndex contains a displacement and not an index into the symbol table.
PAIR = 0x0012,
/// The low 16 bits of the 32-bit offset of the target from the beginning of its section.
SECRELLO = 0x0013,
/// The 16-bit signed displacement of the target relative to the GP register.
GPREL = 0x0015,
/// The CLR token.
TOKEN = 0x0016,
_,
};
/// Intel 386 Processors
/// The following relocation type indicators are defined for Intel 386 and compatible processors.
pub const I386 = enum(u16) {
/// The relocation is ignored.
ABSOLUTE = 0x0000,
/// Not supported.
DIR16 = 0x0001,
/// Not supported.
REL16 = 0x0002,
/// The target's 32-bit VA.
DIR32 = 0x0006,
/// The target's 32-bit RVA.
DIR32NB = 0x0007,
/// Not supported.
SEG12 = 0x0009,
/// The 16-bit section index of the section that contains the target.
/// This is used to support debugging information.
SECTION = 0x000A,
/// The 32-bit offset of the target from the beginning of its section.
/// This is used to support debugging information and static thread local storage.
SECREL = 0x000B,
/// The CLR token.
TOKEN = 0x000C,
/// A 7-bit offset from the base of the section that contains the target.
SECREL7 = 0x000D,
/// The 32-bit relative displacement to the target.
/// This supports the x86 relative branch and call instructions.
REL32 = 0x0014,
_,
};
/// Intel Itanium Processor Family (IPF)
/// The following relocation type indicators are defined for the Intel Itanium processor family and compatible processors.
/// Note that relocations on instructions use the bundle's offset and slot number for the relocation offset.
pub const IA64 = enum(u16) {
/// The relocation is ignored.
ABSOLUTE = 0x0000,
/// The instruction relocation can be followed by an ADDEND relocation whose value is added to the target address before it is inserted into the specified slot in the IMM14 bundle.
/// The relocation target must be absolute or the image must be fixed.
IMM14 = 0x0001,
/// The instruction relocation can be followed by an ADDEND relocation whose value is added to the target address before it is inserted into the specified slot in the IMM22 bundle.
/// The relocation target must be absolute or the image must be fixed.
IMM22 = 0x0002,
/// The slot number of this relocation must be one (1).
/// The relocation can be followed by an ADDEND relocation whose value is added to the target address before it is stored in all three slots of the IMM64 bundle.
IMM64 = 0x0003,
/// The target's 32-bit VA.
/// This is supported only for /LARGEADDRESSAWARE:NO images.
DIR32 = 0x0004,
/// The target's 64-bit VA.
DIR64 = 0x0005,
/// The instruction is fixed up with the 25-bit relative displacement to the 16-bit aligned target.
/// The low 4 bits of the displacement are zero and are not stored.
PCREL21B = 0x0006,
/// The instruction is fixed up with the 25-bit relative displacement to the 16-bit aligned target.
/// The low 4 bits of the displacement, which are zero, are not stored.
PCREL21M = 0x0007,
/// The LSBs of this relocation's offset must contain the slot number whereas the rest is the bundle address.
/// The bundle is fixed up with the 25-bit relative displacement to the 16-bit aligned target.
/// The low 4 bits of the displacement are zero and are not stored.
PCREL21F = 0x0008,
/// The instruction relocation can be followed by an ADDEND relocation whose value is added to the target address and then a 22-bit GP-relative offset that is calculated and applied to the GPREL22 bundle.
GPREL22 = 0x0009,
/// The instruction is fixed up with the 22-bit GP-relative offset to the target symbol's literal table entry.
/// The linker creates this literal table entry based on this relocation and the ADDEND relocation that might follow.
LTOFF22 = 0x000A,
/// The 16-bit section index of the section contains the target.
/// This is used to support debugging information.
SECTION = 0x000B,
/// The instruction is fixed up with the 22-bit offset of the target from the beginning of its section.
/// This relocation can be followed immediately by an ADDEND relocation, whose Value field contains the 32-bit unsigned offset of the target from the beginning of the section.
SECREL22 = 0x000C,
/// The slot number for this relocation must be one (1).
/// The instruction is fixed up with the 64-bit offset of the target from the beginning of its section.
/// This relocation can be followed immediately by an ADDEND relocation whose Value field contains the 32-bit unsigned offset of the target from the beginning of the section.
SECREL64I = 0x000D,
/// The address of data to be fixed up with the 32-bit offset of the target from the beginning of its section.
SECREL32 = 0x000E,
/// The target's 32-bit RVA.
DIR32NB = 0x0010,
/// This is applied to a signed 14-bit immediate that contains the difference between two relocatable targets.
/// This is a declarative field for the linker that indicates that the compiler has already emitted this value.
SREL14 = 0x0011,
/// This is applied to a signed 22-bit immediate that contains the difference between two relocatable targets.
/// This is a declarative field for the linker that indicates that the compiler has already emitted this value.
SREL22 = 0x0012,
/// This is applied to a signed 32-bit immediate that contains the difference between two relocatable values.
/// This is a declarative field for the linker that indicates that the compiler has already emitted this value.
SREL32 = 0x0013,
/// This is applied to an unsigned 32-bit immediate that contains the difference between two relocatable values.
/// This is a declarative field for the linker that indicates that the compiler has already emitted this value.
UREL32 = 0x0014,
/// A 60-bit PC-relative fixup that always stays as a BRL instruction of an MLX bundle.
PCREL60X = 0x0015,
/// A 60-bit PC-relative fixup.
/// If the target displacement fits in a signed 25-bit field, convert the entire bundle to an MBB bundle with NOP.B in slot 1 and a 25-bit BR instruction (with the 4 lowest bits all zero and dropped) in slot 2.
PCREL60B = 0x0016,
/// A 60-bit PC-relative fixup.
/// If the target displacement fits in a signed 25-bit field, convert the entire bundle to an MFB bundle with NOP.F in slot 1 and a 25-bit (4 lowest bits all zero and dropped) BR instruction in slot 2.
PCREL60F = 0x0017,
/// A 60-bit PC-relative fixup.
/// If the target displacement fits in a signed 25-bit field, convert the entire bundle to an MIB bundle with NOP.I in slot 1 and a 25-bit (4 lowest bits all zero and dropped) BR instruction in slot 2.
PCREL60I = 0x0018,
/// A 60-bit PC-relative fixup.
/// If the target displacement fits in a signed 25-bit field, convert the entire bundle to an MMB bundle with NOP.M in slot 1 and a 25-bit (4 lowest bits all zero and dropped) BR instruction in slot 2.
PCREL60M = 0x0019,
/// A 64-bit GP-relative fixup.
IMMGPREL64 = 0x001a,
/// A CLR token.
TOKEN = 0x001b,
/// A 32-bit GP-relative fixup.
GPREL32 = 0x001c,
/// The relocation is valid only when it immediately follows one of the following relocations: IMM14, IMM22, IMM64, GPREL22, LTOFF22, LTOFF64, SECREL22, SECREL64I, or SECREL32.
/// Its value contains the addend to apply to instructions within a bundle, not for data.
ADDEND = 0x001F,
_,
};
/// MIPS Processors
/// The following relocation type indicators are defined for MIPS processors.
pub const MIPS = enum(u16) {
/// The relocation is ignored.
ABSOLUTE = 0x0000,
/// The high 16 bits of the target's 32-bit VA.
REFHALF = 0x0001,
/// The target's 32-bit VA.
REFWORD = 0x0002,
/// The low 26 bits of the target's VA.
/// This supports the MIPS J and JAL instructions.
JMPADDR = 0x0003,
/// The high 16 bits of the target's 32-bit VA.
/// This is used for the first instruction in a two-instruction sequence that loads a full address.
/// This relocation must be immediately followed by a PAIR relocation whose SymbolTableIndex contains a signed 16-bit displacement that is added to the upper 16 bits that are taken from the location that is being relocated.
REFHI = 0x0004,
/// The low 16 bits of the target's VA.
REFLO = 0x0005,
/// A 16-bit signed displacement of the target relative to the GP register.
GPREL = 0x0006,
/// The same as IMAGE_REL_MIPS_GPREL.
LITERAL = 0x0007,
/// The 16-bit section index of the section contains the target.
/// This is used to support debugging information.
SECTION = 0x000A,
/// The 32-bit offset of the target from the beginning of its section.
/// This is used to support debugging information and static thread local storage.
SECREL = 0x000B,
/// The low 16 bits of the 32-bit offset of the target from the beginning of its section.
SECRELLO = 0x000C,
/// The high 16 bits of the 32-bit offset of the target from the beginning of its section.
/// An IMAGE_REL_MIPS_PAIR relocation must immediately follow this one.
/// The SymbolTableIndex of the PAIR relocation contains a signed 16-bit displacement that is added to the upper 16 bits that are taken from the location that is being relocated.
SECRELHI = 0x000D,
/// The low 26 bits of the target's VA.
/// This supports the MIPS16 JAL instruction.
JMPADDR16 = 0x0010,
/// The target's 32-bit RVA.
REFWORDNB = 0x0022,
/// The relocation is valid only when it immediately follows a REFHI or SECRELHI relocation.
/// Its SymbolTableIndex contains a displacement and not an index into the symbol table.
PAIR = 0x0025,
_,
};
/// Mitsubishi M32R
/// The following relocation type indicators are defined for the Mitsubishi M32R processors.
pub const M32R = enum(u16) {
/// The relocation is ignored.
ABSOLUTE = 0x0000,
/// The target's 32-bit VA.
ADDR32 = 0x0001,
/// The target's 32-bit RVA.
ADDR32NB = 0x0002,
/// The target's 24-bit VA.
ADDR24 = 0x0003,
/// The target's 16-bit offset from the GP register.
GPREL16 = 0x0004,
/// The target's 24-bit offset from the program counter (PC), shifted left by 2 bits and sign-extended
PCREL24 = 0x0005,
/// The target's 16-bit offset from the PC, shifted left by 2 bits and sign-extended
PCREL16 = 0x0006,
/// The target's 8-bit offset from the PC, shifted left by 2 bits and sign-extended
PCREL8 = 0x0007,
/// The 16 MSBs of the target VA.
REFHALF = 0x0008,
/// The 16 MSBs of the target VA, adjusted for LSB sign extension.
/// This is used for the first instruction in a two-instruction sequence that loads a full 32-bit address.
/// This relocation must be immediately followed by a PAIR relocation whose SymbolTableIndex contains a signed 16-bit displacement that is added to the upper 16 bits that are taken from the location that is being relocated.
REFHI = 0x0009,
/// The 16 LSBs of the target VA.
REFLO = 0x000A,
/// The relocation must follow the REFHI relocation.
/// Its SymbolTableIndex contains a displacement and not an index into the symbol table.
PAIR = 0x000B,
/// The 16-bit section index of the section that contains the target.
/// This is used to support debugging information.
SECTION = 0x000C,
/// The 32-bit offset of the target from the beginning of its section.
/// This is used to support debugging information and static thread local storage.
SECREL = 0x000D,
/// The CLR token.
TOKEN = 0x000E,
_,
};
}