Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Namespace

IMAGE

Public Namespace
std.coff.IMAGE
pub const IMAGE = struct

Namespaces

Types

File

coff.zig:1410
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
pub const IMAGE = struct {
    pub const DIRECTORY_ENTRY = enum(u32) {
        /// Export Directory
        EXPORT = 0,
        /// Import Directory
        IMPORT = 1,
        /// Resource Directory
        RESOURCE = 2,
        /// Exception Directory
        EXCEPTION = 3,
        /// Security Directory
        SECURITY = 4,
        /// Base Relocation Table
        BASERELOC = 5,
        /// Debug Directory
        DEBUG = 6,
        /// Architecture Specific Data
        ARCHITECTURE = 7,
        /// RVA of GP
        GLOBALPTR = 8,
        /// TLS Directory
        TLS = 9,
        /// Load Configuration Directory
        LOAD_CONFIG = 10,
        /// Bound Import Directory in headers
        BOUND_IMPORT = 11,
        /// Import Address Table
        IAT = 12,
        /// Delay Load Import Descriptors
        DELAY_IMPORT = 13,
        /// COM Runtime descriptor
        COM_DESCRIPTOR = 14,
        /// must be zero
        RESERVED = 15,
        _,

        pub const len = @typeInfo(IMAGE.DIRECTORY_ENTRY).@"enum".field_names.len;
    };

    pub const FILE = struct {
        /// Machine Types
        /// The Machine field has one of the following values, which specify the CPU type.
        /// An image file can be run only on the specified machine or on a system that emulates the specified machine.
        pub const MACHINE = enum(u16) {
            /// The content of this field is assumed to be applicable to any machine type
            UNKNOWN = 0x0,
            /// Alpha AXP, 32-bit address space
            ALPHA = 0x184,
            /// Alpha 64, 64-bit address space
            ALPHA64 = 0x284,
            /// Matsushita AM33
            AM33 = 0x1d3,
            /// x64
            AMD64 = 0x8664,
            /// ARM little endian
            ARM = 0x1c0,
            /// ARM64 little endian
            ARM64 = 0xaa64,
            /// ABI that enables interoperability between native ARM64 and emulated x64 code.
            ARM64EC = 0xA641,
            /// Binary format that allows both native ARM64 and ARM64EC code to coexist in the same file.
            ARM64X = 0xA64E,
            /// ARM Thumb-2 little endian
            ARMNT = 0x1c4,
            /// EFI byte code
            EBC = 0xebc,
            /// Intel 386 or later processors and compatible processors
            I386 = 0x14c,
            /// Intel Itanium processor family
            IA64 = 0x200,
            /// LoongArch 32-bit processor family
            LOONGARCH32 = 0x6232,
            /// LoongArch 64-bit processor family
            LOONGARCH64 = 0x6264,
            /// Mitsubishi M32R little endian
            M32R = 0x9041,
            /// MIPS16
            MIPS16 = 0x266,
            /// MIPS with FPU
            MIPSFPU = 0x366,
            /// MIPS16 with FPU
            MIPSFPU16 = 0x466,
            /// Power PC little endian
            POWERPC = 0x1f0,
            /// Power PC with floating point support
            POWERPCFP = 0x1f1,
            /// MIPS I compatible 32-bit big endian
            R3000BE = 0x160,
            /// MIPS I compatible 32-bit little endian
            R3000 = 0x162,
            /// MIPS III compatible 64-bit little endian
            R4000 = 0x166,
            /// MIPS IV compatible 64-bit little endian
            R10000 = 0x168,
            /// RISC-V 32-bit address space
            RISCV32 = 0x5032,
            /// RISC-V 64-bit address space
            RISCV64 = 0x5064,
            /// RISC-V 128-bit address space
            RISCV128 = 0x5128,
            /// Hitachi SH3
            SH3 = 0x1a2,
            /// Hitachi SH3 DSP
            SH3DSP = 0x1a3,
            /// Hitachi SH4
            SH4 = 0x1a6,
            /// Hitachi SH5
            SH5 = 0x1a8,
            /// Thumb
            THUMB = 0x1c2,
            /// MIPS little-endian WCE v2
            WCEMIPSV2 = 0x169,
            _,
            /// AXP 64 (Same as Alpha 64)
            pub const AXP64: IMAGE.FILE.MACHINE = .ALPHA64;

            pub fn RelocationType(comptime machine: IMAGE.FILE.MACHINE) type {
                return switch (machine) {
                    .AMD64,
                    => REL.AMD64,
                    .ARM,
                    .ARMNT,
                    => REL.ARM,
                    .ARM64,
                    .ARM64EC,
                    .ARM64X,
                    => REL.ARM64,
                    .I386 => REL.I386,
                    .IA64 => REL.IA64,
                    .M32R => REL.M32R,
                    .MIPS16,
                    .MIPSFPU,
                    .MIPSFPU16,
                    => REL.MIPS,
                    .POWERPC,
                    .POWERPCFP,
                    => REL.PPC,
                    .SH3,
                    .SH3DSP,
                    .SH4,
                    .SH5,
                    => REL.SH,
                    else => void,
                };
            }
        };
    };

    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,
            _,
        };
    };
}