18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef RELOCS_H 38c2ecf20Sopenharmony_ci#define RELOCS_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <stdio.h> 68c2ecf20Sopenharmony_ci#include <stdarg.h> 78c2ecf20Sopenharmony_ci#include <stdlib.h> 88c2ecf20Sopenharmony_ci#include <stdint.h> 98c2ecf20Sopenharmony_ci#include <inttypes.h> 108c2ecf20Sopenharmony_ci#include <string.h> 118c2ecf20Sopenharmony_ci#include <errno.h> 128c2ecf20Sopenharmony_ci#include <unistd.h> 138c2ecf20Sopenharmony_ci#include <elf.h> 148c2ecf20Sopenharmony_ci#include <byteswap.h> 158c2ecf20Sopenharmony_ci#include <endian.h> 168c2ecf20Sopenharmony_ci#include <regex.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_civoid die(char *fmt, ...); 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#ifndef EM_LOONGARCH 218c2ecf20Sopenharmony_ci#define EM_LOONGARCH 258 228c2ecf20Sopenharmony_ci#endif 238c2ecf20Sopenharmony_ci#define R_LARCH_NONE 0 248c2ecf20Sopenharmony_ci#define R_LARCH_32 1 258c2ecf20Sopenharmony_ci#define R_LARCH_64 2 268c2ecf20Sopenharmony_ci#define R_LARCH_MARK_LA 20 278c2ecf20Sopenharmony_ci#define R_LARCH_MARK_PCREL 21 288c2ecf20Sopenharmony_ci#define R_LARCH_SOP_PUSH_PCREL 22 298c2ecf20Sopenharmony_ci#define R_LARCH_SOP_PUSH_ABSOLUTE 23 308c2ecf20Sopenharmony_ci#define R_LARCH_SOP_PUSH_DUP 24 318c2ecf20Sopenharmony_ci#define R_LARCH_SOP_PUSH_PLT_PCREL 29 328c2ecf20Sopenharmony_ci#define R_LARCH_SOP_SUB 32 338c2ecf20Sopenharmony_ci#define R_LARCH_SOP_SL 33 348c2ecf20Sopenharmony_ci#define R_LARCH_SOP_SR 34 358c2ecf20Sopenharmony_ci#define R_LARCH_SOP_ADD 35 368c2ecf20Sopenharmony_ci#define R_LARCH_SOP_AND 36 378c2ecf20Sopenharmony_ci#define R_LARCH_SOP_IF_ELSE 37 388c2ecf20Sopenharmony_ci#define R_LARCH_SOP_POP_32_S_10_5 38 398c2ecf20Sopenharmony_ci#define R_LARCH_SOP_POP_32_U_10_12 39 408c2ecf20Sopenharmony_ci#define R_LARCH_SOP_POP_32_S_10_12 40 418c2ecf20Sopenharmony_ci#define R_LARCH_SOP_POP_32_S_10_16 41 428c2ecf20Sopenharmony_ci#define R_LARCH_SOP_POP_32_S_10_16_S2 42 438c2ecf20Sopenharmony_ci#define R_LARCH_SOP_POP_32_S_5_20 43 448c2ecf20Sopenharmony_ci#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44 458c2ecf20Sopenharmony_ci#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45 468c2ecf20Sopenharmony_ci#define R_LARCH_SOP_POP_32_U 46 478c2ecf20Sopenharmony_ci#define R_LARCH_ADD32 50 488c2ecf20Sopenharmony_ci#define R_LARCH_ADD64 51 498c2ecf20Sopenharmony_ci#define R_LARCH_SUB32 55 508c2ecf20Sopenharmony_ci#define R_LARCH_SUB64 56 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_civoid process_32(FILE *fp, int as_text, int as_bin, 558c2ecf20Sopenharmony_ci int show_reloc_info, int keep_relocs); 568c2ecf20Sopenharmony_civoid process_64(FILE *fp, int as_text, int as_bin, 578c2ecf20Sopenharmony_ci int show_reloc_info, int keep_relocs); 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#endif /* RELOCS_H */ 60