diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-07-10 15:28:34 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2002-07-10 15:28:34 +0000 |
commit | 047b22647dfced6489ef773f7f10aad0a511a195 (patch) | |
tree | afe8280f4e649ab0a30353dceda5fe0333ac0652 /binutils | |
parent | f5e87a1da3ab703c1fd1897952c7e128e932aeda (diff) | |
download | gdb-047b22647dfced6489ef773f7f10aad0a511a195.zip gdb-047b22647dfced6489ef773f7f10aad0a511a195.tar.gz gdb-047b22647dfced6489ef773f7f10aad0a511a195.tar.bz2 |
* readelf.c (get_dynamic_type): Handle DT_GNU_PRELINKED,
DT_GNU_CONFLICT* and DT_GNU_LIBLISZ*.
(get_section_type_name): Handle SHT_GNU_LIBLIST.
(process_dynamic_segment): Handle DT_GNU_CONFLICTSZ,
DT_GNU_LIBLISTSZ and DT_GNU_PRELINKED.
(process_gnu_liblist): New.
(process_file): Call it.
* elf/common.h (SHT_GNU_LIBLIST, DT_GNU_PRELINKED,
DT_GNU_CONFLICT*, DT_GNU_LIBLIST*): Define.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 10 | ||||
-rw-r--r-- | binutils/readelf.c | 108 |
2 files changed, 117 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 1133a82..30c9e21 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,13 @@ +2002-07-10 Jakub Jelinek <jakub@redhat.com> + + * readelf.c (get_dynamic_type): Handle DT_GNU_PRELINKED, + DT_GNU_CONFLICT* and DT_GNU_LIBLISZ*. + (get_section_type_name): Handle SHT_GNU_LIBLIST. + (process_dynamic_segment): Handle DT_GNU_CONFLICTSZ, + DT_GNU_LIBLISTSZ and DT_GNU_PRELINKED. + (process_gnu_liblist): New. + (process_file): Call it. + 2002-07-03 Alan Modra <amodra@bigpond.net.au> * Makefile.am (check-DEJAGNU): Revert 2002-06-25 change. diff --git a/binutils/readelf.c b/binutils/readelf.c index 91e0691..9c15d9f 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -264,6 +264,7 @@ static int process_corefile_note_segment PARAMS ((FILE *, bfd_vma, bfd_vma)) static int process_corefile_note_segments PARAMS ((FILE *)); static int process_corefile_contents PARAMS ((FILE *)); static int process_arch_specific PARAMS ((FILE *)); +static int process_gnu_liblist PARAMS ((FILE *)); typedef int Elf32_Word; @@ -525,7 +526,7 @@ print_vma (vma, mode) /* Display a symbol on stdout. If do_wide is not true then format the symbol to be at most WIDTH characters, - truhncating as necessary. If WIDTH is negative then + truncating as necessary. If WIDTH is negative then format the string to be exactly - WIDTH characters, truncating or padding as necessary. */ @@ -1388,6 +1389,12 @@ get_dynamic_type (type) case DT_USED: return "USED"; case DT_FILTER: return "FILTER"; + case DT_GNU_PRELINKED: return "GNU_PRELINKED"; + case DT_GNU_CONFLICT: return "GNU_CONFLICT"; + case DT_GNU_CONFLICTSZ: return "GNU_CONFLICTSZ"; + case DT_GNU_LIBLIST: return "GNU_LIBLIST"; + case DT_GNU_LIBLISTSZ: return "GNU_LIBLISTSZ"; + default: if ((type >= DT_LOPROC) && (type <= DT_HIPROC)) { @@ -2194,6 +2201,7 @@ get_section_type_name (sh_type) case 0x6ffffffc: return "VERDEF"; case 0x7ffffffd: return "AUXILIARY"; case 0x7fffffff: return "FILTER"; + case SHT_GNU_LIBLIST: return "GNU_LIBLIST"; default: if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC)) @@ -4755,6 +4763,8 @@ process_dynamic_segment (file) case DT_MOVESZ : case DT_INIT_ARRAYSZ: case DT_FINI_ARRAYSZ: + case DT_GNU_CONFLICTSZ: + case DT_GNU_LIBLISTSZ: if (do_dynamic) { print_vma (entry->d_un.d_val, UNSIGNED); @@ -4803,6 +4813,20 @@ process_dynamic_segment (file) /* The value of this entry is ignored. */ break; + case DT_GNU_PRELINKED: + if (do_dynamic) + { + struct tm * tmp; + time_t time = entry->d_un.d_val; + + tmp = gmtime (&time); + printf ("%04u-%02u-%02uT%02u:%02u:%02u\n", + tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + + } + break; + default: if ((entry->d_tag >= DT_VERSYM) && (entry->d_tag <= DT_VERNEEDNUM)) version_info [DT_VERSIONTAGIDX (entry->d_tag)] = @@ -9369,6 +9393,86 @@ process_mips_specific (file) return 1; } +static int +process_gnu_liblist (file) + FILE * file; +{ + Elf_Internal_Shdr * section, * string_sec; + Elf32_External_Lib * elib; + char * strtab; + size_t cnt; + unsigned i; + + if (! do_arch) + return 0; + + for (i = 0, section = section_headers; + i < elf_header.e_shnum; + i++, section ++) + { + switch (section->sh_type) + { + case SHT_GNU_LIBLIST: + elib = ((Elf32_External_Lib *) + get_data (NULL, file, section->sh_offset, section->sh_size, + _("liblist"))); + + if (elib == NULL) + break; + string_sec = SECTION_HEADER (section->sh_link); + + strtab = (char *) get_data (NULL, file, string_sec->sh_offset, + string_sec->sh_size, + _("liblist string table")); + + if (strtab == NULL + || section->sh_entsize != sizeof (Elf32_External_Lib)) + { + free (elib); + break; + } + + printf (_("\nLibrary list section '%s' contains %lu entries:\n"), + SECTION_NAME (section), + (long) (section->sh_size / sizeof (Elf32_External_Lib))); + + puts (" Library Time Stamp Checksum Version Flags"); + + for (cnt = 0; cnt < section->sh_size / sizeof (Elf32_External_Lib); + ++cnt) + { + Elf32_Lib liblist; + time_t time; + char timebuf[20]; + struct tm * tmp; + + liblist.l_name = BYTE_GET (elib[cnt].l_name); + time = BYTE_GET (elib[cnt].l_time_stamp); + liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum); + liblist.l_version = BYTE_GET (elib[cnt].l_version); + liblist.l_flags = BYTE_GET (elib[cnt].l_flags); + + tmp = gmtime (&time); + sprintf (timebuf, "%04u-%02u-%02uT%02u:%02u:%02u", + tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + + printf ("%3lu: ", (unsigned long) cnt); + if (do_wide) + printf ("%-20s", strtab + liblist.l_name); + else + printf ("%-20.20s", strtab + liblist.l_name); + printf (" %s %#010lx %-7ld %-7ld\n", timebuf, liblist.l_checksum, + liblist.l_version, liblist.l_flags); + } + + free (elib); + } + } + + return 1; +} + static const char * get_note_type (e_type) unsigned e_type; @@ -9816,6 +9920,8 @@ process_file (file_name) process_corefile_contents (file); + process_gnu_liblist (file); + process_arch_specific (file); fclose (file); |