Index: peXXigen.c =================================================================== RCS file: /cvs/src/src/bfd/peXXigen.c,v retrieving revision 1.7 diff -u -3 -p -B -u -b -B -p -r1.7 peXXigen.c --- peXXigen.c 15 May 2002 15:28:12 -0000 1.7 +++ peXXigen.c 23 May 2002 21:26:04 -0000 @@ -1142,6 +1142,7 @@ pe_print_idata (abfd, vfile) adj = section->vma - extra->ImageBase; + /* print all image import descriptors */ for (i = 0; i < datasize; i += onaline) { bfd_vma hint_addr; @@ -1181,44 +1182,6 @@ pe_print_idata (abfd, vfile) if (hint_addr != 0) { - fprintf (file, _("\tvma: Hint/Ord Member-Name\n")); - - idx = hint_addr - adj; - - for (j = 0; j < datasize; j += 4) - { - unsigned long member = bfd_get_32 (abfd, data + idx + j); - - if (member == 0) - break; - if (member & 0x80000000) - fprintf (file, "\t%04lx\t %4lu", member, - member & 0x7fffffff); - else - { - int ordinal; - char *member_name; - - ordinal = bfd_get_16 (abfd, data + member - adj); - member_name = (char *) data + member - adj + 2; - fprintf (file, "\t%04lx\t %4d %s", - member, ordinal, member_name); - } - - /* If the time stamp is not zero, the import address - table holds actual addresses. */ - if (time_stamp != 0 - && first_thunk != 0 - && first_thunk != hint_addr) - fprintf (file, "\t%04lx", - (long) bfd_get_32 (abfd, data + first_thunk - adj + j)); - - fprintf (file, "\n"); - } - } - - if (hint_addr != first_thunk && time_stamp == 0) - { bfd_byte *ft_data; asection *ft_section; bfd_vma ft_addr; @@ -1227,7 +1190,17 @@ pe_print_idata (abfd, vfile) int differ = 0; int ft_allocated = 0; + fprintf (file, _("\tvma: Hint/Ord Member-Name\n")); + + idx = hint_addr - adj; + ft_addr = first_thunk + extra->ImageBase; + ft_data = data; + ft_idx = first_thunk - adj; + ft_allocated = 0; + + if (first_thunk != hint_addr) + { /* Find the section which contains the first thunk. */ for (ft_section = abfd->sections; @@ -1271,6 +1244,40 @@ pe_print_idata (abfd, vfile) ft_idx = 0; ft_allocated = 1; } + } + /* print HintName vector entries */ + for (j = 0; j < datasize; j += 4) + { + unsigned long member = bfd_get_32 (abfd, data + idx + j); + + /* print single IMAGE_IMPORT_BY_NAME vector */ + if (member == 0) + break; + if (member & 0x80000000) + fprintf (file, "\t%04lx\t %4lu", member, + member & 0x7fffffff); + else + { + int ordinal; + char *member_name; + + ordinal = bfd_get_16 (abfd, data + member - adj); + member_name = (char *) data + member - adj + 2; + fprintf (file, "\t%04lx\t %4d %s", + member, ordinal, member_name); + } + + /* If the time stamp is not zero, the import address + table holds actual addresses. */ + if (time_stamp != 0 + && first_thunk != 0 + && first_thunk != hint_addr) + fprintf (file, "\t%04lx", + (long) bfd_get_32 (abfd, ft_data + ft_idx + j)); + + fprintf (file, "\n"); + } + for (j = 0; j < datasize; j += 4) { @@ -1299,10 +1306,11 @@ pe_print_idata (abfd, vfile) if (iat_member == 0) fprintf (file, _("\t>>> Ran out of IAT members!\n")); - else + + else if (hint_member != 0) { - ordinal = bfd_get_16 (abfd, data + iat_member - adj); - member_name = (char *) data + iat_member - adj + 2; + ordinal = bfd_get_16 (abfd, data + hint_member - adj); + member_name = (char *) data + hint_member - adj + 2; fprintf (file, "\t%04lx\t %4d %s\n", (unsigned long) iat_member, ordinal,