delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/07/24/12:55:55

From: ian AT cygnus DOT com
Subject: Re: cross-compile on SGI & SUN generate bad cygwin.dll
24 Jul 1997 12:55:55 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199707241749.NAA29565.cygnus.gnu-win32@tweedledumb.cygnus.com>
References: <9707240739 DOT ZM8628 AT pion DOT kehl DOT dalim DOT de>
Original-To: giac AT dalim DOT de
Original-CC: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

>Anyway, I always have a problem with cross on SGI. It seems that cross dlltool
>is unable to generate a valid .reloc section in export files ...
>( I can generate a good cygwin.dll using .exp generated on PC )

I ran into this problem as well.  As I recall, the problem was that
int and bfd_vma tend to be different sizes on Irix 6, but dlltool
and/or ld confused them.  I think the appended patch was what fixed
the problem, but I'm not sure.

In any case, I'm routinely doing crosses on Irix 6, so this will be
fixed in the next release.

Ian

Index: cofflink.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/cofflink.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- cofflink.c	1997/05/30 16:47:54	1.79
+++ cofflink.c	1997/06/05 19:53:48	1.80
@@ -2636,19 +2636,26 @@
       if (info->base_file)
 	{
 	  /* Emit a reloc if the backend thinks it needs it. */
-	  if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto))
+	  if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto))
 	    {
-	      /* relocation to a symbol in a section which
-		 isn't absolute - we output the address here 
-		 to a file */
-	      bfd_vma addr = rel->r_vaddr 
-		- input_section->vma 
-		+ input_section->output_offset 
-		  + input_section->output_section->vma;
-	      if (coff_data(output_bfd)->pe)
+	      /* Relocation to a symbol in a section which isn't
+		 absolute.  We output the address here to a file.
+		 This file is then read by dlltool when generating the
+		 reloc section.  Note that the base file is not
+		 portable between systems.  We write out a long here,
+		 and dlltool reads in a long.  */
+	      long addr = (rel->r_vaddr 
+			   - input_section->vma 
+			   + input_section->output_offset 
+			   + input_section->output_section->vma);
+	      if (coff_data (output_bfd)->pe)
 		addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
-	      /* FIXME: Shouldn't 4 be sizeof (addr)?  */
-	      fwrite (&addr, 1,4, (FILE *) info->base_file);
+	      if (fwrite (&addr, 1, sizeof (long), (FILE *) info->base_file)
+		  != sizeof (long))
+		{
+		  bfd_set_error (bfd_error_system_call);
+		  return false;
+		}
 	    }
 	}
   
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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