* elf.c (_bfd_elf_print_private_bfd_data): New function.

* elf-bfd.h (_bfd_elf_print_private_bfd_data): Declare.
	* elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define to
	_bfd_elf_print_private_bfd_data.
This commit is contained in:
Ian Lance Taylor 1995-11-29 18:46:07 +00:00
parent 77fa4d98a8
commit 27fb8f2933
3 changed files with 61 additions and 1 deletions

View File

@ -1,5 +1,10 @@
Wed Nov 29 12:42:36 1995 Ian Lance Taylor <ian@cygnus.com>
* elf.c (_bfd_elf_print_private_bfd_data): New function.
* elf-bfd.h (_bfd_elf_print_private_bfd_data): Declare.
* elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define to
_bfd_elf_print_private_bfd_data.
* coff-alpha.c (alpha_ecoff_swap_reloc_in): Don't abort if
r_symndx is RELOC_SECTION_NONE for an ALPHA_R_IGNORE reloc.
Change a RELOC_SECTION_LITA symndx to RELOC_SECTION_ABS.

View File

@ -330,6 +330,61 @@ bfd_elf_generic_reloc (abfd,
return bfd_reloc_continue;
}
/* Print out the program headers. */
boolean
_bfd_elf_print_private_bfd_data (abfd, farg)
bfd *abfd;
PTR farg;
{
FILE *f = (FILE *) farg;
Elf_Internal_Phdr *p;
unsigned int i, c;
p = elf_tdata (abfd)->phdr;
if (p == NULL)
return true;
c = elf_elfheader (abfd)->e_phnum;
for (i = 0; i < c; i++, p++)
{
const char *s;
char buf[20];
switch (p->p_type)
{
case PT_NULL: s = "NULL"; break;
case PT_LOAD: s = "LOAD"; break;
case PT_DYNAMIC: s = "DYNAMIC"; break;
case PT_INTERP: s = "INTERP"; break;
case PT_NOTE: s = "NOTE"; break;
case PT_SHLIB: s = "SHLIB"; break;
case PT_PHDR: s = "PHDR"; break;
default: sprintf (buf, "0x%lx", p->p_type); s = buf; break;
}
fprintf (f, "%8s off 0x", s);
fprintf_vma (f, p->p_offset);
fprintf (f, " vaddr 0x");
fprintf_vma (f, p->p_vaddr);
fprintf (f, " paddr 0x");
fprintf_vma (f, p->p_paddr);
fprintf (f, " align 2**%u\n", bfd_log2 (p->p_align));
fprintf (f, " filesz 0x");
fprintf_vma (f, p->p_filesz);
fprintf (f, " memsz 0x");
fprintf_vma (f, p->p_memsz);
fprintf (f, " flags %c%c%c",
(p->p_flags & PF_R) != 0 ? 'r' : '-',
(p->p_flags & PF_W) != 0 ? 'w' : '-',
(p->p_flags & PF_X) != 0 ? 'x' : '-');
if ((p->p_flags &~ (PF_R | PF_W | PF_X)) != 0)
fprintf (f, " %lx", p->p_flags &~ (PF_R | PF_W | PF_X));
fprintf (f, "\n");
}
return true;
}
/* Display ELF-specific fields of a symbol. */
void
bfd_elf_print_symbol (ignore_abfd, filep, symbol, how)

View File

@ -101,7 +101,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#ifndef bfd_elfNN_bfd_print_private_bfd_data
#define bfd_elfNN_bfd_print_private_bfd_data \
((boolean (*) PARAMS ((bfd *, void *))) bfd_true)
_bfd_elf_print_private_bfd_data
#endif
#ifndef bfd_elfNN_bfd_merge_private_bfd_data
#define bfd_elfNN_bfd_merge_private_bfd_data \