12 process_section(bfd *abfd, asection *sect, PTR obj)
14 printf("Section '%s':\n", sect->name);
16 printf("\tindex=%d, flags=%x\n", sect->index, sect->flags);
19 printf("\tuser_set_vma=%u, reloc_done=%u, linker_mark=%u, gc_mark=%u\n",
20 (unsigned long)sect->user_set_vma, (unsigned long)sect->reloc_done,
21 (unsigned long)sect->linker_mark, (unsigned long)sect->gc_mark);
23 printf("\tuser_set_vma=%u, reloc_done=%u\n",
24 (unsigned int)sect->user_set_vma, (unsigned int)sect->reloc_done);
27 printf("\tvma=%08lx, lma=%08lx\n",
28 (unsigned long)sect->vma, (unsigned long)sect->lma);
30 printf("\tcooked_size=%ld, raw_size=%ld, output_offset=%ld\n",
31 (long)sect->_cooked_size, (long)sect->_raw_size,
32 (long)sect->output_offset);
34 printf("\talignment_power=%d, reloc_count=%d, filepos=%ld\n",
35 sect->alignment_power, sect->reloc_count, sect->filepos);
37 printf("\trel_filepos=%ld, line_filepos=%ld, lineno_count=%d\n",
38 sect->rel_filepos, sect->line_filepos, sect->lineno_count);
40 printf("\tmoving_line_filepos=%ld, target_index=%d\n",
41 sect->moving_line_filepos, sect->target_index);
45 main(int ac, char **av)
51 if ((pname = strrchr(av[0], '/')) == NULL)
56 while ((c = getopt(ac, av, "v")) != EOF)
65 fprintf(stderr, "Usage: %s [-v] imagefile\n", pname);
74 fprintf(stderr, "Opening file...\n");
76 if ((ifd = open(ifn, O_RDONLY)) < 0)
77 Perror("can't open image file '%s'", ifn);
79 if ((bfdp = bfd_fdopenr(ifn, "elf32-powerpc", ifd)) == NULL) {
82 Error("bfd_fdopenr of file '%s' failed", ifn);
86 if (!bfd_check_format(bfdp, bfd_object) ||
87 (bfd_get_file_flags(bfdp) & EXEC_P) == 0) {
89 Error("file '%s' is not an executable object file (%s,0x%x)", ifn,
90 bfd_format_string(bfd_get_format(bfdp)), bfd_get_file_flags(bfdp));
93 printf("file '%s' is type '%s'...\n", ifn, bfd_get_target(bfdp));
95 bfd_map_over_sections(bfdp, process_section, NULL);;
100 fprintf(stderr, "Done.\n");