From 27fb8f2933cd65eb68179a79f0078034f20cfb2c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 29 Nov 1995 18:46:07 +0000 Subject: [PATCH] * 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. --- bfd/ChangeLog | 5 +++++ bfd/elf.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++ bfd/elfxx-target.h | 2 +- 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0411cedb277..7e5b6947f36 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ Wed Nov 29 12:42:36 1995 Ian Lance Taylor + * 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. diff --git a/bfd/elf.c b/bfd/elf.c index 083f8d2c07b..b00997fa525 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -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) diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 5ef3ed0d393..e719d0d5fa2 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -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 \ -- 2.34.1