~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/tools/relocs_common.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 #include "relocs.h"
  3 
  4 void die(char *fmt, ...)
  5 {
  6         va_list ap;
  7         va_start(ap, fmt);
  8         vfprintf(stderr, fmt, ap);
  9         va_end(ap);
 10         exit(1);
 11 }
 12 
 13 static void usage(void)
 14 {
 15         die("relocs [--abs-syms|--abs-relocs|--reloc-info|--text|--realmode]" \
 16             " vmlinux\n");
 17 }
 18 
 19 int main(int argc, char **argv)
 20 {
 21         int show_absolute_syms, show_absolute_relocs, show_reloc_info;
 22         int as_text, use_real_mode;
 23         const char *fname;
 24         FILE *fp;
 25         int i;
 26         unsigned char e_ident[EI_NIDENT];
 27 
 28         show_absolute_syms = 0;
 29         show_absolute_relocs = 0;
 30         show_reloc_info = 0;
 31         as_text = 0;
 32         use_real_mode = 0;
 33         fname = NULL;
 34         for (i = 1; i < argc; i++) {
 35                 char *arg = argv[i];
 36                 if (*arg == '-') {
 37                         if (strcmp(arg, "--abs-syms") == 0) {
 38                                 show_absolute_syms = 1;
 39                                 continue;
 40                         }
 41                         if (strcmp(arg, "--abs-relocs") == 0) {
 42                                 show_absolute_relocs = 1;
 43                                 continue;
 44                         }
 45                         if (strcmp(arg, "--reloc-info") == 0) {
 46                                 show_reloc_info = 1;
 47                                 continue;
 48                         }
 49                         if (strcmp(arg, "--text") == 0) {
 50                                 as_text = 1;
 51                                 continue;
 52                         }
 53                         if (strcmp(arg, "--realmode") == 0) {
 54                                 use_real_mode = 1;
 55                                 continue;
 56                         }
 57                 }
 58                 else if (!fname) {
 59                         fname = arg;
 60                         continue;
 61                 }
 62                 usage();
 63         }
 64         if (!fname) {
 65                 usage();
 66         }
 67         fp = fopen(fname, "r");
 68         if (!fp) {
 69                 die("Cannot open %s: %s\n", fname, strerror(errno));
 70         }
 71         if (fread(&e_ident, 1, EI_NIDENT, fp) != EI_NIDENT) {
 72                 die("Cannot read %s: %s", fname, strerror(errno));
 73         }
 74         rewind(fp);
 75         if (e_ident[EI_CLASS] == ELFCLASS64)
 76                 process_64(fp, use_real_mode, as_text,
 77                            show_absolute_syms, show_absolute_relocs,
 78                            show_reloc_info);
 79         else
 80                 process_32(fp, use_real_mode, as_text,
 81                            show_absolute_syms, show_absolute_relocs,
 82                            show_reloc_info);
 83         fclose(fp);
 84         return 0;
 85 }
 86 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php