From ecc51f48c5f541514ee80befd8cb05cf16fed919 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 21 Feb 2003 12:17:51 +0000 Subject: [PATCH] Add SHT_IA_64_LOPSREG, SHT_IA_64_HIPSREG and SHT_IA_64_PRIORITY_INIT. Add code to display these values in readelf. --- binutils/ChangeLog | 11 ++++++++ binutils/readelf.c | 46 +++++++++++++++++++++++++++++-- include/elf/ChangeLog | 5 ++++ include/elf/ia64.h | 64 ++++++++++++++++++++++--------------------- 4 files changed, 93 insertions(+), 33 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 214b8c54164..4592d2a2ee3 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,14 @@ +2003-02-21 Ian Wienand + + * readelf.c (get_ia64_dynamic_type): New function. + (dynamic_segment_ia64_val): New function. + (get_dynamic_type): If machine type is EM_IA_64 call + get_ia64_dynamic_val. + (get_ia64_section_type_name): Handle sections with types in the + SHT_IA_64_LOPSREG to SHT_IA_64_HIPSREG range. + (get_dynamic_flags): If machine type is EM_IA_64 call + dynamic_segment_ia64_val. + 2003-02-21 Bob Wilson * doc/binutils.texi: Fix typos and obvious texinfo mistakes. Make diff --git a/binutils/readelf.c b/binutils/readelf.c index fa6aa578966..00a6d330fe7 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -179,6 +179,8 @@ static const char *get_ppc64_dynamic_type PARAMS ((unsigned long)); static const char *get_parisc_dynamic_type PARAMS ((unsigned long)); +static const char *get_ia64_dynamic_type + PARAMS ((unsigned long)); static const char *get_dynamic_type PARAMS ((unsigned long)); static int slurp_rela_relocs @@ -240,6 +242,8 @@ static void dynamic_segment_mips_val PARAMS ((Elf_Internal_Dyn *)); static void dynamic_segment_parisc_val PARAMS ((Elf_Internal_Dyn *)); +static void dynamic_segment_ia64_val + PARAMS ((Elf_Internal_Dyn *)); static int process_dynamic_segment PARAMS ((FILE *)); static int process_symbol_table @@ -1479,6 +1483,18 @@ get_parisc_dynamic_type (type) } } +static const char * +get_ia64_dynamic_type (type) + unsigned long type; +{ + switch (type) + { + case DT_IA_64_PLT_RESERVE: return "IA_64_PLT_RESERVE"; + default: + return NULL; + } +} + static const char * get_dynamic_type (type) unsigned long type; @@ -1576,6 +1592,9 @@ get_dynamic_type (type) case EM_PPC64: result = get_ppc64_dynamic_type (type); break; + case EM_IA_64: + result = get_ia64_dynamic_type (type); + break; default: result = NULL; break; @@ -2331,10 +2350,15 @@ static const char * get_ia64_section_type_name (sh_type) unsigned int sh_type; { + /* If the top 8 bits are 0x78 the next 8 are the os/abi ID. */ + if ((sh_type & 0xFF000000) == SHT_IA_64_LOPSREG) + return get_osabi_name ((sh_type & 0x00FF0000) >> 16); + switch (sh_type) { - case SHT_IA_64_EXT: return "IA_64_EXT"; - case SHT_IA_64_UNWIND: return "IA_64_UNWIND"; + case SHT_IA_64_EXT: return "IA_64_EXT"; + case SHT_IA_64_UNWIND: return "IA_64_UNWIND"; + case SHT_IA_64_PRIORITY_INIT: return "IA_64_PRIORITY_INIT"; default: break; } @@ -4472,6 +4496,21 @@ dynamic_segment_parisc_val (entry) putchar ('\n'); } +static void +dynamic_segment_ia64_val (entry) + Elf_Internal_Dyn *entry; +{ + switch (entry->d_tag) + { + case DT_IA_64_PLT_RESERVE: + /* First 3 bytes reserved. */ + print_vma (entry->d_un.d_ptr, PREFIX_HEX); + printf (" -- "); + print_vma (entry->d_un.d_ptr + (3 * 8), PREFIX_HEX); + printf ("\n"); + } +} + static int get_32bit_dynamic_segment (file) FILE *file; @@ -5121,6 +5160,9 @@ process_dynamic_segment (file) case EM_PARISC: dynamic_segment_parisc_val (entry); break; + case EM_IA_64: + dynamic_segment_ia64_val (entry); + break; default: print_vma (entry->d_un.d_val, PREFIX_HEX); putchar ('\n'); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 78ecc9b9aab..beb85a7f278 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,8 @@ +2003-02-21 Ian Wienand + + * ia64.h (SHT_IA_64_LOPSREG, SHT_IA_64_HIPSREG, + SHT_IA_64_PRIORITY_INIT): Define. + 2003-02-18 Alan Modra * ppc64.h (IS_PPC64_TLS_RELOC): Rename from IS_TLS_RELOC. diff --git a/include/elf/ia64.h b/include/elf/ia64.h index 310a7f74af0..06dfa606dc7 100644 --- a/include/elf/ia64.h +++ b/include/elf/ia64.h @@ -1,45 +1,44 @@ /* IA-64 ELF support for BFD. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2003 Free Software Foundation, Inc. Contributed by David Mosberger-Tang -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _ELF_IA64_H #define _ELF_IA64_H /* Bits in the e_flags field of the Elf64_Ehdr: */ -#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ -#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ +#define EF_IA_64_MASKOS 0x0000000f /* OS-specific flags. */ +#define EF_IA_64_ARCH 0xff000000 /* Arch. version mask. */ /* ??? These four definitions are not part of the SVR4 ABI. They were present in David's initial code drop, so it is probable that they are used by HP/UX. */ -#define EF_IA_64_TRAPNIL (1 << 0) /* trap NIL pointer dereferences */ -#define EF_IA_64_EXT (1 << 2) /* program uses arch. extensions */ -#define EF_IA_64_BE (1 << 3) /* PSR BE bit set (big-endian) */ -#define EFA_IA_64_EAS2_3 0x23000000 /* ia64 EAS 2.3 */ +#define EF_IA_64_TRAPNIL (1 << 0) /* Trap NIL pointer dereferences. */ +#define EF_IA_64_EXT (1 << 2) /* Program uses arch. extensions. */ +#define EF_IA_64_BE (1 << 3) /* PSR BE bit set (big-endian). */ +#define EFA_IA_64_EAS2_3 0x23000000 /* IA64 EAS 2.3. */ -#define EF_IA_64_ABI64 (1 << 4) /* 64-bit ABI */ +#define EF_IA_64_ABI64 (1 << 4) /* 64-bit ABI. */ /* Not used yet. */ #define EF_IA_64_REDUCEDFP (1 << 5) /* Only FP6-FP11 used. */ -#define EF_IA_64_CONS_GP (1 << 6) /* gp as program wide constant. */ -#define EF_IA_64_NOFUNCDESC_CONS_GP (1 << 7) /* And no function descriptors. */ +#define EF_IA_64_CONS_GP (1 << 6) /* gp as program wide constant. */ +#define EF_IA_64_NOFUNCDESC_CONS_GP (1 << 7) /* And no function descriptors. */ /* Not used yet. */ #define EF_IA_64_ABSOLUTE (1 << 8) /* Load at absolute addresses. */ @@ -54,13 +53,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Bits in the sh_flags field of Elf64_Shdr: */ -#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ -#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ +#define SHF_IA_64_SHORT 0x10000000 /* Section near gp. */ +#define SHF_IA_64_NORECOV 0x20000000 /* Spec insns w/o recovery. */ /* Possible values for sh_type in Elf64_Shdr: */ -#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ -#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ +#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* Extension bits. */ +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* Unwind bits. */ +#define SHT_IA_64_LOPSREG (SHT_LOPROC + 0x8000000) +/* ABI says (SHT_LOPROC + 0xfffffff) but I think it's a typo -- this makes sense. */ +#define SHT_IA_64_HIPSREG (SHT_LOPROC + 0x8ffffff) +#define SHT_IA_64_PRIORITY_INIT (SHT_LOPROC + 0x9000000) /* SHT_IA_64_HP_OPT_ANOT is only generated by HPUX compilers for its optimization annotation section. GCC does not generate it but we @@ -74,8 +77,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Possible values for p_type in Elf64_Phdr: */ -#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ -#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ +#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* Arch extension bits, */ +#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* IA64 unwind bits. */ /* HP-UX specific values for p_type in Elf64_Phdr. These values are currently just used to make @@ -92,10 +95,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This section only used by HP-UX, The HP linker gives weak symbols precedence over regular common symbols. We want common to override weak. Using this common instead of SHN_COMMON does that. */ - #define SHN_IA_64_ANSI_COMMON 0xFF00 -/* ia64-specific relocation types: */ +/* IA64-specific relocation types: */ /* Relocs apply to specific instructions within a bundle. The least significant 2 bits of the address indicate which instruction in the -- 2.39.2