13 void die(char *fmt, ...)
18 vfprintf(stderr, fmt, ap);
23 static void usage(void)
25 die("relocs [--reloc-info|--text|--bin|--keep] vmlinux\n");
28 int main(int argc, char **argv)
30 int show_reloc_info, as_text, as_bin, keep_relocs;
34 unsigned char e_ident[EI_NIDENT];
41 for (i = 1; i < argc; i++) {
45 if (strcmp(arg, "--reloc-info") == 0) {
49 if (strcmp(arg, "--text") == 0) {
53 if (strcmp(arg, "--bin") == 0) {
57 if (strcmp(arg, "--keep") == 0) {
70 fp = fopen(fname, "r+");
72 die("Cannot open %s: %s\n", fname, strerror(errno));
74 if (fread(&e_ident, 1, EI_NIDENT, fp) != EI_NIDENT)
75 die("Cannot read %s: %s", fname, strerror(errno));
78 if (e_ident[EI_CLASS] == ELFCLASS64)
79 process_64(fp, as_text, as_bin, show_reloc_info, keep_relocs);
81 process_32(fp, as_text, as_bin, show_reloc_info, keep_relocs);