1 /* objdump.c -- dump information about an object file.
2 Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Diddler.
6 BFD is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 BFD is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with BFD; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 * Until there is other documentation, refer to the manual page dump(1) in
22 * the system 5 program's reference manual
32 #define ELF_STAB_DISPLAY /* This code works, but uses internal
33 bfd and elf stuff. Flip this define
34 off if you need to just use generic
37 #ifdef ELF_STAB_DISPLAY
38 /* Internal headers for the ELF .stab-dump code - sorry. */
39 #define BYTES_IN_WORD 32
40 #include "aout/aout64.h"
41 #include "elf/internal.h"
42 extern Elf_Internal_Shdr
*bfd_elf_find_section();
43 #endif /* ELF_STAB_DISPLAY */
45 extern char *xmalloc ();
46 extern int fprintf
PARAMS ((FILE *, CONST
char *, ...));
48 char *default_target
= NULL
; /* default at runtime */
50 extern *program_version
;
51 char *program_name
= NULL
;
53 int show_version
= 0; /* show the version number */
54 int dump_section_contents
; /* -s */
55 int dump_section_headers
; /* -h */
56 boolean dump_file_header
; /* -f */
57 int dump_symtab
; /* -t */
58 int dump_reloc_info
; /* -r */
59 int dump_ar_hdrs
; /* -a */
60 int with_line_numbers
; /* -l */
61 int dump_stab_section_info
; /* -stabs */
62 boolean disassemble
; /* -d */
63 boolean info
; /* -i */
66 char *machine
= (char *) NULL
;
72 unsigned int symcount
= 0;
74 /* Forward declarations. */
77 display_file
PARAMS ((char *filename
, char *target
));
80 dump_data
PARAMS ((bfd
*abfd
));
83 dump_relocs
PARAMS ((bfd
*abfd
));
86 dump_symbols
PARAMS ((bfd
*abfd
));
91 fprintf (stderr
, "objdump %s\n\
92 Usage: %s [-ahifdrtxsl] [-m machine] [-j section_name] [-b bfdname]\n\
93 [--syms] [--reloc] [--header] [--version] objfile...\n",
94 program_version
, program_name
);
98 static struct option long_options
[]=
100 {"syms", no_argument
, &dump_symtab
, 1},
101 {"reloc", no_argument
, &dump_reloc_info
, 1},
102 {"header", no_argument
, &dump_section_headers
, 1},
103 {"version", no_argument
, &show_version
, 1},
104 #ifdef ELF_STAB_DISPLAY
105 {"stabs", no_argument
, &dump_stab_section_info
, 1},
107 {0, no_argument
, 0, 0}
117 for (section
= abfd
->sections
;
118 section
!= (asection
*) NULL
;
119 section
= section
->next
)
124 if (section->flags & x) { printf("%s%s",comma,y); comma = ", "; }
127 printf ("SECTION %d [%s]\t: size %08x",
130 (unsigned) bfd_get_section_size_before_reloc (section
));
132 printf_vma (section
->vma
);
133 printf (" align 2**%u\n ",
134 section
->alignment_power
);
135 PF (SEC_ALLOC
, "ALLOC");
136 PF (SEC_CONSTRUCTOR
, "CONSTRUCTOR");
137 PF (SEC_CONSTRUCTOR_TEXT
, "CONSTRUCTOR TEXT");
138 PF (SEC_CONSTRUCTOR_DATA
, "CONSTRUCTOR DATA");
139 PF (SEC_CONSTRUCTOR_BSS
, "CONSTRUCTOR BSS");
140 PF (SEC_LOAD
, "LOAD");
141 PF (SEC_RELOC
, "RELOC");
142 PF (SEC_BALIGN
, "BALIGN");
143 PF (SEC_READONLY
, "READONLY");
144 PF (SEC_CODE
, "CODE");
145 PF (SEC_DATA
, "DATA");
153 DEFUN (slurp_symtab
, (abfd
),
156 asymbol
**sy
= (asymbol
**) NULL
;
158 if (!(bfd_get_file_flags (abfd
) & HAS_SYMS
))
160 (void) printf ("No symbols in \"%s\".\n", bfd_get_filename (abfd
));
164 storage
= get_symtab_upper_bound (abfd
);
167 sy
= (asymbol
**) malloc (storage
);
170 fprintf (stderr
, "%s: out of memory.\n", program_name
);
174 symcount
= bfd_canonicalize_symtab (abfd
, sy
);
178 /* Sort symbols into value order */
184 asymbol
*a
= *(asymbol
**)ap
;
185 asymbol
*b
= *(asymbol
**)bp
;
189 if (a
->name
== (char *) NULL
|| (a
->flags
& (BSF_DEBUGGING
)))
192 a_bfd
= bfd_asymbol_bfd(a
);
193 if (b
->name
== (char *) NULL
|| (b
->flags
& (BSF_DEBUGGING
)))
196 b_bfd
= bfd_asymbol_bfd(b
);
198 diff
= a_bfd
- b_bfd
;
203 diff
= a
->value
- b
->value
;
208 return a
->section
- b
->section
;
211 /* Print the supplied address symbolically if possible */
213 objdump_print_address (vma
, info
)
215 struct disassemble_info
*info
;
217 /* Perform a binary search looking for the closest symbol to
218 the required value */
220 unsigned int min
= 0;
221 unsigned int max
= symcount
;
223 unsigned int thisplace
= 1;
224 unsigned int oldthisplace
;
230 fprintf_vma (info
->stream
, vma
);
236 oldthisplace
= thisplace
;
237 thisplace
= (max
+ min
) / 2;
238 if (thisplace
== oldthisplace
)
240 vardiff
= syms
[thisplace
]->value
- vma
;
243 /* Check that the value isn't merely a coincidence.
244 (if not checked, we might print some undefined symbol
245 for the address 0 rather than "main", for example. */
246 || !(syms
[thisplace
]->flags
& (BSF_GLOBAL
|BSF_LOCAL
)))
259 /* Totally awesome! the exact right symbol */
260 CONST
char *match_name
= syms
[thisplace
]->name
;
261 int sym_len
= strlen (match_name
);
263 /* Avoid "filename.o" as a match */
265 && match_name
[sym_len
- 2] == '.'
266 && match_name
[sym_len
- 1] == 'o'
267 && thisplace
+ 1 < symcount
268 && syms
[thisplace
+ 1]->value
== vma
)
269 match_name
= syms
[thisplace
+ 1]->name
;
270 /* Totally awesome! the exact right symbol */
271 fprintf_vma (info
->stream
, vma
);
272 fprintf (info
->stream
, " (%s+)0000", syms
[thisplace
]->name
);
276 /* We've run out of places to look, print the symbol before this one
277 see if this or the symbol before describes this location the best */
281 if (syms
[thisplace
- 1]->value
- vma
>
282 syms
[thisplace
]->value
- vma
)
284 /* Previous symbol is in correct section and is closer */
289 fprintf_vma (info
->stream
, vma
);
290 if (syms
[thisplace
]->value
> vma
)
292 fprintf (info
->stream
, " (%s-)", syms
[thisplace
]->name
);
293 fprintf (info
->stream
, "%04x", syms
[thisplace
]->value
- vma
);
297 fprintf (info
->stream
, " (%s+)", syms
[thisplace
]->name
);
298 fprintf (info
->stream
, "%04x", vma
- syms
[thisplace
]->value
);
304 disassemble_data (abfd
)
307 bfd_byte
*data
= NULL
;
308 bfd_arch_info_type
*info
;
309 bfd_size_type datasize
= 0;
311 unsigned int (*print
) ()= 0; /* Old style */
312 disassembler_ftype disassemble
= 0; /* New style */
313 unsigned int print_insn_h8300 ();
314 enum bfd_architecture a
;
315 struct disassemble_info disasm_info
;
318 CONST
char *prev_function
= "";
322 /* Replace symbol section relative values with abs values */
323 boolean done_dot
= false;
325 INIT_DISASSEMBLE_INFO(disasm_info
, stdout
);
326 disasm_info
.print_address_func
= objdump_print_address
;
328 for (i
= 0; i
< symcount
; i
++)
330 syms
[i
]->value
+= syms
[i
]->section
->vma
;
333 /* We keep a copy of the symbols in the original order */
334 syms2
= slurp_symtab (abfd
);
336 /* Sort the symbols into section and symbol order */
337 (void) qsort (syms
, symcount
, sizeof (asymbol
*), comp
);
339 /* Find the first useless symbol */
343 for (i
= 0; i
< symcount
; i
++)
345 if (syms
[i
]->name
== (char *) NULL
346 || (syms
[i
]->flags
& BSF_DEBUGGING
) != 0)
355 if (machine
!= (char *) NULL
)
357 info
= bfd_scan_arch (machine
);
360 fprintf (stderr
, "%s: Can't use supplied machine %s\n",
365 abfd
->arch_info
= info
;
368 /* See if we can disassemble using bfd */
370 if (abfd
->arch_info
->disassemble
)
372 print
= abfd
->arch_info
->disassemble
;
376 a
= bfd_get_arch (abfd
);
380 disassemble
= print_insn_sparc
;
383 if (bfd_get_mach(abfd
) == bfd_mach_z8001
)
384 disassemble
= print_insn_z8001
;
386 disassemble
= print_insn_z8002
;
389 disassemble
= print_insn_i386
;
392 disassemble
= print_insn_h8500
;
395 disassemble
= print_insn_sh
;
398 disassemble
= print_insn_alpha
;
401 disassemble
= print_insn_m68k
;
404 /* As far as I know we only handle big-endian 29k objects. */
405 disassemble
= print_insn_big_a29k
;
408 disassemble
= print_insn_i960
;
411 if (abfd
->xvec
->byteorder_big_p
)
412 disassemble
= print_insn_big_mips
;
414 disassemble
= print_insn_little_mips
;
417 fprintf (stderr
, "%s: Can't disassemble for architecture %s\n",
419 bfd_printable_arch_mach (bfd_get_arch (abfd
), 0));
425 for (section
= abfd
->sections
;
426 section
!= (asection
*) NULL
;
427 section
= section
->next
)
430 if ((section
->flags
& SEC_LOAD
)
431 && (only
== (char *) NULL
|| strcmp (only
, section
->name
) == 0))
433 printf ("Disassembly of section %s:\n", section
->name
);
435 if (bfd_get_section_size_before_reloc (section
) == 0)
438 data
= (bfd_byte
*) malloc (bfd_get_section_size_before_reloc (section
));
440 if (data
== (bfd_byte
*) NULL
)
442 fprintf (stderr
, "%s: memory exhausted.\n", program_name
);
445 datasize
= bfd_get_section_size_before_reloc (section
);
447 bfd_get_section_contents (abfd
, section
, data
, 0, bfd_get_section_size_before_reloc (section
));
449 disasm_info
.buffer
= data
;
450 disasm_info
.buffer_vma
= section
->vma
;
451 disasm_info
.buffer_length
=
452 bfd_get_section_size_before_reloc (section
);
454 while (i
< disasm_info
.buffer_length
)
456 if (data
[i
] == 0 && data
[i
+ 1] == 0 && data
[i
+ 2] == 0 &&
459 if (done_dot
== false)
469 if (with_line_numbers
)
471 CONST
char *filename
;
472 CONST
char *functionname
;
475 if (bfd_find_nearest_line (abfd
,
483 if (functionname
&& *functionname
484 && strcmp(functionname
, prev_function
))
486 printf ("%s():\n", functionname
);
487 prev_function
= functionname
;
491 if (line
&& line
!= prevline
)
493 printf ("%s:%u\n", filename
, line
);
498 objdump_print_address (section
->vma
+ i
, &disasm_info
);
501 if (disassemble
) /* New style */
503 int bytes
= (*disassemble
)(section
->vma
+ i
,
510 i
+= print (section
->vma
+ i
,
521 #ifdef ELF_STAB_DISPLAY
523 /* Define a table of stab values and print-strings. We wish the initializer
524 could be a direct-mapped table, but instead we build one the first
527 #define STAB_STRING_LENGTH 6
529 char stab_name
[256][STAB_STRING_LENGTH
];
533 char string
[STAB_STRING_LENGTH
];
536 struct stab_print stab_print
[] = {
537 #define __define_stab(NAME, CODE, STRING) {CODE, STRING},
538 #include "aout/stab.def"
543 void dump_elf_stabs_1 ();
545 /* This is a kludge for dumping the stabs section from an ELF file that
546 uses Sun stabs encoding. It has to use some hooks into BFD because
547 string table sections are not normally visible to BFD callers. */
550 dump_elf_stabs (abfd
)
555 /* Initialize stab name array if first time. */
556 if (stab_name
[0][0] == 0)
558 /* Fill in numeric values for all possible strings. */
559 for (i
= 0; i
< 256; i
++)
561 sprintf (stab_name
[i
], "%d", i
);
563 for (i
= 0; stab_print
[i
].string
[0]; i
++)
564 strcpy (stab_name
[stab_print
[i
].value
], stab_print
[i
].string
);
567 if (0 != strncmp ("elf", abfd
->xvec
->name
, 3))
569 fprintf (stderr
, "%s: %s is not in ELF format.\n", program_name
,
574 dump_elf_stabs_1 (abfd
, ".stab", ".stabstr");
575 dump_elf_stabs_1 (abfd
, ".stab.excl", ".stab.exclstr");
576 dump_elf_stabs_1 (abfd
, ".stab.index", ".stab.indexstr");
580 dump_elf_stabs_1 (abfd
, name1
, name2
)
582 char *name1
; /* Section name of .stab */
583 char *name2
; /* Section name of its string section */
585 Elf_Internal_Shdr
*stab_hdr
, *stabstr_hdr
;
587 struct internal_nlist
*stabs
, *stabs_end
;
589 unsigned file_string_table_offset
, next_file_string_table_offset
;
591 stab_hdr
= bfd_elf_find_section (abfd
, name1
);
594 printf ("Contents of %s section: none.\n\n", name1
);
598 stabstr_hdr
= bfd_elf_find_section (abfd
, name2
);
599 if (0 == stabstr_hdr
)
601 fprintf (stderr
, "%s: %s has no %s section.\n", program_name
,
602 abfd
->filename
, name2
);
606 stabs
= (struct internal_nlist
*) xmalloc (stab_hdr
->sh_size
);
607 strtab
= (char *) xmalloc (stabstr_hdr
->sh_size
);
608 stabs_end
= (struct internal_nlist
*) (stab_hdr
->sh_size
+ (char *)stabs
);
610 if (bfd_seek (abfd
, stab_hdr
->sh_offset
, SEEK_SET
) < 0 ||
611 stab_hdr
->sh_size
!= bfd_read ((PTR
)stabs
, stab_hdr
->sh_size
, 1, abfd
))
613 fprintf (stderr
, "%s: reading %s section of %s failed.\n",
619 if (bfd_seek (abfd
, stabstr_hdr
->sh_offset
, SEEK_SET
) < 0 ||
620 stabstr_hdr
->sh_size
!= bfd_read ((PTR
)strtab
, stabstr_hdr
->sh_size
,
623 fprintf (stderr
, "%s: reading %s section of %s failed.\n",
629 #define SWAP_SYMBOL(symp, abfd) \
631 (symp)->n_strx = bfd_h_get_32(abfd, \
632 (unsigned char *)&(symp)->n_strx); \
633 (symp)->n_desc = bfd_h_get_16 (abfd, \
634 (unsigned char *)&(symp)->n_desc); \
635 (symp)->n_value = bfd_h_get_32 (abfd, \
636 (unsigned char *)&(symp)->n_value); \
639 printf ("Contents of %s section:\n\n", name1
);
640 printf ("Symnum n_type n_othr n_desc n_value n_strx String\n");
642 file_string_table_offset
= 0;
643 next_file_string_table_offset
= 0;
645 /* Loop through all symbols and print them.
647 We start the index at -1 because there is a dummy symbol on
648 the front of Sun's stabs-in-elf sections. */
650 for (i
= -1; stabs
< stabs_end
; stabs
++, i
++)
652 SWAP_SYMBOL (stabs
, abfd
);
653 printf ("\n%-6d %-6s %-6d %-6d %08x %-6d", i
,
654 stab_name
[stabs
->n_type
],
655 stabs
->n_other
, stabs
->n_desc
, stabs
->n_value
,
658 /* Symbols with type == 0 (N_UNDF) specify the length of the
659 string table associated with this file. We use that info
660 to know how to relocate the *next* file's string table indices. */
662 if (stabs
->n_type
== N_UNDF
)
664 file_string_table_offset
= next_file_string_table_offset
;
665 next_file_string_table_offset
+= stabs
->n_value
;
668 /* Now, using the possibly updated string table offset, print the
669 string (if any) associated with this symbol. */
671 if ((stabs
->n_strx
+ file_string_table_offset
) < stabstr_hdr
->sh_size
)
672 printf (" %s", &strtab
[stabs
->n_strx
+ file_string_table_offset
]);
678 #endif /* ELF_STAB_DISPLAY */
684 if (!bfd_check_format (abfd
, bfd_object
))
686 fprintf (stderr
, "%s: %s not an object file\n", program_name
,
690 printf ("\n%s: file format %s\n", abfd
->filename
, abfd
->xvec
->name
);
692 print_arelt_descr (stdout
, abfd
, true);
694 if (dump_file_header
)
698 printf ("architecture: %s, ",
699 bfd_printable_arch_mach (bfd_get_arch (abfd
),
700 bfd_get_mach (abfd
)));
701 printf ("flags 0x%08x:\n", abfd
->flags
);
703 #define PF(x, y) if (abfd->flags & x) {printf("%s%s", comma, y); comma=", ";}
704 PF (HAS_RELOC
, "HAS_RELOC");
705 PF (EXEC_P
, "EXEC_P");
706 PF (HAS_LINENO
, "HAS_LINENO");
707 PF (HAS_DEBUG
, "HAS_DEBUG");
708 PF (HAS_SYMS
, "HAS_SYMS");
709 PF (HAS_LOCALS
, "HAS_LOCALS");
710 PF (DYNAMIC
, "DYNAMIC");
711 PF (WP_TEXT
, "WP_TEXT");
712 PF (D_PAGED
, "D_PAGED");
713 PF (BFD_IS_RELAXABLE
, "BFD_IS_RELAXABLE");
714 printf ("\nstart address 0x");
715 printf_vma (abfd
->start_address
);
719 if (dump_section_headers
)
721 if (dump_symtab
|| dump_reloc_info
|| disassemble
)
723 syms
= slurp_symtab (abfd
);
727 #ifdef ELF_STAB_DISPLAY
728 if (dump_stab_section_info
)
729 dump_elf_stabs (abfd
);
733 if (dump_section_contents
)
736 disassemble_data (abfd
);
740 display_file (filename
, target
)
744 bfd
*file
, *arfile
= (bfd
*) NULL
;
746 file
= bfd_openr (filename
, target
);
749 fprintf (stderr
, "%s: ", program_name
);
750 bfd_perror (filename
);
754 if (bfd_check_format (file
, bfd_archive
) == true)
756 printf ("In archive %s:\n", bfd_get_filename (file
));
759 bfd_error
= no_error
;
761 arfile
= bfd_openr_next_archived_file (file
, arfile
);
764 if (bfd_error
!= no_more_archived_files
)
766 fprintf (stderr
, "%s: ", program_name
);
767 bfd_perror (bfd_get_filename (file
));
772 display_bfd (arfile
);
773 /* Don't close the archive elements; we need them for next_archive */
782 /* Actually display the various requested regions */
790 bfd_size_type datasize
= 0;
793 for (section
= abfd
->sections
; section
!= NULL
; section
=
798 if (only
== (char *) NULL
||
799 strcmp (only
, section
->name
) == 0)
801 if (section
->flags
& SEC_HAS_CONTENTS
)
803 printf ("Contents of section %s:\n", section
->name
);
805 if (bfd_get_section_size_before_reloc (section
) == 0)
807 data
= (bfd_byte
*) malloc (bfd_get_section_size_before_reloc (section
));
808 if (data
== (bfd_byte
*) NULL
)
810 fprintf (stderr
, "%s: memory exhausted.\n", program_name
);
813 datasize
= bfd_get_section_size_before_reloc (section
);
816 bfd_get_section_contents (abfd
, section
, (PTR
) data
, 0, bfd_get_section_size_before_reloc (section
));
818 for (i
= 0; i
< bfd_get_section_size_before_reloc (section
); i
+= onaline
)
822 printf (" %04lx ", (unsigned long int) (i
+ section
->vma
));
823 for (j
= i
; j
< i
+ onaline
; j
++)
825 if (j
< bfd_get_section_size_before_reloc (section
))
826 printf ("%02x", (unsigned) (data
[j
]));
834 for (j
= i
; j
< i
+ onaline
; j
++)
836 if (j
>= bfd_get_section_size_before_reloc (section
))
839 printf ("%c", isprint (data
[j
]) ? data
[j
] : '.');
849 /* Should perhaps share code and display with nm? */
856 asymbol
**current
= syms
;
858 printf ("SYMBOL TABLE:\n");
860 for (count
= 0; count
< symcount
; count
++)
865 bfd
*cur_bfd
= bfd_asymbol_bfd(*current
);
868 bfd_print_symbol (cur_bfd
,
870 *current
, bfd_print_symbol_all
);
886 unsigned int relcount
;
889 for (a
= abfd
->sections
; a
!= (asection
*) NULL
; a
= a
->next
)
891 if (a
== &bfd_abs_section
)
893 if (a
== &bfd_und_section
)
895 if (bfd_is_com_section (a
))
898 printf ("RELOCATION RECORDS FOR [%s]:", a
->name
);
900 if (bfd_get_reloc_upper_bound (abfd
, a
) == 0)
902 printf (" (none)\n\n");
908 relpp
= (arelent
**) xmalloc (bfd_get_reloc_upper_bound (abfd
, a
));
909 relcount
= bfd_canonicalize_reloc (abfd
, a
, relpp
, syms
);
912 printf (" (none)\n\n");
917 printf ("OFFSET TYPE VALUE \n");
919 for (p
= relpp
; relcount
&& *p
!= (arelent
*) NULL
; p
++,
923 CONST
char *sym_name
;
925 /* CONST char *section_name = q->section == (asection *)NULL ? "*abs" :*/
926 /* q->section->name;*/
927 CONST
char *section_name
= (*(q
->sym_ptr_ptr
))->section
->name
;
929 if (q
->sym_ptr_ptr
&& *q
->sym_ptr_ptr
)
931 sym_name
= (*(q
->sym_ptr_ptr
))->name
;
939 printf_vma (q
->address
);
946 printf_vma (q
->address
);
947 printf (" %-8s [%s]",
954 printf_vma (q
->addend
);
967 #define _DUMMY_NAME_ "/dev/null"
969 #define _DUMMY_NAME_ "##dummy"
972 DEFUN (display_info_table
, (first
, last
),
973 int first AND
int last
)
976 extern bfd_target
*target_vector
[];
978 printf ("\n%12s", " ");
979 for (i
= first
; i
++ < last
&& target_vector
[i
];)
980 printf ("%s ", target_vector
[i
]->name
);
983 for (j
= (int) bfd_arch_obscure
+ 1; (int) j
< (int) bfd_arch_last
; j
++)
984 if (strcmp (bfd_printable_arch_mach (j
, 0), "UNKNOWN!") != 0)
986 printf ("%11s ", bfd_printable_arch_mach (j
, 0));
987 for (i
= first
; i
++ < last
&& target_vector
[i
];)
989 bfd_target
*p
= target_vector
[i
];
990 bfd
*abfd
= bfd_openw (_DUMMY_NAME_
, p
->name
);
991 int l
= strlen (p
->name
);
993 bfd_set_format (abfd
, bfd_object
);
994 ok
= bfd_set_arch_mach (abfd
, j
, 0);
997 printf ("%s ", p
->name
);
1001 printf ("%c", ok
? '*' : '-');
1010 DEFUN_VOID (display_info
)
1013 unsigned int i
, j
, columns
;
1014 extern bfd_target
*target_vector
[];
1015 extern char *getenv ();
1017 printf ("BFD header file version %s\n", BFD_VERSION
);
1018 for (i
= 0; target_vector
[i
]; i
++)
1020 bfd_target
*p
= target_vector
[i
];
1021 bfd
*abfd
= bfd_openw (_DUMMY_NAME_
, p
->name
);
1022 bfd_set_format (abfd
, bfd_object
);
1023 printf ("%s\n (header %s, data %s)\n", p
->name
,
1024 p
->header_byteorder_big_p
? "big endian" : "little endian",
1025 p
->byteorder_big_p
? "big endian" : "little endian");
1026 for (j
= (int) bfd_arch_obscure
+ 1; j
< (int) bfd_arch_last
; j
++)
1027 if (bfd_set_arch_mach (abfd
, (enum bfd_architecture
) j
, 0))
1029 bfd_printable_arch_mach ((enum bfd_architecture
) j
, 0));
1032 if (colum
= getenv ("COLUMNS"))
1033 columns
= atoi (colum
);
1036 for (i
= 0; target_vector
[i
];)
1040 for (j
= 12; target_vector
[i
] && j
< columns
; i
++)
1041 j
+= strlen (target_vector
[i
]->name
) + 1;
1045 display_info_table (old
, i
);
1049 /** main and like trivia */
1057 extern char *optarg
;
1058 char *target
= default_target
;
1059 boolean seenflag
= false;
1062 program_name
= *argv
;
1064 while ((c
= getopt_long (argc
, argv
, "ib:m:Vdlfahrtxsj:", long_options
,
1078 with_line_numbers
= 1;
1084 dump_file_header
= true;
1091 dump_reloc_info
= 1;
1092 dump_file_header
= true;
1094 dump_section_headers
= 1;
1097 break; /* we've been given a long option */
1105 dump_section_contents
= 1;
1108 dump_reloc_info
= 1;
1114 dump_section_headers
= 1;
1125 printf ("%s version %s\n", program_name
, program_version
);
1127 if (seenflag
== false)
1137 display_file ("a.out", target
);
1139 for (; optind
< argc
;)
1140 display_file (argv
[optind
++], target
);