5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
35 process_section(bfd *abfd, asection *sect, PTR obj)
37 printf("Section '%s':\n", sect->name);
39 printf("\tindex=%d, flags=%x\n", sect->index, sect->flags);
42 printf("\tuser_set_vma=%u, reloc_done=%u, linker_mark=%u, gc_mark=%u\n",
43 (unsigned long)sect->user_set_vma, (unsigned long)sect->reloc_done,
44 (unsigned long)sect->linker_mark, (unsigned long)sect->gc_mark);
46 printf("\tuser_set_vma=%u, reloc_done=%u\n",
47 (unsigned int)sect->user_set_vma, (unsigned int)sect->reloc_done);
50 printf("\tvma=%08lx, lma=%08lx\n",
51 (unsigned long)sect->vma, (unsigned long)sect->lma);
53 printf("\tcooked_size=%ld, raw_size=%ld, output_offset=%ld\n",
54 (long)sect->_cooked_size, (long)sect->_raw_size,
55 (long)sect->output_offset);
57 printf("\talignment_power=%d, reloc_count=%d, filepos=%ld\n",
58 sect->alignment_power, sect->reloc_count, sect->filepos);
60 printf("\trel_filepos=%ld, line_filepos=%ld, lineno_count=%d\n",
61 sect->rel_filepos, sect->line_filepos, sect->lineno_count);
63 printf("\tmoving_line_filepos=%ld, target_index=%d\n",
64 sect->moving_line_filepos, sect->target_index);
68 main(int ac, char **av)
74 if ((pname = strrchr(av[0], '/')) == NULL)
79 while ((c = getopt(ac, av, "v")) != EOF)
88 fprintf(stderr, "Usage: %s [-v] imagefile\n", pname);
97 fprintf(stderr, "Opening file...\n");
99 if ((ifd = open(ifn, O_RDONLY)) < 0)
100 Perror("can't open image file '%s'", ifn);
102 if ((bfdp = bfd_fdopenr(ifn, "elf32-powerpc", ifd)) == NULL) {
105 Error("bfd_fdopenr of file '%s' failed", ifn);
109 if (!bfd_check_format(bfdp, bfd_object) ||
110 (bfd_get_file_flags(bfdp) & EXEC_P) == 0) {
112 Error("file '%s' is not an executable object file (%s,0x%x)", ifn,
113 bfd_format_string(bfd_get_format(bfdp)), bfd_get_file_flags(bfdp));
116 printf("file '%s' is type '%s'...\n", ifn, bfd_get_target(bfdp));
118 bfd_map_over_sections(bfdp, process_section, NULL);;
123 fprintf(stderr, "Done.\n");