diff -r -u -p -N binutils-4.9/binutils/bucomm.c binutils/binutils/bucomm.c
--- binutils-4.9/binutils/bucomm.c	2011-09-09 11:59:21 +0000
+++ binutils/binutils/bucomm.c	2011-09-09 12:13:34 +0000
@@ -430,14 +430,32 @@ make_tempname (char *filename, int isdir
 
   if (isdir)
     {
+#ifdef HAVE_MKDTEMP
       if (mkdtemp (tmpname) == (char *) NULL)
-      tmpname = NULL;
-    }
+	tmpname = NULL;
+#else
+      tmpname = mktemp (tmpname);
+#if defined (_WIN32) && !defined (__CYGWIN32__)
+      if (mkdir (tmpname) != 0)
+	tmpname = NULL;
+#else
+      if (mkdir (tmpname, 0700) != 0)
+	tmpname = NULL;
+#endif
+#endif
+   }
   else
     {
       int fd;
 
-      fd = mkstemp (tmpname);
+#ifdef HAVE_MKSTEMP
+  fd = mkstemp (tmpname);
+#else
+  tmpname = mktemp (tmpname);
+  if (tmpname == NULL)
+    return NULL;
+  fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600);
+#endif
       if (fd == -1)
       tmpname = NULL;
       else
diff -r -u -p -N binutils-4.9/ld/emultempl/elf32.em binutils/ld/emultempl/elf32.em
--- binutils-4.9/ld/emultempl/elf32.em	2011-09-09 11:59:45 +0000
+++ binutils/ld/emultempl/elf32.em	2011-09-09 12:47:29 +0000
@@ -166,7 +166,20 @@ gld${EMULATION_NAME}_search_dir_needed (
   
   while (lib != NULL && found == NULL)
     {
+#ifdef HAVE_STRSEP
       dir = strsep(&dlist, ":");
+#else
+      char *sep = strchr (dlist, ':');
+      if (sep)
+	{
+	  dir = dlist;
+	  dlist = sep + 1;
+	  *sep = '\0';
+	}
+      else
+	dir = dlist;
+
+#endif
       if (dir == NULL)
 	break;
       if (*dir == '\0')
