^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef RELOCS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define RELOCS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <stdarg.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <stdlib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <stdint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <inttypes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <elf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <byteswap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define USE_BSD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <endian.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <regex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) void die(char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * Introduced for MIPSr6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #ifndef R_MIPS_PC21_S2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define R_MIPS_PC21_S2 60
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #ifndef R_MIPS_PC26_S2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define R_MIPS_PC26_S2 61
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) enum symtype {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) S_ABS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) S_REL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) S_SEG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) S_LIN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) S_NSYMTYPES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void process_32(FILE *fp, int as_text, int as_bin,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) int show_reloc_info, int keep_relocs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void process_64(FILE *fp, int as_text, int as_bin,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int show_reloc_info, int keep_relocs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif /* RELOCS_H */