diff -r -N -c binutils-2.11.org/bfd/nlmcode.h binutils-2.11/bfd/nlmcode.h
*** binutils-2.11.org/bfd/nlmcode.h	Tue Dec 12 22:25:54 2000
--- binutils-2.11/bfd/nlmcode.h	Fri May 25 22:10:12 2001
***************
*** 721,726 ****
--- 721,754 ----
        if (bfd_write ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
  	return false;
      }
+     
+   /* Swapped the order of the MeSsAgEs and CoPyRiGhT tag to make the
+      NW4.x and NW5.x loaders happy. Still works on NW3.x. Thanks for
+      Rostislav Letos from Novell and Gunter Knauf for hints and testing. */
+     
+   /* Write out the copyright header if there is one.  */
+   if (find_nonzero ((PTR) nlm_copyright_header (abfd),
+ 		    sizeof (Nlm_Internal_Copyright_Header)))
+     {
+       Nlm_External_Copyright_Header thdr;
+ 
+       memcpy (thdr.stamp, "CoPyRiGhT=", 10);
+       if (bfd_write ((PTR) thdr.stamp, sizeof (thdr.stamp), 1, abfd)
+ 	  != sizeof (thdr.stamp))
+ 	return false;
+       thdr.copyrightMessageLength[0] =
+ 	nlm_copyright_header (abfd)->copyrightMessageLength;
+       if (bfd_write ((PTR) thdr.copyrightMessageLength, 1, 1, abfd) != 1)
+ 	return false;
+       /* The copyright message is a variable length string.  */
+       if (bfd_write ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
+ 		     nlm_copyright_header (abfd)->copyrightMessageLength + 1,
+ 		     1, abfd) !=
+ 	  ((bfd_size_type)
+ 	   nlm_copyright_header (abfd)->copyrightMessageLength + 1))
+ 	return false;
+     }
+ 
  
    /* Write out the extended header if there is one.  */
    if (find_nonzero ((PTR) nlm_extended_header (abfd),
***************
*** 820,847 ****
  	return false;
      }
  
-   /* Write out the copyright header if there is one.  */
-   if (find_nonzero ((PTR) nlm_copyright_header (abfd),
- 		    sizeof (Nlm_Internal_Copyright_Header)))
-     {
-       Nlm_External_Copyright_Header thdr;
- 
-       memcpy (thdr.stamp, "CoPyRiGhT=", 10);
-       if (bfd_write ((PTR) thdr.stamp, sizeof (thdr.stamp), 1, abfd)
- 	  != sizeof (thdr.stamp))
- 	return false;
-       thdr.copyrightMessageLength[0] =
- 	nlm_copyright_header (abfd)->copyrightMessageLength;
-       if (bfd_write ((PTR) thdr.copyrightMessageLength, 1, 1, abfd) != 1)
- 	return false;
-       /* The copyright message is a variable length string.  */
-       if (bfd_write ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
- 		     nlm_copyright_header (abfd)->copyrightMessageLength + 1,
- 		     1, abfd) !=
- 	  ((bfd_size_type)
- 	   nlm_copyright_header (abfd)->copyrightMessageLength + 1))
- 	return false;
-     }
  
    /* Write out the custom header if there is one.   */
    if (find_nonzero ((PTR) nlm_custom_header (abfd),
--- 848,853 ----
diff -r -N -c binutils-2.11.org/binutils/nlmconv.c binutils-2.11/binutils/nlmconv.c
*** binutils-2.11.org/binutils/nlmconv.c	Sat May 13 08:38:34 2000
--- binutils-2.11/binutils/nlmconv.c	Sat May 26 18:09:52 2001
***************
*** 24,29 ****
--- 24,37 ----
     into a NetWare Loadable Module (an NLM).  It will accept a linker
     specification file which is identical to that accepted by the
     NetWare linker, NLMLINK.  */
+    
+ /* 05/23/2001 armin <diehl@nordrhein.de>:
+     - ln will be called with -m i386nw, this is needed for plattforms which do not create
+       elf-objects as default (i.e. win32)
+     - find linker also for win32 (using argv[0]), if compiling for mingw32, use mingw32msvc, with
+       crtdll argv[0] has only the filename without path
+ */      
+     
  
  /* AIX requires this to be the first thing in the file.  */
  #ifndef __GNUC__
***************
*** 2108,2114 ****
    for (q = inputs; q != NULL; q = q->next)
      ++c;
  
!   argv = (char **) alloca ((c + 5) * sizeof(char *));
  
  #ifndef __MSDOS__
    if (ld == NULL)
--- 2116,2123 ----
    for (q = inputs; q != NULL; q = q->next)
      ++c;
  
! //  argv = (char **) alloca ((c + 5) * sizeof(char *));
!   argv = (char **) alloca ((c + 7) * sizeof(char *));
  
  #ifndef __MSDOS__
    if (ld == NULL)
***************
*** 2119,2125 ****
--- 2128,2138 ----
        p = program_name + strlen (program_name);
        while (p != program_name)
  	{
+ #ifdef _WIN32
+ 	  if (p[-1] == '\\')
+ #else
  	  if (p[-1] == '/')
+ #endif    
  	    {
  	      ld = (char *) xmalloc (p - program_name + strlen (LD_NAME) + 1);
  	      memcpy (ld, program_name, p - program_name);
***************
*** 2137,2146 ****
    unlink_on_exit = make_temp_file (".O");
  
    argv[0] = ld;
!   argv[1] = (char *) "-Ur";
!   argv[2] = (char *) "-o";
!   argv[3] = unlink_on_exit;
!   i = 4;
    for (q = inputs; q != NULL; q = q->next, i++)
      argv[i] = q->string;
    argv[i] = NULL;
--- 2150,2161 ----
    unlink_on_exit = make_temp_file (".O");
  
    argv[0] = ld;
!   argv[1] = (char *) "-m";
!   argv[2] = (char *) "i386nw";
!   argv[3] = (char *) "-Ur";
!   argv[4] = (char *) "-o";
!   argv[5] = unlink_on_exit;
!   i = 6;
    for (q = inputs; q != NULL; q = q->next, i++)
      argv[i] = q->string;
    argv[i] = NULL;
