3 void die(char *fmt
, ...)
7 vfprintf(stderr
, fmt
, ap
);
12 static void usage(void)
14 die("relocs [--abs-syms|--abs-relocs|--text|--realmode] vmlinux\n");
17 int main(int argc
, char **argv
)
19 int show_absolute_syms
, show_absolute_relocs
;
20 int as_text
, use_real_mode
;
24 unsigned char e_ident
[EI_NIDENT
];
26 show_absolute_syms
= 0;
27 show_absolute_relocs
= 0;
31 for (i
= 1; i
< argc
; i
++) {
34 if (strcmp(arg
, "--abs-syms") == 0) {
35 show_absolute_syms
= 1;
38 if (strcmp(arg
, "--abs-relocs") == 0) {
39 show_absolute_relocs
= 1;
42 if (strcmp(arg
, "--text") == 0) {
46 if (strcmp(arg
, "--realmode") == 0) {
60 fp
= fopen(fname
, "r");
62 die("Cannot open %s: %s\n", fname
, strerror(errno
));
64 if (fread(&e_ident
, 1, EI_NIDENT
, fp
) != EI_NIDENT
) {
65 die("Cannot read %s: %s", fname
, strerror(errno
));
68 if (e_ident
[EI_CLASS
] == ELFCLASS64
)
69 process_64(fp
, use_real_mode
, as_text
,
70 show_absolute_syms
, show_absolute_relocs
);
72 process_32(fp
, use_real_mode
, as_text
,
73 show_absolute_syms
, show_absolute_relocs
);