3 void die(char *fmt
, ...)
7 vfprintf(stderr
, fmt
, ap
);
12 static void usage(void)
14 die("relocs [--abs-syms|--abs-relocs|--reloc-info|--text|--realmode]" \
18 int main(int argc
, char **argv
)
20 int show_absolute_syms
, show_absolute_relocs
, show_reloc_info
;
21 int as_text
, use_real_mode
;
25 unsigned char e_ident
[EI_NIDENT
];
27 show_absolute_syms
= 0;
28 show_absolute_relocs
= 0;
33 for (i
= 1; i
< argc
; i
++) {
36 if (strcmp(arg
, "--abs-syms") == 0) {
37 show_absolute_syms
= 1;
40 if (strcmp(arg
, "--abs-relocs") == 0) {
41 show_absolute_relocs
= 1;
44 if (strcmp(arg
, "--reloc-info") == 0) {
48 if (strcmp(arg
, "--text") == 0) {
52 if (strcmp(arg
, "--realmode") == 0) {
66 fp
= fopen(fname
, "r");
68 die("Cannot open %s: %s\n", fname
, strerror(errno
));
70 if (fread(&e_ident
, 1, EI_NIDENT
, fp
) != EI_NIDENT
) {
71 die("Cannot read %s: %s", fname
, strerror(errno
));
74 if (e_ident
[EI_CLASS
] == ELFCLASS64
)
75 process_64(fp
, use_real_mode
, as_text
,
76 show_absolute_syms
, show_absolute_relocs
,
79 process_32(fp
, use_real_mode
, as_text
,
80 show_absolute_syms
, show_absolute_relocs
,