www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2002/05/23/17:51:45

Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm
Sender: cygwin-apps-owner AT cygwin DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT cygwin DOT com>
List-Help: <mailto:cygwin-apps-help AT cygwin DOT com>, <http://sources.redhat.com/lists.html#faqs>
Mail-Followup-To: cygwin-apps AT cygwin DOT com
Delivered-To: mailing list cygwin-apps AT cygwin DOT com
From: "Ralf Habacker" <Ralf DOT Habacker AT freenet DOT de>
To: "Cygwin-Apps" <cygwin-apps AT cygwin DOT com>,
"Binutils" <binutils AT sources DOT redhat DOT com>
Cc: <laurent DOT pinchart AT skynet DOT be>
Subject: RE: binutils status ?
Date: Thu, 23 May 2002 23:50:20 +0200
Message-ID: <006d01c202a3$d5c24a40$905f07d5@BRAMSCHE>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Importance: Normal
In-Reply-To: <000501c20103$b942fd20$905f07d5@BRAMSCHE>

This is a multi-part message in MIME format.

------=_NextPart_000_006E_01C202B4.994B1A40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

> > > 3) Ralf's patch for "objdump/cygwin crashes on auto-imported libs"
> > >
<snip>

> > This patch does not help in this case. I will inspect this and supply
> > a updated
> > patch.
> >

Appended is a patch for ... see the ChangeLog entry.

If have tested this patch with my cygin /bin dir (345 files) and rebinded kde
2.2.2 dll's and exes (335 files) and have got no problems with printing import
tables.

2002-05-23  Ralf Habacker  <ralf DOT habacker AT freenet DOT de>

	* peXXigen.c (pe_print_idata): fixed some seg faults
      on printing import tables with auto-imported symbols.

Regards
Ralf

------=_NextPart_000_006E_01C202B4.994B1A40
Content-Type: application/octet-stream;
	name="objdump_ai_segfault_2.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="objdump_ai_segfault_2.patch"

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

------=_NextPart_000_006E_01C202B4.994B1A40--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019