This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] small ia64/readelf addition
- From: Ian Wienand <ianw at gelato dot unsw dot edu dot au>
- To: binutils at sources dot redhat dot com
- Date: Wed, 19 Feb 2003 14:01:25 +1100
- Subject: [patch] small ia64/readelf addition
A small patch to add some extra output features to readelf for ia64.
This is all in the ABI at
http://www.intel.com/design/itanium/downloads/245370.htm
A minor annoyance is that the headings don't quite line up with the
body data, i assume on all 64 bit architectures. I will probably just
fiddle with the spaces in the headings and send another patch if
anyone cares.
-i
ianw@gelato.unsw.edu.au
http://www.gelato.unsw.edu.au
diff -ur ./binutils/readelf.c ../patched/binutils/readelf.c
--- ./binutils/readelf.c 2003-01-22 05:21:32.000000000 +1100
+++ ../patched/binutils/readelf.c 2003-02-19 13:21:36.000000000 +1100
@@ -177,6 +177,8 @@
PARAMS ((unsigned long));
static const char *get_ppc64_dynamic_type
PARAMS ((unsigned long));
+static const char *get_ia64_dynamic_type
+ PARAMS ((unsigned long));
static const char *get_parisc_dynamic_type
PARAMS ((unsigned long));
static const char *get_dynamic_type
@@ -240,6 +242,8 @@
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
@@ -1445,6 +1449,18 @@
}
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_parisc_dynamic_type (type)
unsigned long type;
{
@@ -1565,6 +1581,9 @@
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;
@@ -2316,14 +2335,38 @@
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 )
+ switch((sh_type & 0x00FF0000) >> 16)
+ {
+ case ELFOSABI_NONE: return "UNIX_ABI" ;
+ case ELFOSABI_HPUX: return "HPUX" ;
+ case ELFOSABI_NETBSD: return "NETBSD";
+ case ELFOSABI_LINUX: return "LINUX";
+ case ELFOSABI_HURD: return "HURD";
+ case ELFOSABI_SOLARIS: return "SOLARIS";
+ case ELFOSABI_AIX: return "AIX";
+ case ELFOSABI_IRIX: return "IRIX";
+ case ELFOSABI_FREEBSD: return "FREEBSD";
+ case ELFOSABI_TRU64: return "TRU64";
+ case ELFOSABI_MODESTO: return "MODESTO";
+ case ELFOSABI_OPENBSD: return "OPENBSD";
+ case ELFOSABI_OPENVMS: return "OPENVMS";
+ case ELFOSABI_NSK: return "NSK";
+ case ELFOSABI_AROS: return "AROS";
+ case ELFOSABI_ARM: return "ARM";
+ case ELFOSABI_STANDALONE: return "STANDALONE";
+ }
+
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;
+ return NULL;
}
- return NULL;
}
static const char *
@@ -4457,6 +4500,22 @@
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;
@@ -5106,6 +5165,9 @@
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');
Only in .: binutils-2.13.90.0.18.tar.bz2
diff -ur ./include/elf/ia64.h ../patched/include/elf/ia64.h
--- ./include/elf/ia64.h 2002-05-24 08:10:11.000000000 +1000
+++ ../patched/include/elf/ia64.h 2003-02-19 13:21:36.000000000 +1100
@@ -61,6 +61,10 @@
#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */
#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */
+#define SHT_IA_64_PRIORITY_INIT (SHT_LOPROC + 0x9000000)
+#define SHT_IA_64_LOPSREG (SHT_LOPROC + 0x8000000)
+ /* ABI says 0x7fffffff but I think it's a typo -- this makes sense */
+#define SHT_IA_64_HIPSREG (SHT_LOPROC + 0x8ffffff)
/* SHT_IA_64_HP_OPT_ANOT is only generated by HPUX compilers for its
optimization annotation section. GCC does not generate it but we