This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
RE: bfd/peigen.c problems and fix
- To: Alan Modra <alan at linuxcare dot com dot au>
- Subject: RE: bfd/peigen.c problems and fix
- From: Szabolcs Szakacsits <szaka at F-Secure dot com>
- Date: Sat, 13 May 2000 09:42:34 +0200 (MEST)
- cc: Donn Terry <donnte at microsoft dot com>, binutils at sourceware dot cygnus dot com
On Fri, 12 May 2000, Alan Modra wrote:
> No, the ImageBase fix came first, to allow mingw to create exe's that
> actually ran. I next made some changes so that "objdump -p" worked
> instead of crashing. szaka contributed some further fixes. .idata
> section versus DataDirectory changes were me cleaning up the code,
> possibly a foolish move.
Yes ;) Here is a fix to make it work again [we _need_ the whole section,
not only from dataoff]. The last hunk makes possible to show forwarder
RVA's [again].
Szaka
--- peigen.c.cvs-1.10-noPEP Sat May 13 03:46:05 2000
+++ peigen.c Sat May 13 07:37:02 2000
@@ -1104,14 +1104,15 @@
fprintf(file,
_(" Table Stamp Chain Name Thunk\n"));
- data = (bfd_byte *) bfd_malloc (datasize);
+
+ data = (bfd_byte *) bfd_malloc (dataoff + datasize);
if (data == NULL)
return false;
- if (! bfd_get_section_contents (abfd, section, (PTR) data, dataoff, datasize))
+ if (! bfd_get_section_contents (abfd, section, (PTR) data, 0, dataoff + datasize))
return false;
- adj = section->vma - extra->ImageBase + dataoff;
+ adj = section->vma - extra->ImageBase;
for (i = 0; i < datasize; i += onaline)
{
@@ -1125,7 +1126,7 @@
char *dll;
/* print (i + extra->DataDirectory[1].VirtualAddress) */
- fprintf (file, " %08lx\t", (unsigned long) (i + adj));
+ fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff));
if (i + 20 > datasize)
{
@@ -1133,11 +1134,11 @@
;
}
- hint_addr = bfd_get_32 (abfd, data + i);
- time_stamp = bfd_get_32 (abfd, data + i + 4);
- forward_chain = bfd_get_32 (abfd, data + i + 8);
- dll_name = bfd_get_32 (abfd, data + i + 12);
- first_thunk = bfd_get_32 (abfd, data + i + 16);
+ hint_addr = bfd_get_32 (abfd, data + i + dataoff);
+ time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff);
+ forward_chain = bfd_get_32 (abfd, data + i + 8 + dataoff);
+ dll_name = bfd_get_32 (abfd, data + i + 12 + dataoff);
+ first_thunk = bfd_get_32 (abfd, data + i + 16 + dataoff);
fprintf (file, "%08lx %08lx %08lx %08lx %08lx\n",
(unsigned long) hint_addr,
@@ -1421,8 +1422,8 @@
{
bfd_vma eat_member = bfd_get_32 (abfd,
data + edt.eat_addr + (i * 4) - adj);
- bfd_vma eat_actual = eat_member;
- bfd_vma edata_start = bfd_get_section_vma (abfd, section);
+ bfd_vma eat_actual = eat_member + extra->ImageBase;
+ bfd_vma edata_start = bfd_get_section_vma (abfd, section) + dataoff;
bfd_vma edata_end = edata_start + datasize;
if (eat_member == 0)