Warning, /include/llvm/BinaryFormat/ELFRelocs/LoongArch.def is written in an unsupported language. File is not indexed.
0001 #ifndef ELF_RELOC
0002 #error "ELF_RELOC must be defined"
0003 #endif
0004
0005 // These types and values are from the LoongArch ELF psABI which can be found at
0006 // https://github.com/loongson/LoongArch-Documentation
0007 // and these definitions has been adopted by binutils (include/elf/loongarch.h).
0008 // The commit hash (main branch) we reference is:
0009 // 9b3bd9f4a497115913c22f1a2a47863798fbc02a
0010
0011 ELF_RELOC(R_LARCH_NONE, 0)
0012 ELF_RELOC(R_LARCH_32, 1)
0013 ELF_RELOC(R_LARCH_64, 2)
0014 ELF_RELOC(R_LARCH_RELATIVE, 3)
0015 ELF_RELOC(R_LARCH_COPY, 4)
0016 ELF_RELOC(R_LARCH_JUMP_SLOT, 5)
0017 ELF_RELOC(R_LARCH_TLS_DTPMOD32, 6)
0018 ELF_RELOC(R_LARCH_TLS_DTPMOD64, 7)
0019 ELF_RELOC(R_LARCH_TLS_DTPREL32, 8)
0020 ELF_RELOC(R_LARCH_TLS_DTPREL64, 9)
0021 ELF_RELOC(R_LARCH_TLS_TPREL32, 10)
0022 ELF_RELOC(R_LARCH_TLS_TPREL64, 11)
0023 ELF_RELOC(R_LARCH_IRELATIVE, 12)
0024 ELF_RELOC(R_LARCH_MARK_LA, 20)
0025 ELF_RELOC(R_LARCH_MARK_PCREL, 21)
0026 ELF_RELOC(R_LARCH_SOP_PUSH_PCREL, 22)
0027 ELF_RELOC(R_LARCH_SOP_PUSH_ABSOLUTE, 23)
0028 ELF_RELOC(R_LARCH_SOP_PUSH_DUP, 24)
0029 ELF_RELOC(R_LARCH_SOP_PUSH_GPREL, 25)
0030 ELF_RELOC(R_LARCH_SOP_PUSH_TLS_TPREL, 26)
0031 ELF_RELOC(R_LARCH_SOP_PUSH_TLS_GOT, 27)
0032 ELF_RELOC(R_LARCH_SOP_PUSH_TLS_GD, 28)
0033 ELF_RELOC(R_LARCH_SOP_PUSH_PLT_PCREL, 29)
0034 ELF_RELOC(R_LARCH_SOP_ASSERT, 30)
0035 ELF_RELOC(R_LARCH_SOP_NOT, 31)
0036 ELF_RELOC(R_LARCH_SOP_SUB, 32)
0037 ELF_RELOC(R_LARCH_SOP_SL, 33)
0038 ELF_RELOC(R_LARCH_SOP_SR, 34)
0039 ELF_RELOC(R_LARCH_SOP_ADD, 35)
0040 ELF_RELOC(R_LARCH_SOP_AND, 36)
0041 ELF_RELOC(R_LARCH_SOP_IF_ELSE, 37)
0042 ELF_RELOC(R_LARCH_SOP_POP_32_S_10_5, 38)
0043 ELF_RELOC(R_LARCH_SOP_POP_32_U_10_12, 39)
0044 ELF_RELOC(R_LARCH_SOP_POP_32_S_10_12, 40)
0045 ELF_RELOC(R_LARCH_SOP_POP_32_S_10_16, 41)
0046 ELF_RELOC(R_LARCH_SOP_POP_32_S_10_16_S2, 42)
0047 ELF_RELOC(R_LARCH_SOP_POP_32_S_5_20, 43)
0048 ELF_RELOC(R_LARCH_SOP_POP_32_S_0_5_10_16_S2, 44)
0049 ELF_RELOC(R_LARCH_SOP_POP_32_S_0_10_10_16_S2, 45)
0050 ELF_RELOC(R_LARCH_SOP_POP_32_U, 46)
0051 ELF_RELOC(R_LARCH_ADD8, 47)
0052 ELF_RELOC(R_LARCH_ADD16, 48)
0053 ELF_RELOC(R_LARCH_ADD24, 49)
0054 ELF_RELOC(R_LARCH_ADD32, 50)
0055 ELF_RELOC(R_LARCH_ADD64, 51)
0056 ELF_RELOC(R_LARCH_SUB8, 52)
0057 ELF_RELOC(R_LARCH_SUB16, 53)
0058 ELF_RELOC(R_LARCH_SUB24, 54)
0059 ELF_RELOC(R_LARCH_SUB32, 55)
0060 ELF_RELOC(R_LARCH_SUB64, 56)
0061 ELF_RELOC(R_LARCH_GNU_VTINHERIT, 57)
0062 ELF_RELOC(R_LARCH_GNU_VTENTRY, 58)
0063
0064 // Relocs whose processing do not require a stack machine.
0065 //
0066 // Spec addition: https://github.com/loongson/LoongArch-Documentation/pull/57
0067 // Binutils commit 6d13722a97cee3fd397e116bde3bcedbb1e220be
0068 // and commit 9801120721c3a702ce3bd50433ef920f92a83502
0069 ELF_RELOC(R_LARCH_B16, 64)
0070 ELF_RELOC(R_LARCH_B21, 65)
0071 ELF_RELOC(R_LARCH_B26, 66)
0072 ELF_RELOC(R_LARCH_ABS_HI20, 67)
0073 ELF_RELOC(R_LARCH_ABS_LO12, 68)
0074 ELF_RELOC(R_LARCH_ABS64_LO20, 69)
0075 ELF_RELOC(R_LARCH_ABS64_HI12, 70)
0076 ELF_RELOC(R_LARCH_PCALA_HI20, 71)
0077 ELF_RELOC(R_LARCH_PCALA_LO12, 72)
0078 ELF_RELOC(R_LARCH_PCALA64_LO20, 73)
0079 ELF_RELOC(R_LARCH_PCALA64_HI12, 74)
0080 ELF_RELOC(R_LARCH_GOT_PC_HI20, 75)
0081 ELF_RELOC(R_LARCH_GOT_PC_LO12, 76)
0082 ELF_RELOC(R_LARCH_GOT64_PC_LO20, 77)
0083 ELF_RELOC(R_LARCH_GOT64_PC_HI12, 78)
0084 ELF_RELOC(R_LARCH_GOT_HI20, 79)
0085 ELF_RELOC(R_LARCH_GOT_LO12, 80)
0086 ELF_RELOC(R_LARCH_GOT64_LO20, 81)
0087 ELF_RELOC(R_LARCH_GOT64_HI12, 82)
0088 ELF_RELOC(R_LARCH_TLS_LE_HI20, 83)
0089 ELF_RELOC(R_LARCH_TLS_LE_LO12, 84)
0090 ELF_RELOC(R_LARCH_TLS_LE64_LO20, 85)
0091 ELF_RELOC(R_LARCH_TLS_LE64_HI12, 86)
0092 ELF_RELOC(R_LARCH_TLS_IE_PC_HI20, 87)
0093 ELF_RELOC(R_LARCH_TLS_IE_PC_LO12, 88)
0094 ELF_RELOC(R_LARCH_TLS_IE64_PC_LO20, 89)
0095 ELF_RELOC(R_LARCH_TLS_IE64_PC_HI12, 90)
0096 ELF_RELOC(R_LARCH_TLS_IE_HI20, 91)
0097 ELF_RELOC(R_LARCH_TLS_IE_LO12, 92)
0098 ELF_RELOC(R_LARCH_TLS_IE64_LO20, 93)
0099 ELF_RELOC(R_LARCH_TLS_IE64_HI12, 94)
0100 ELF_RELOC(R_LARCH_TLS_LD_PC_HI20, 95)
0101 ELF_RELOC(R_LARCH_TLS_LD_HI20, 96)
0102 ELF_RELOC(R_LARCH_TLS_GD_PC_HI20, 97)
0103 ELF_RELOC(R_LARCH_TLS_GD_HI20, 98)
0104 ELF_RELOC(R_LARCH_32_PCREL, 99)
0105 ELF_RELOC(R_LARCH_RELAX, 100)
0106
0107 // Relocs added in ELF for the LoongArchâ„¢ Architecture v20230519, part of the
0108 // v2.10 LoongArch ABI specs.
0109 //
0110 // Spec addition: https://github.com/loongson/la-abi-specs/pull/1
0111 // Binutils commit 57a930e3bfe4b2c7fd6463ed39311e1938513138
0112 // Note that the 101 and 104 relocation numbers are defined as R_LARCH_DELETE
0113 // and R_LARCH_CFA respectively in psABI 2.10. But they are marked as reserved
0114 // in psABI v2.20 because they were proved not necessary to be exposed outside
0115 // of the linker.
0116 ELF_RELOC(R_LARCH_ALIGN, 102)
0117 ELF_RELOC(R_LARCH_PCREL20_S2, 103)
0118 ELF_RELOC(R_LARCH_ADD6, 105)
0119 ELF_RELOC(R_LARCH_SUB6, 106)
0120 ELF_RELOC(R_LARCH_ADD_ULEB128, 107)
0121 ELF_RELOC(R_LARCH_SUB_ULEB128, 108)
0122 ELF_RELOC(R_LARCH_64_PCREL, 109)
0123
0124 // Relocs added in ELF for the LoongArchâ„¢ Architecture v20231102, part of the
0125 // v2.20 LoongArch ABI specs.
0126 //
0127 // Spec addition: https://github.com/loongson/la-abi-specs/pull/4
0128 ELF_RELOC(R_LARCH_CALL36, 110)
0129
0130 // Relocs added in ELF for the LoongArchâ„¢ Architecture v20231219, part of the
0131 // v2.30 LoongArch ABI specs.
0132 //
0133 // Spec addition: https://github.com/loongson/la-abi-specs/pull/5
0134 ELF_RELOC(R_LARCH_TLS_DESC32, 13)
0135 ELF_RELOC(R_LARCH_TLS_DESC64, 14)
0136 ELF_RELOC(R_LARCH_TLS_DESC_PC_HI20, 111)
0137 ELF_RELOC(R_LARCH_TLS_DESC_PC_LO12, 112)
0138 ELF_RELOC(R_LARCH_TLS_DESC64_PC_LO20, 113)
0139 ELF_RELOC(R_LARCH_TLS_DESC64_PC_HI12, 114)
0140 ELF_RELOC(R_LARCH_TLS_DESC_HI20, 115)
0141 ELF_RELOC(R_LARCH_TLS_DESC_LO12, 116)
0142 ELF_RELOC(R_LARCH_TLS_DESC64_LO20, 117)
0143 ELF_RELOC(R_LARCH_TLS_DESC64_HI12, 118)
0144 ELF_RELOC(R_LARCH_TLS_DESC_LD, 119)
0145 ELF_RELOC(R_LARCH_TLS_DESC_CALL, 120)
0146 ELF_RELOC(R_LARCH_TLS_LE_HI20_R, 121)
0147 ELF_RELOC(R_LARCH_TLS_LE_ADD_R, 122)
0148 ELF_RELOC(R_LARCH_TLS_LE_LO12_R, 123)
0149 ELF_RELOC(R_LARCH_TLS_LD_PCREL20_S2, 124)
0150 ELF_RELOC(R_LARCH_TLS_GD_PCREL20_S2, 125)
0151 ELF_RELOC(R_LARCH_TLS_DESC_PCREL20_S2, 126)