1 /*- 2 * Copyright (c) 2009-2015 Kai Wang 3 * Copyright (c) 2016 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Ed Maste under sponsorship 7 * of the FreeBSD Foundation. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31 #include <libelftc.h> 32 #include <stdio.h> 33 34 const char * 35 elftc_reloc_type_str(unsigned int mach, unsigned int type) 36 { 37 static char s_type[32]; 38 39 switch(mach) { 40 case EM_386: 41 case EM_IAMCU: 42 switch(type) { 43 case 0: return "R_386_NONE"; 44 case 1: return "R_386_32"; 45 case 2: return "R_386_PC32"; 46 case 3: return "R_386_GOT32"; 47 case 4: return "R_386_PLT32"; 48 case 5: return "R_386_COPY"; 49 case 6: return "R_386_GLOB_DAT"; 50 case 7: return "R_386_JUMP_SLOT"; 51 case 8: return "R_386_RELATIVE"; 52 case 9: return "R_386_GOTOFF"; 53 case 10: return "R_386_GOTPC"; 54 case 11: return "R_386_32PLT"; /* Not in psabi */ 55 case 14: return "R_386_TLS_TPOFF"; 56 case 15: return "R_386_TLS_IE"; 57 case 16: return "R_386_TLS_GOTIE"; 58 case 17: return "R_386_TLS_LE"; 59 case 18: return "R_386_TLS_GD"; 60 case 19: return "R_386_TLS_LDM"; 61 case 20: return "R_386_16"; 62 case 21: return "R_386_PC16"; 63 case 22: return "R_386_8"; 64 case 23: return "R_386_PC8"; 65 case 24: return "R_386_TLS_GD_32"; 66 case 25: return "R_386_TLS_GD_PUSH"; 67 case 26: return "R_386_TLS_GD_CALL"; 68 case 27: return "R_386_TLS_GD_POP"; 69 case 28: return "R_386_TLS_LDM_32"; 70 case 29: return "R_386_TLS_LDM_PUSH"; 71 case 30: return "R_386_TLS_LDM_CALL"; 72 case 31: return "R_386_TLS_LDM_POP"; 73 case 32: return "R_386_TLS_LDO_32"; 74 case 33: return "R_386_TLS_IE_32"; 75 case 34: return "R_386_TLS_LE_32"; 76 case 35: return "R_386_TLS_DTPMOD32"; 77 case 36: return "R_386_TLS_DTPOFF32"; 78 case 37: return "R_386_TLS_TPOFF32"; 79 case 38: return "R_386_SIZE32"; 80 case 39: return "R_386_TLS_GOTDESC"; 81 case 40: return "R_386_TLS_DESC_CALL"; 82 case 41: return "R_386_TLS_DESC"; 83 case 42: return "R_386_IRELATIVE"; 84 case 43: return "R_386_GOT32X"; 85 } 86 break; 87 case EM_AARCH64: 88 switch(type) { 89 case 0: return "R_AARCH64_NONE"; 90 case 257: return "R_AARCH64_ABS64"; 91 case 258: return "R_AARCH64_ABS32"; 92 case 259: return "R_AARCH64_ABS16"; 93 case 260: return "R_AARCH64_PREL64"; 94 case 261: return "R_AARCH64_PREL32"; 95 case 262: return "R_AARCH64_PREL16"; 96 case 263: return "R_AARCH64_MOVW_UABS_G0"; 97 case 264: return "R_AARCH64_MOVW_UABS_G0_NC"; 98 case 265: return "R_AARCH64_MOVW_UABS_G1"; 99 case 266: return "R_AARCH64_MOVW_UABS_G1_NC"; 100 case 267: return "R_AARCH64_MOVW_UABS_G2"; 101 case 268: return "R_AARCH64_MOVW_UABS_G2_NC"; 102 case 269: return "R_AARCH64_MOVW_UABS_G3"; 103 case 270: return "R_AARCH64_MOVW_SABS_G0"; 104 case 271: return "R_AARCH64_MOVW_SABS_G1"; 105 case 272: return "R_AARCH64_MOVW_SABS_G2"; 106 case 273: return "R_AARCH64_LD_PREL_LO19"; 107 case 274: return "R_AARCH64_ADR_PREL_LO21"; 108 case 275: return "R_AARCH64_ADR_PREL_PG_HI21"; 109 case 276: return "R_AARCH64_ADR_PREL_PG_HI21_NC"; 110 case 277: return "R_AARCH64_ADD_ABS_LO12_NC"; 111 case 278: return "R_AARCH64_LDST8_ABS_LO12_NC"; 112 case 279: return "R_AARCH64_TSTBR14"; 113 case 280: return "R_AARCH64_CONDBR19"; 114 case 282: return "R_AARCH64_JUMP26"; 115 case 283: return "R_AARCH64_CALL26"; 116 case 284: return "R_AARCH64_LDST16_ABS_LO12_NC"; 117 case 285: return "R_AARCH64_LDST32_ABS_LO12_NC"; 118 case 286: return "R_AARCH64_LDST64_ABS_LO12_NC"; 119 case 287: return "R_AARCH64_MOVW_PREL_G0"; 120 case 288: return "R_AARCH64_MOVW_PREL_G0_NC"; 121 case 289: return "R_AARCH64_MOVW_PREL_G1"; 122 case 290: return "R_AARCH64_MOVW_PREL_G1_NC"; 123 case 291: return "R_AARCH64_MOVW_PREL_G2"; 124 case 292: return "R_AARCH64_MOVW_PREL_G2_NC"; 125 case 293: return "R_AARCH64_MOVW_PREL_G3"; 126 case 299: return "R_AARCH64_LDST128_ABS_LO12_NC"; 127 case 300: return "R_AARCH64_MOVW_GOTOFF_G0"; 128 case 301: return "R_AARCH64_MOVW_GOTOFF_G0_NC"; 129 case 302: return "R_AARCH64_MOVW_GOTOFF_G1"; 130 case 303: return "R_AARCH64_MOVW_GOTOFF_G1_NC"; 131 case 304: return "R_AARCH64_MOVW_GOTOFF_G2"; 132 case 305: return "R_AARCH64_MOVW_GOTOFF_G2_NC"; 133 case 306: return "R_AARCH64_MOVW_GOTOFF_G3"; 134 case 307: return "R_AARCH64_GOTREL64"; 135 case 308: return "R_AARCH64_GOTREL32"; 136 case 309: return "R_AARCH64_GOT_LD_PREL19"; 137 case 310: return "R_AARCH64_LD64_GOTOFF_LO15"; 138 case 311: return "R_AARCH64_ADR_GOT_PAGE"; 139 case 312: return "R_AARCH64_LD64_GOT_LO12_NC"; 140 case 313: return "R_AARCH64_LD64_GOTPAGE_LO15"; 141 case 560: return "R_AARCH64_TLSDESC_LD_PREL19"; 142 case 561: return "R_AARCH64_TLSDESC_ADR_PREL21"; 143 case 562: return "R_AARCH64_TLSDESC_ADR_PAGE21"; 144 case 563: return "R_AARCH64_TLSDESC_LD64_LO12"; 145 case 564: return "R_AARCH64_TLSDESC_ADD_LO12"; 146 case 565: return "R_AARCH64_TLSDESC_OFF_G1"; 147 case 566: return "R_AARCH64_TLSDESC_OFF_G0_NC"; 148 case 567: return "R_AARCH64_TLSDESC_LDR"; 149 case 568: return "R_AARCH64_TLSDESC_ADD"; 150 case 569: return "R_AARCH64_TLSDESC_CALL"; 151 case 1024: return "R_AARCH64_COPY"; 152 case 1025: return "R_AARCH64_GLOB_DAT"; 153 case 1026: return "R_AARCH64_JUMP_SLOT"; 154 case 1027: return "R_AARCH64_RELATIVE"; 155 case 1028: return "R_AARCH64_TLS_DTPREL64"; 156 case 1029: return "R_AARCH64_TLS_DTPMOD64"; 157 case 1030: return "R_AARCH64_TLS_TPREL64"; 158 case 1031: return "R_AARCH64_TLSDESC"; 159 case 1032: return "R_AARCH64_IRELATIVE"; 160 } 161 break; 162 case EM_ARM: 163 switch(type) { 164 case 0: return "R_ARM_NONE"; 165 case 1: return "R_ARM_PC24"; /* Deprecated */ 166 case 2: return "R_ARM_ABS32"; 167 case 3: return "R_ARM_REL32"; 168 case 4: return "R_ARM_LDR_PC_G0"; /* Also R_ARM_PC13 */ 169 case 5: return "R_ARM_ABS16"; 170 case 6: return "R_ARM_ABS12"; 171 case 7: return "R_ARM_THM_ABS5"; 172 case 8: return "R_ARM_ABS8"; 173 case 9: return "R_ARM_SBREL32"; 174 case 10: return "R_ARM_THM_CALL"; /* Also R_ARM_THM_PC22 */ 175 case 11: return "R_ARM_THM_PC8"; 176 case 12: return "R_ARM_BREL_ADJ"; /* Also R_ARM_AMP_VCALL9 */ 177 case 13: return "R_ARM_TLS_DESC"; /* Also R_ARM_SWI24 */ 178 case 14: return "R_ARM_THM_SWI8"; /* Obsolete */ 179 case 15: return "R_ARM_XPC25"; /* Obsolete */ 180 case 16: return "R_ARM_THM_XPC22"; /* Obsolete */ 181 case 17: return "R_ARM_TLS_DTPMOD32"; 182 case 18: return "R_ARM_TLS_DTPOFF32"; 183 case 19: return "R_ARM_TLS_TPOFF32"; 184 case 20: return "R_ARM_COPY"; 185 case 21: return "R_ARM_GLOB_DAT"; 186 case 22: return "R_ARM_JUMP_SLOT"; 187 case 23: return "R_ARM_RELATIVE"; 188 case 24: return "R_ARM_GOTOFF32"; /* Also R_ARM_GOTOFF */ 189 case 25: return "R_ARM_BASE_PREL"; /* GNU R_ARM_GOTPC */ 190 case 26: return "R_ARM_GOT_BREL"; /* GNU R_ARM_GOT32 */ 191 case 27: return "R_ARM_PLT32"; /* Deprecated */ 192 case 28: return "R_ARM_CALL"; 193 case 29: return "R_ARM_JUMP24"; 194 case 30: return "R_ARM_THM_JUMP24"; 195 case 31: return "R_ARM_BASE_ABS"; 196 case 32: return "R_ARM_ALU_PCREL_7_0"; /* Obsolete */ 197 case 33: return "R_ARM_ALU_PCREL_15_8"; /* Obsolete */ 198 case 34: return "R_ARM_ALU_PCREL_23_15"; /* Obsolete */ 199 case 35: return "R_ARM_LDR_SBREL_11_0_NC"; /* Deprecated */ 200 case 36: return "R_ARM_ALU_SBREL_19_12_NC"; /* Deprecated */ 201 case 37: return "R_ARM_ALU_SBREL_27_20_CK"; /* Deprecated */ 202 case 38: return "R_ARM_TARGET1"; 203 case 39: return "R_ARM_SBREL31"; /* Deprecated. */ 204 case 40: return "R_ARM_V4BX"; 205 case 41: return "R_ARM_TARGET2"; 206 case 42: return "R_ARM_PREL31"; 207 case 43: return "R_ARM_MOVW_ABS_NC"; 208 case 44: return "R_ARM_MOVT_ABS"; 209 case 45: return "R_ARM_MOVW_PREL_NC"; 210 case 46: return "R_ARM_MOVT_PREL"; 211 case 47: return "R_ARM_THM_MOVW_ABS_NC"; 212 case 48: return "R_ARM_THM_MOVT_ABS"; 213 case 49: return "R_ARM_THM_MOVW_PREL_NC"; 214 case 50: return "R_ARM_THM_MOVT_PREL"; 215 case 51: return "R_ARM_THM_JUMP19"; 216 case 52: return "R_ARM_THM_JUMP6"; 217 case 53: return "R_ARM_THM_ALU_PREL_11_0"; 218 case 54: return "R_ARM_THM_PC12"; 219 case 55: return "R_ARM_ABS32_NOI"; 220 case 56: return "R_ARM_REL32_NOI"; 221 case 57: return "R_ARM_ALU_PC_G0_NC"; 222 case 58: return "R_ARM_ALU_PC_G0"; 223 case 59: return "R_ARM_ALU_PC_G1_NC"; 224 case 60: return "R_ARM_ALU_PC_G1"; 225 case 61: return "R_ARM_ALU_PC_G2"; 226 case 62: return "R_ARM_LDR_PC_G1"; 227 case 63: return "R_ARM_LDR_PC_G2"; 228 case 64: return "R_ARM_LDRS_PC_G0"; 229 case 65: return "R_ARM_LDRS_PC_G1"; 230 case 66: return "R_ARM_LDRS_PC_G2"; 231 case 67: return "R_ARM_LDC_PC_G0"; 232 case 68: return "R_ARM_LDC_PC_G1"; 233 case 69: return "R_ARM_LDC_PC_G2"; 234 case 70: return "R_ARM_ALU_SB_G0_NC"; 235 case 71: return "R_ARM_ALU_SB_G0"; 236 case 72: return "R_ARM_ALU_SB_G1_NC"; 237 case 73: return "R_ARM_ALU_SB_G1"; 238 case 74: return "R_ARM_ALU_SB_G2"; 239 case 75: return "R_ARM_LDR_SB_G0"; 240 case 76: return "R_ARM_LDR_SB_G1"; 241 case 77: return "R_ARM_LDR_SB_G2"; 242 case 78: return "R_ARM_LDRS_SB_G0"; 243 case 79: return "R_ARM_LDRS_SB_G1"; 244 case 80: return "R_ARM_LDRS_SB_G2"; 245 case 81: return "R_ARM_LDC_SB_G0"; 246 case 82: return "R_ARM_LDC_SB_G1"; 247 case 83: return "R_ARM_LDC_SB_G2"; 248 case 84: return "R_ARM_MOVW_BREL_NC"; 249 case 85: return "R_ARM_MOVT_BREL"; 250 case 86: return "R_ARM_MOVW_BREL"; 251 case 87: return "R_ARM_THM_MOVW_BREL_NC"; 252 case 88: return "R_ARM_THM_MOVT_BREL"; 253 case 89: return "R_ARM_THM_MOVW_BREL"; 254 case 90: return "R_ARM_TLS_GOTDESC"; 255 case 91: return "R_ARM_TLS_CALL"; 256 case 92: return "R_ARM_TLS_DESCSEQ"; 257 case 93: return "R_ARM_THM_TLS_CALL"; 258 case 94: return "R_ARM_PLT32_ABS"; 259 case 95: return "R_ARM_GOT_ABS"; 260 case 96: return "R_ARM_GOT_PREL"; 261 case 97: return "R_ARM_GOT_BREL12"; 262 case 98: return "R_ARM_GOTOFF12"; 263 case 99: return "R_ARM_GOTRELAX"; 264 case 100: return "R_ARM_GNU_VTENTRY"; 265 case 101: return "R_ARM_GNU_VTINHERIT"; 266 case 102: return "R_ARM_THM_JUMP11"; /* Also R_ARM_THM_PC11 */ 267 case 103: return "R_ARM_THM_JUMP8"; /* Also R_ARM_THM_PC9 */ 268 case 104: return "R_ARM_TLS_GD32"; 269 case 105: return "R_ARM_TLS_LDM32"; 270 case 106: return "R_ARM_TLS_LDO32"; 271 case 107: return "R_ARM_TLS_IE32"; 272 case 108: return "R_ARM_TLS_LE32"; 273 case 109: return "R_ARM_TLS_LDO12"; 274 case 110: return "R_ARM_TLS_LE12"; 275 case 111: return "R_ARM_TLS_IE12GP"; 276 /* 112-127 R_ARM_PRIVATE_<n> */ 277 case 128: return "R_ARM_ME_TOO"; /* Obsolete */ 278 case 129: return "R_ARM_THM_TLS_DESCSEQ16"; 279 case 130: return "R_ARM_THM_TLS_DESCSEQ32"; 280 case 131: return "R_ARM_THM_GOT_BREL12"; 281 case 132: return "R_ARM_THM_ALU_ABS_G0_NC"; 282 case 133: return "R_ARM_THM_ALU_ABS_G1_NC"; 283 case 134: return "R_ARM_THM_ALU_ABS_G2_NC"; 284 case 135: return "R_ARM_THM_ALU_ABS_G3"; 285 /* 136-159 Reserved for future allocation. */ 286 case 160: return "R_ARM_IRELATIVE"; 287 /* 161-255 Reserved for future allocation. */ 288 case 249: return "R_ARM_RXPC25"; 289 case 250: return "R_ARM_RSBREL32"; 290 case 251: return "R_ARM_THM_RPC22"; 291 case 252: return "R_ARM_RREL32"; 292 case 253: return "R_ARM_RABS32"; 293 case 254: return "R_ARM_RPC24"; 294 case 255: return "R_ARM_RBASE"; 295 } 296 break; 297 case EM_IA_64: 298 switch(type) { 299 case 0: return "R_IA_64_NONE"; 300 case 33: return "R_IA_64_IMM14"; 301 case 34: return "R_IA_64_IMM22"; 302 case 35: return "R_IA_64_IMM64"; 303 case 36: return "R_IA_64_DIR32MSB"; 304 case 37: return "R_IA_64_DIR32LSB"; 305 case 38: return "R_IA_64_DIR64MSB"; 306 case 39: return "R_IA_64_DIR64LSB"; 307 case 42: return "R_IA_64_GPREL22"; 308 case 43: return "R_IA_64_GPREL64I"; 309 case 44: return "R_IA_64_GPREL32MSB"; 310 case 45: return "R_IA_64_GPREL32LSB"; 311 case 46: return "R_IA_64_GPREL64MSB"; 312 case 47: return "R_IA_64_GPREL64LSB"; 313 case 50: return "R_IA_64_LTOFF22"; 314 case 51: return "R_IA_64_LTOFF64I"; 315 case 58: return "R_IA_64_PLTOFF22"; 316 case 59: return "R_IA_64_PLTOFF64I"; 317 case 62: return "R_IA_64_PLTOFF64MSB"; 318 case 63: return "R_IA_64_PLTOFF64LSB"; 319 case 67: return "R_IA_64_FPTR64I"; 320 case 68: return "R_IA_64_FPTR32MSB"; 321 case 69: return "R_IA_64_FPTR32LSB"; 322 case 70: return "R_IA_64_FPTR64MSB"; 323 case 71: return "R_IA_64_FPTR64LSB"; 324 case 72: return "R_IA_64_PCREL60B"; 325 case 73: return "R_IA_64_PCREL21B"; 326 case 74: return "R_IA_64_PCREL21M"; 327 case 75: return "R_IA_64_PCREL21F"; 328 case 76: return "R_IA_64_PCREL32MSB"; 329 case 77: return "R_IA_64_PCREL32LSB"; 330 case 78: return "R_IA_64_PCREL64MSB"; 331 case 79: return "R_IA_64_PCREL64LSB"; 332 case 82: return "R_IA_64_LTOFF_FPTR22"; 333 case 83: return "R_IA_64_LTOFF_FPTR64I"; 334 case 84: return "R_IA_64_LTOFF_FPTR32MSB"; 335 case 85: return "R_IA_64_LTOFF_FPTR32LSB"; 336 case 86: return "R_IA_64_LTOFF_FPTR64MSB"; 337 case 87: return "R_IA_64_LTOFF_FPTR64LSB"; 338 case 92: return "R_IA_64_SEGREL32MSB"; 339 case 93: return "R_IA_64_SEGREL32LSB"; 340 case 94: return "R_IA_64_SEGREL64MSB"; 341 case 95: return "R_IA_64_SEGREL64LSB"; 342 case 100: return "R_IA_64_SECREL32MSB"; 343 case 101: return "R_IA_64_SECREL32LSB"; 344 case 102: return "R_IA_64_SECREL64MSB"; 345 case 103: return "R_IA_64_SECREL64LSB"; 346 case 108: return "R_IA_64_REL32MSB"; 347 case 109: return "R_IA_64_REL32LSB"; 348 case 110: return "R_IA_64_REL64MSB"; 349 case 111: return "R_IA_64_REL64LSB"; 350 case 116: return "R_IA_64_LTV32MSB"; 351 case 117: return "R_IA_64_LTV32LSB"; 352 case 118: return "R_IA_64_LTV64MSB"; 353 case 119: return "R_IA_64_LTV64LSB"; 354 case 121: return "R_IA_64_PCREL21BI"; 355 case 122: return "R_IA_64_PCREL22"; 356 case 123: return "R_IA_64_PCREL64I"; 357 case 128: return "R_IA_64_IPLTMSB"; 358 case 129: return "R_IA_64_IPLTLSB"; 359 case 133: return "R_IA_64_SUB"; 360 case 134: return "R_IA_64_LTOFF22X"; 361 case 135: return "R_IA_64_LDXMOV"; 362 case 145: return "R_IA_64_TPREL14"; 363 case 146: return "R_IA_64_TPREL22"; 364 case 147: return "R_IA_64_TPREL64I"; 365 case 150: return "R_IA_64_TPREL64MSB"; 366 case 151: return "R_IA_64_TPREL64LSB"; 367 case 154: return "R_IA_64_LTOFF_TPREL22"; 368 case 166: return "R_IA_64_DTPMOD64MSB"; 369 case 167: return "R_IA_64_DTPMOD64LSB"; 370 case 170: return "R_IA_64_LTOFF_DTPMOD22"; 371 case 177: return "R_IA_64_DTPREL14"; 372 case 178: return "R_IA_64_DTPREL22"; 373 case 179: return "R_IA_64_DTPREL64I"; 374 case 180: return "R_IA_64_DTPREL32MSB"; 375 case 181: return "R_IA_64_DTPREL32LSB"; 376 case 182: return "R_IA_64_DTPREL64MSB"; 377 case 183: return "R_IA_64_DTPREL64LSB"; 378 case 186: return "R_IA_64_LTOFF_DTPREL22"; 379 } 380 break; 381 case EM_MIPS: 382 switch(type) { 383 case 0: return "R_MIPS_NONE"; 384 case 1: return "R_MIPS_16"; 385 case 2: return "R_MIPS_32"; 386 case 3: return "R_MIPS_REL32"; 387 case 4: return "R_MIPS_26"; 388 case 5: return "R_MIPS_HI16"; 389 case 6: return "R_MIPS_LO16"; 390 case 7: return "R_MIPS_GPREL16"; 391 case 8: return "R_MIPS_LITERAL"; 392 case 9: return "R_MIPS_GOT16"; 393 case 10: return "R_MIPS_PC16"; 394 case 11: return "R_MIPS_CALL16"; 395 case 12: return "R_MIPS_GPREL32"; 396 case 16: return "R_MIPS_SHIFT5"; 397 case 17: return "R_MIPS_SHIFT6"; 398 case 18: return "R_MIPS_64"; 399 case 19: return "R_MIPS_GOT_DISP"; 400 case 20: return "R_MIPS_GOT_PAGE"; 401 case 21: return "R_MIPS_GOT_OFST"; 402 case 22: return "R_MIPS_GOT_HI16"; 403 case 23: return "R_MIPS_GOT_LO16"; 404 case 24: return "R_MIPS_SUB"; 405 case 28: return "R_MIPS_HIGHER"; 406 case 29: return "R_MIPS_HIGHEST"; 407 case 30: return "R_MIPS_CALLHI16"; 408 case 31: return "R_MIPS_CALLLO16"; 409 case 37: return "R_MIPS_JALR"; 410 case 38: return "R_MIPS_TLS_DTPMOD32"; 411 case 39: return "R_MIPS_TLS_DTPREL32"; 412 case 40: return "R_MIPS_TLS_DTPMOD64"; 413 case 41: return "R_MIPS_TLS_DTPREL64"; 414 case 42: return "R_MIPS_TLS_GD"; 415 case 43: return "R_MIPS_TLS_LDM"; 416 case 44: return "R_MIPS_TLS_DTPREL_HI16"; 417 case 45: return "R_MIPS_TLS_DTPREL_LO16"; 418 case 46: return "R_MIPS_TLS_GOTTPREL"; 419 case 47: return "R_MIPS_TLS_TPREL32"; 420 case 48: return "R_MIPS_TLS_TPREL64"; 421 case 49: return "R_MIPS_TLS_TPREL_HI16"; 422 case 50: return "R_MIPS_TLS_TPREL_LO16"; 423 } 424 break; 425 case EM_PPC: 426 switch(type) { 427 case 0: return "R_PPC_NONE"; 428 case 1: return "R_PPC_ADDR32"; 429 case 2: return "R_PPC_ADDR24"; 430 case 3: return "R_PPC_ADDR16"; 431 case 4: return "R_PPC_ADDR16_LO"; 432 case 5: return "R_PPC_ADDR16_HI"; 433 case 6: return "R_PPC_ADDR16_HA"; 434 case 7: return "R_PPC_ADDR14"; 435 case 8: return "R_PPC_ADDR14_BRTAKEN"; 436 case 9: return "R_PPC_ADDR14_BRNTAKEN"; 437 case 10: return "R_PPC_REL24"; 438 case 11: return "R_PPC_REL14"; 439 case 12: return "R_PPC_REL14_BRTAKEN"; 440 case 13: return "R_PPC_REL14_BRNTAKEN"; 441 case 14: return "R_PPC_GOT16"; 442 case 15: return "R_PPC_GOT16_LO"; 443 case 16: return "R_PPC_GOT16_HI"; 444 case 17: return "R_PPC_GOT16_HA"; 445 case 18: return "R_PPC_PLTREL24"; 446 case 19: return "R_PPC_COPY"; 447 case 20: return "R_PPC_GLOB_DAT"; 448 case 21: return "R_PPC_JMP_SLOT"; 449 case 22: return "R_PPC_RELATIVE"; 450 case 23: return "R_PPC_LOCAL24PC"; 451 case 24: return "R_PPC_UADDR32"; 452 case 25: return "R_PPC_UADDR16"; 453 case 26: return "R_PPC_REL32"; 454 case 27: return "R_PPC_PLT32"; 455 case 28: return "R_PPC_PLTREL32"; 456 case 29: return "R_PPC_PLT16_LO"; 457 case 30: return "R_PPC_PLT16_HI"; 458 case 31: return "R_PPC_PLT16_HA"; 459 case 32: return "R_PPC_SDAREL16"; 460 case 33: return "R_PPC_SECTOFF"; 461 case 34: return "R_PPC_SECTOFF_LO"; 462 case 35: return "R_PPC_SECTOFF_HI"; 463 case 36: return "R_PPC_SECTOFF_HA"; 464 case 67: return "R_PPC_TLS"; 465 case 68: return "R_PPC_DTPMOD32"; 466 case 69: return "R_PPC_TPREL16"; 467 case 70: return "R_PPC_TPREL16_LO"; 468 case 71: return "R_PPC_TPREL16_HI"; 469 case 72: return "R_PPC_TPREL16_HA"; 470 case 73: return "R_PPC_TPREL32"; 471 case 74: return "R_PPC_DTPREL16"; 472 case 75: return "R_PPC_DTPREL16_LO"; 473 case 76: return "R_PPC_DTPREL16_HI"; 474 case 77: return "R_PPC_DTPREL16_HA"; 475 case 78: return "R_PPC_DTPREL32"; 476 case 79: return "R_PPC_GOT_TLSGD16"; 477 case 80: return "R_PPC_GOT_TLSGD16_LO"; 478 case 81: return "R_PPC_GOT_TLSGD16_HI"; 479 case 82: return "R_PPC_GOT_TLSGD16_HA"; 480 case 83: return "R_PPC_GOT_TLSLD16"; 481 case 84: return "R_PPC_GOT_TLSLD16_LO"; 482 case 85: return "R_PPC_GOT_TLSLD16_HI"; 483 case 86: return "R_PPC_GOT_TLSLD16_HA"; 484 case 87: return "R_PPC_GOT_TPREL16"; 485 case 88: return "R_PPC_GOT_TPREL16_LO"; 486 case 89: return "R_PPC_GOT_TPREL16_HI"; 487 case 90: return "R_PPC_GOT_TPREL16_HA"; 488 case 101: return "R_PPC_EMB_NADDR32"; 489 case 102: return "R_PPC_EMB_NADDR16"; 490 case 103: return "R_PPC_EMB_NADDR16_LO"; 491 case 104: return "R_PPC_EMB_NADDR16_HI"; 492 case 105: return "R_PPC_EMB_NADDR16_HA"; 493 case 106: return "R_PPC_EMB_SDAI16"; 494 case 107: return "R_PPC_EMB_SDA2I16"; 495 case 108: return "R_PPC_EMB_SDA2REL"; 496 case 109: return "R_PPC_EMB_SDA21"; 497 case 110: return "R_PPC_EMB_MRKREF"; 498 case 111: return "R_PPC_EMB_RELSEC16"; 499 case 112: return "R_PPC_EMB_RELST_LO"; 500 case 113: return "R_PPC_EMB_RELST_HI"; 501 case 114: return "R_PPC_EMB_RELST_HA"; 502 case 115: return "R_PPC_EMB_BIT_FLD"; 503 case 116: return "R_PPC_EMB_RELSDA"; 504 } 505 break; 506 case EM_PPC64: 507 switch(type) { 508 case 0: return "R_PPC64_NONE"; 509 case 1: return "R_PPC64_ADDR32"; 510 case 2: return "R_PPC64_ADDR24"; 511 case 3: return "R_PPC64_ADDR16"; 512 case 4: return "R_PPC64_ADDR16_LO"; 513 case 5: return "R_PPC64_ADDR16_HI"; 514 case 6: return "R_PPC64_ADDR16_HA"; 515 case 7: return "R_PPC64_ADDR14"; 516 case 8: return "R_PPC64_ADDR14_BRTAKEN"; 517 case 9: return "R_PPC64_ADDR14_BRNTAKEN"; 518 case 10: return "R_PPC64_REL24"; 519 case 11: return "R_PPC64_REL14"; 520 case 12: return "R_PPC64_REL14_BRTAKEN"; 521 case 13: return "R_PPC64_REL14_BRNTAKEN"; 522 case 14: return "R_PPC64_GOT16"; 523 case 15: return "R_PPC64_GOT16_LO"; 524 case 16: return "R_PPC64_GOT16_HI"; 525 case 17: return "R_PPC64_GOT16_HA"; 526 case 19: return "R_PPC64_COPY"; 527 case 20: return "R_PPC64_GLOB_DAT"; 528 case 21: return "R_PPC64_JMP_SLOT"; 529 case 22: return "R_PPC64_RELATIVE"; 530 case 24: return "R_PPC64_UADDR32"; 531 case 25: return "R_PPC64_UADDR16"; 532 case 26: return "R_PPC64_REL32"; 533 case 27: return "R_PPC64_PLT32"; 534 case 28: return "R_PPC64_PLTREL32"; 535 case 29: return "R_PPC64_PLT16_LO"; 536 case 30: return "R_PPC64_PLT16_HI"; 537 case 31: return "R_PPC64_PLT16_HA"; 538 case 33: return "R_PPC64_SECTOFF"; 539 case 34: return "R_PPC64_SECTOFF_LO"; 540 case 35: return "R_PPC64_SECTOFF_HI"; 541 case 36: return "R_PPC64_SECTOFF_HA"; 542 case 37: return "R_PPC64_ADDR30"; 543 case 38: return "R_PPC64_ADDR64"; 544 case 39: return "R_PPC64_ADDR16_HIGHER"; 545 case 40: return "R_PPC64_ADDR16_HIGHERA"; 546 case 41: return "R_PPC64_ADDR16_HIGHEST"; 547 case 42: return "R_PPC64_ADDR16_HIGHESTA"; 548 case 43: return "R_PPC64_UADDR64"; 549 case 44: return "R_PPC64_REL64"; 550 case 45: return "R_PPC64_PLT64"; 551 case 46: return "R_PPC64_PLTREL64"; 552 case 47: return "R_PPC64_TOC16"; 553 case 48: return "R_PPC64_TOC16_LO"; 554 case 49: return "R_PPC64_TOC16_HI"; 555 case 50: return "R_PPC64_TOC16_HA"; 556 case 51: return "R_PPC64_TOC"; 557 case 52: return "R_PPC64_PLTGOT16"; 558 case 53: return "R_PPC64_PLTGOT16_LO"; 559 case 54: return "R_PPC64_PLTGOT16_HI"; 560 case 55: return "R_PPC64_PLTGOT16_HA"; 561 case 56: return "R_PPC64_ADDR16_DS"; 562 case 57: return "R_PPC64_ADDR16_LO_DS"; 563 case 58: return "R_PPC64_GOT16_DS"; 564 case 59: return "R_PPC64_GOT16_LO_DS"; 565 case 60: return "R_PPC64_PLT16_LO_DS"; 566 case 61: return "R_PPC64_SECTOFF_DS"; 567 case 62: return "R_PPC64_SECTOFF_LO_DS"; 568 case 63: return "R_PPC64_TOC16_DS"; 569 case 64: return "R_PPC64_TOC16_LO_DS"; 570 case 65: return "R_PPC64_PLTGOT16_DS"; 571 case 66: return "R_PPC64_PLTGOT16_LO_DS"; 572 case 67: return "R_PPC64_TLS"; 573 case 68: return "R_PPC64_DTPMOD64"; 574 case 69: return "R_PPC64_TPREL16"; 575 case 70: return "R_PPC64_TPREL16_LO"; 576 case 71: return "R_PPC64_TPREL16_HI"; 577 case 72: return "R_PPC64_TPREL16_HA"; 578 case 73: return "R_PPC64_TPREL64"; 579 case 74: return "R_PPC64_DTPREL16"; 580 case 75: return "R_PPC64_DTPREL16_LO"; 581 case 76: return "R_PPC64_DTPREL16_HI"; 582 case 77: return "R_PPC64_DTPREL16_HA"; 583 case 78: return "R_PPC64_DTPREL64"; 584 case 79: return "R_PPC64_GOT_TLSGD16"; 585 case 80: return "R_PPC64_GOT_TLSGD16_LO"; 586 case 81: return "R_PPC64_GOT_TLSGD16_HI"; 587 case 82: return "R_PPC64_GOT_TLSGD16_HA"; 588 case 83: return "R_PPC64_GOT_TLSLD16"; 589 case 84: return "R_PPC64_GOT_TLSLD16_LO"; 590 case 85: return "R_PPC64_GOT_TLSLD16_HI"; 591 case 86: return "R_PPC64_GOT_TLSLD16_HA"; 592 case 87: return "R_PPC64_GOT_TPREL16_DS"; 593 case 88: return "R_PPC64_GOT_TPREL16_LO_DS"; 594 case 89: return "R_PPC64_GOT_TPREL16_HI"; 595 case 90: return "R_PPC64_GOT_TPREL16_HA"; 596 case 91: return "R_PPC64_GOT_DTPREL16_DS"; 597 case 92: return "R_PPC64_GOT_DTPREL16_LO_DS"; 598 case 93: return "R_PPC64_GOT_DTPREL16_HI"; 599 case 94: return "R_PPC64_GOT_DTPREL16_HA"; 600 case 95: return "R_PPC64_TPREL16_DS"; 601 case 96: return "R_PPC64_TPREL16_LO_DS"; 602 case 97: return "R_PPC64_TPREL16_HIGHER"; 603 case 98: return "R_PPC64_TPREL16_HIGHERA"; 604 case 99: return "R_PPC64_TPREL16_HIGHEST"; 605 case 100: return "R_PPC64_TPREL16_HIGHESTA"; 606 case 101: return "R_PPC64_DTPREL16_DS"; 607 case 102: return "R_PPC64_DTPREL16_LO_DS"; 608 case 103: return "R_PPC64_DTPREL16_HIGHER"; 609 case 104: return "R_PPC64_DTPREL16_HIGHERA"; 610 case 105: return "R_PPC64_DTPREL16_HIGHEST"; 611 case 106: return "R_PPC64_DTPREL16_HIGHESTA"; 612 case 107: return "R_PPC64_TLSGD"; 613 case 108: return "R_PPC64_TLSLD"; 614 case 249: return "R_PPC64_REL16"; 615 case 250: return "R_PPC64_REL16_LO"; 616 case 251: return "R_PPC64_REL16_HI"; 617 case 252: return "R_PPC64_REL16_HA"; 618 } 619 break; 620 case EM_RISCV: 621 switch(type) { 622 case 0: return "R_RISCV_NONE"; 623 case 1: return "R_RISCV_32"; 624 case 2: return "R_RISCV_64"; 625 case 3: return "R_RISCV_RELATIVE"; 626 case 4: return "R_RISCV_COPY"; 627 case 5: return "R_RISCV_JUMP_SLOT"; 628 case 6: return "R_RISCV_TLS_DTPMOD32"; 629 case 7: return "R_RISCV_TLS_DTPMOD64"; 630 case 8: return "R_RISCV_TLS_DTPREL32"; 631 case 9: return "R_RISCV_TLS_DTPREL64"; 632 case 10: return "R_RISCV_TLS_TPREL32"; 633 case 11: return "R_RISCV_TLS_TPREL64"; 634 case 16: return "R_RISCV_BRANCH"; 635 case 17: return "R_RISCV_JAL"; 636 case 18: return "R_RISCV_CALL"; 637 case 19: return "R_RISCV_CALL_PLT"; 638 case 20: return "R_RISCV_GOT_HI20"; 639 case 21: return "R_RISCV_TLS_GOT_HI20"; 640 case 22: return "R_RISCV_TLS_GD_HI20"; 641 case 23: return "R_RISCV_PCREL_HI20"; 642 case 24: return "R_RISCV_PCREL_LO12_I"; 643 case 25: return "R_RISCV_PCREL_LO12_S"; 644 case 26: return "R_RISCV_HI20"; 645 case 27: return "R_RISCV_LO12_I"; 646 case 28: return "R_RISCV_LO12_S"; 647 case 29: return "R_RISCV_TPREL_HI20"; 648 case 30: return "R_RISCV_TPREL_LO12_I"; 649 case 31: return "R_RISCV_TPREL_LO12_S"; 650 case 32: return "R_RISCV_TPREL_ADD"; 651 case 33: return "R_RISCV_ADD8"; 652 case 34: return "R_RISCV_ADD16"; 653 case 35: return "R_RISCV_ADD32"; 654 case 36: return "R_RISCV_ADD64"; 655 case 37: return "R_RISCV_SUB8"; 656 case 38: return "R_RISCV_SUB16"; 657 case 39: return "R_RISCV_SUB32"; 658 case 40: return "R_RISCV_SUB64"; 659 case 41: return "R_RISCV_GNU_VTINHERIT"; 660 case 42: return "R_RISCV_GNU_VTENTRY"; 661 case 43: return "R_RISCV_ALIGN"; 662 case 44: return "R_RISCV_RVC_BRANCH"; 663 case 45: return "R_RISCV_RVC_JUMP"; 664 case 46: return "R_RISCV_RVC_LUI"; 665 case 47: return "R_RISCV_GPREL_I"; 666 case 48: return "R_RISCV_GPREL_S"; 667 } 668 break; 669 case EM_S390: 670 switch (type) { 671 case 0: return "R_390_NONE"; 672 case 1: return "R_390_8"; 673 case 2: return "R_390_12"; 674 case 3: return "R_390_16"; 675 case 4: return "R_390_32"; 676 case 5: return "R_390_PC32"; 677 case 6: return "R_390_GOT12"; 678 case 7: return "R_390_GOT32"; 679 case 8: return "R_390_PLT32"; 680 case 9: return "R_390_COPY"; 681 case 10: return "R_390_GLOB_DAT"; 682 case 11: return "R_390_JMP_SLOT"; 683 case 12: return "R_390_RELATIVE"; 684 case 13: return "R_390_GOTOFF"; 685 case 14: return "R_390_GOTPC"; 686 case 15: return "R_390_GOT16"; 687 case 16: return "R_390_PC16"; 688 case 17: return "R_390_PC16DBL"; 689 case 18: return "R_390_PLT16DBL"; 690 case 19: return "R_390_PC32DBL"; 691 case 20: return "R_390_PLT32DBL"; 692 case 21: return "R_390_GOTPCDBL"; 693 case 22: return "R_390_64"; 694 case 23: return "R_390_PC64"; 695 case 24: return "R_390_GOT64"; 696 case 25: return "R_390_PLT64"; 697 case 26: return "R_390_GOTENT"; 698 } 699 break; 700 case EM_SPARC: 701 case EM_SPARCV9: 702 switch(type) { 703 case 0: return "R_SPARC_NONE"; 704 case 1: return "R_SPARC_8"; 705 case 2: return "R_SPARC_16"; 706 case 3: return "R_SPARC_32"; 707 case 4: return "R_SPARC_DISP8"; 708 case 5: return "R_SPARC_DISP16"; 709 case 6: return "R_SPARC_DISP32"; 710 case 7: return "R_SPARC_WDISP30"; 711 case 8: return "R_SPARC_WDISP22"; 712 case 9: return "R_SPARC_HI22"; 713 case 10: return "R_SPARC_22"; 714 case 11: return "R_SPARC_13"; 715 case 12: return "R_SPARC_LO10"; 716 case 13: return "R_SPARC_GOT10"; 717 case 14: return "R_SPARC_GOT13"; 718 case 15: return "R_SPARC_GOT22"; 719 case 16: return "R_SPARC_PC10"; 720 case 17: return "R_SPARC_PC22"; 721 case 18: return "R_SPARC_WPLT30"; 722 case 19: return "R_SPARC_COPY"; 723 case 20: return "R_SPARC_GLOB_DAT"; 724 case 21: return "R_SPARC_JMP_SLOT"; 725 case 22: return "R_SPARC_RELATIVE"; 726 case 23: return "R_SPARC_UA32"; 727 case 24: return "R_SPARC_PLT32"; 728 case 25: return "R_SPARC_HIPLT22"; 729 case 26: return "R_SPARC_LOPLT10"; 730 case 27: return "R_SPARC_PCPLT32"; 731 case 28: return "R_SPARC_PCPLT22"; 732 case 29: return "R_SPARC_PCPLT10"; 733 case 30: return "R_SPARC_10"; 734 case 31: return "R_SPARC_11"; 735 case 32: return "R_SPARC_64"; 736 case 33: return "R_SPARC_OLO10"; 737 case 34: return "R_SPARC_HH22"; 738 case 35: return "R_SPARC_HM10"; 739 case 36: return "R_SPARC_LM22"; 740 case 37: return "R_SPARC_PC_HH22"; 741 case 38: return "R_SPARC_PC_HM10"; 742 case 39: return "R_SPARC_PC_LM22"; 743 case 40: return "R_SPARC_WDISP16"; 744 case 41: return "R_SPARC_WDISP19"; 745 case 42: return "R_SPARC_GLOB_JMP"; 746 case 43: return "R_SPARC_7"; 747 case 44: return "R_SPARC_5"; 748 case 45: return "R_SPARC_6"; 749 case 46: return "R_SPARC_DISP64"; 750 case 47: return "R_SPARC_PLT64"; 751 case 48: return "R_SPARC_HIX22"; 752 case 49: return "R_SPARC_LOX10"; 753 case 50: return "R_SPARC_H44"; 754 case 51: return "R_SPARC_M44"; 755 case 52: return "R_SPARC_L44"; 756 case 53: return "R_SPARC_REGISTER"; 757 case 54: return "R_SPARC_UA64"; 758 case 55: return "R_SPARC_UA16"; 759 case 56: return "R_SPARC_TLS_GD_HI22"; 760 case 57: return "R_SPARC_TLS_GD_LO10"; 761 case 58: return "R_SPARC_TLS_GD_ADD"; 762 case 59: return "R_SPARC_TLS_GD_CALL"; 763 case 60: return "R_SPARC_TLS_LDM_HI22"; 764 case 61: return "R_SPARC_TLS_LDM_LO10"; 765 case 62: return "R_SPARC_TLS_LDM_ADD"; 766 case 63: return "R_SPARC_TLS_LDM_CALL"; 767 case 64: return "R_SPARC_TLS_LDO_HIX22"; 768 case 65: return "R_SPARC_TLS_LDO_LOX10"; 769 case 66: return "R_SPARC_TLS_LDO_ADD"; 770 case 67: return "R_SPARC_TLS_IE_HI22"; 771 case 68: return "R_SPARC_TLS_IE_LO10"; 772 case 69: return "R_SPARC_TLS_IE_LD"; 773 case 70: return "R_SPARC_TLS_IE_LDX"; 774 case 71: return "R_SPARC_TLS_IE_ADD"; 775 case 72: return "R_SPARC_TLS_LE_HIX22"; 776 case 73: return "R_SPARC_TLS_LE_LOX10"; 777 case 74: return "R_SPARC_TLS_DTPMOD32"; 778 case 75: return "R_SPARC_TLS_DTPMOD64"; 779 case 76: return "R_SPARC_TLS_DTPOFF32"; 780 case 77: return "R_SPARC_TLS_DTPOFF64"; 781 case 78: return "R_SPARC_TLS_TPOFF32"; 782 case 79: return "R_SPARC_TLS_TPOFF64"; 783 } 784 break; 785 case EM_X86_64: 786 switch(type) { 787 case 0: return "R_X86_64_NONE"; 788 case 1: return "R_X86_64_64"; 789 case 2: return "R_X86_64_PC32"; 790 case 3: return "R_X86_64_GOT32"; 791 case 4: return "R_X86_64_PLT32"; 792 case 5: return "R_X86_64_COPY"; 793 case 6: return "R_X86_64_GLOB_DAT"; 794 case 7: return "R_X86_64_JUMP_SLOT"; 795 case 8: return "R_X86_64_RELATIVE"; 796 case 9: return "R_X86_64_GOTPCREL"; 797 case 10: return "R_X86_64_32"; 798 case 11: return "R_X86_64_32S"; 799 case 12: return "R_X86_64_16"; 800 case 13: return "R_X86_64_PC16"; 801 case 14: return "R_X86_64_8"; 802 case 15: return "R_X86_64_PC8"; 803 case 16: return "R_X86_64_DTPMOD64"; 804 case 17: return "R_X86_64_DTPOFF64"; 805 case 18: return "R_X86_64_TPOFF64"; 806 case 19: return "R_X86_64_TLSGD"; 807 case 20: return "R_X86_64_TLSLD"; 808 case 21: return "R_X86_64_DTPOFF32"; 809 case 22: return "R_X86_64_GOTTPOFF"; 810 case 23: return "R_X86_64_TPOFF32"; 811 case 24: return "R_X86_64_PC64"; 812 case 25: return "R_X86_64_GOTOFF64"; 813 case 26: return "R_X86_64_GOTPC32"; 814 case 27: return "R_X86_64_GOT64"; 815 case 28: return "R_X86_64_GOTPCREL64"; 816 case 29: return "R_X86_64_GOTPC64"; 817 case 30: return "R_X86_64_GOTPLT64"; 818 case 31: return "R_X86_64_PLTOFF64"; 819 case 32: return "R_X86_64_SIZE32"; 820 case 33: return "R_X86_64_SIZE64"; 821 case 34: return "R_X86_64_GOTPC32_TLSDESC"; 822 case 35: return "R_X86_64_TLSDESC_CALL"; 823 case 36: return "R_X86_64_TLSDESC"; 824 case 37: return "R_X86_64_IRELATIVE"; 825 case 38: return "R_X86_64_RELATIVE64"; 826 case 41: return "R_X86_64_GOTPCRELX"; 827 case 42: return "R_X86_64_REX_GOTPCRELX"; 828 } 829 break; 830 } 831 832 snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type); 833 return (s_type); 834 } 835