Index: browser/app/Makefile.in
--- browser/app/Makefile.in.orig	2005-09-07 03:51:58 +0200
+++ browser/app/Makefile.in	2005-11-30 14:56:57 +0100
@@ -169,6 +169,19 @@
 include $(topsrcdir)/config/static-rules.mk
 endif
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+LDFLAGS += -L@l_gccinst@
+EXTRA_LIBS += -lgcc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 APP_VERSION = $(shell cat $(srcdir)/../config/version.txt)
 DEFINES += -DAPP_VERSION="$(APP_VERSION)"
 
Index: config/make-jars.pl
--- config/make-jars.pl.orig	2005-09-28 20:19:34 +0200
+++ config/make-jars.pl	2005-11-30 14:56:49 +0100
@@ -48,6 +48,7 @@
   last if ($arg eq "--");
 }
 my $defines = join(' ', @ARGV[ $ddindex .. $#ARGV ]);
+splice @ARGV, $ddindex, $#ARGV;
 
 getopts("d:s:t:c:j:f:avlD:o:p:xz:e");
 
Index: embedding/browser/gtk/tests/Makefile.in
--- embedding/browser/gtk/tests/Makefile.in.orig	2005-02-04 00:01:41 +0100
+++ embedding/browser/gtk/tests/Makefile.in	2005-11-30 14:56:57 +0100
@@ -131,6 +131,19 @@
 
 include $(topsrcdir)/config/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+LDFLAGS += -L@l_gccinst@
+EXTRA_LIBS += -lgcc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 CXXFLAGS	+= $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
 
 ifdef ENABLE_GNOME
Index: extensions/xmlterm/tests/Makefile.in
--- extensions/xmlterm/tests/Makefile.in.orig	2004-04-19 00:14:17 +0200
+++ extensions/xmlterm/tests/Makefile.in	2005-11-30 14:56:57 +0100
@@ -75,3 +75,14 @@
 include $(srcdir)/../config/xmlterm_config.mk
 
 include $(topsrcdir)/config/rules.mk
+
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
Index: js/src/xpconnect/shell/Makefile.in
--- js/src/xpconnect/shell/Makefile.in.orig	2005-04-05 14:35:51 +0200
+++ js/src/xpconnect/shell/Makefile.in	2005-11-30 14:56:49 +0100
@@ -63,6 +63,17 @@
 
 include $(topsrcdir)/config/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 DEFINES		+= -DJS_THREADSAFE
 
 #
Index: layout/svg/renderer/src/cairo/nsSVGCairoCanvas.cpp
--- layout/svg/renderer/src/cairo/nsSVGCairoCanvas.cpp.orig	2005-10-03 23:12:35 +0200
+++ layout/svg/renderer/src/cairo/nsSVGCairoCanvas.cpp	2005-11-30 14:56:49 +0100
@@ -50,6 +50,11 @@
 #include "nsRect.h"
 #include "nsISVGCairoSurface.h"
 #include <cairo.h>
+#ifdef CAIRO_HAS_XLIB_SURFACE
+#include <cairo-xlib.h>
+#else
+#error Require Cairo with Xlib backend
+#endif
 
 #ifdef MOZ_X11
 extern "C" {
Index: layout/svg/renderer/src/cairo/nsSVGCairoGlyphMetrics.cpp
--- layout/svg/renderer/src/cairo/nsSVGCairoGlyphMetrics.cpp.orig	2005-10-13 20:30:21 +0200
+++ layout/svg/renderer/src/cairo/nsSVGCairoGlyphMetrics.cpp	2005-11-30 14:56:49 +0100
@@ -50,6 +50,7 @@
 #include "nsIDOMSVGRect.h"
 #include "nsSVGTypeCIDs.h"
 #include "nsIComponentManager.h"
+#include <stdlib.h>
 #include <cairo.h>
 
 extern cairo_surface_t *gSVGCairoDummySurface;
Index: nsprpub/pr/include/md/_freebsd.h
--- nsprpub/pr/include/md/_freebsd.h.orig	2004-11-23 22:22:35 +0100
+++ nsprpub/pr/include/md/_freebsd.h	2005-11-30 14:56:49 +0100
@@ -43,6 +43,7 @@
 #if __FreeBSD__ >= 2
 #include <osreldate.h>  /* for __FreeBSD_version */
 #endif
+#include <sys/param.h>
 #include <sys/syscall.h>
 
 #define PR_LINKER_ARCH	"freebsd"
Index: nsprpub/pr/src/md/unix/unix.c
--- nsprpub/pr/src/md/unix/unix.c.orig	2005-08-18 19:24:37 +0200
+++ nsprpub/pr/src/md/unix/unix.c	2005-11-30 14:56:49 +0100
@@ -65,7 +65,8 @@
  * PRInt32* pointer to a _PRSockLen_t* pointer.
  */
 #if defined(HAVE_SOCKLEN_T) \
-    || (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
+    || (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) \
+    || defined(FREEBSD)
 #define _PRSockLen_t socklen_t
 #elif defined(IRIX) || defined(HPUX) || defined(OSF1) || defined(SOLARIS) \
     || defined(AIX4_1) || defined(LINUX) || defined(SONY) \
@@ -73,7 +74,7 @@
     || defined(SUNOS4) || defined(NCR) || defined(DARWIN) \
     || defined(NEXTSTEP) || defined(QNX)
 #define _PRSockLen_t int
-#elif (defined(AIX) && !defined(AIX4_1)) || defined(FREEBSD) \
+#elif (defined(AIX) && !defined(AIX4_1)) \
     || defined(NETBSD) || defined(OPENBSD) || defined(UNIXWARE) \
     || defined(DGUX) || defined(VMS) || defined(NTO) || defined(RISCOS)
 #define _PRSockLen_t size_t
Index: nsprpub/pr/src/pthreads/ptio.c
--- nsprpub/pr/src/pthreads/ptio.c.orig	2005-08-18 19:24:38 +0200
+++ nsprpub/pr/src/pthreads/ptio.c	2005-11-30 14:56:49 +0100
@@ -3460,6 +3460,17 @@
                     &on, sizeof(on));
         }
 #endif
+#if (defined(_PR_INET6_PROBE) || defined(_PR_INET6)) && \
+	defined(__FreeBSD__) && defined(IPV6_V6ONLY)
+		if (domain == PR_AF_INET6) {
+			int opt = 0;
+			if (setsockopt(osfd, IPPROTO_IPV6, IPV6_V6ONLY,
+			    &opt, sizeof(opt))) {
+				close(osfd);
+				return NULL;
+			}
+		}
+#endif  
         fd = pt_SetMethods(osfd, ftype, PR_FALSE, PR_FALSE);
         if (fd == NULL) close(osfd);
     }
Index: security/nss/cmd/shlibsign/Makefile
--- security/nss/cmd/shlibsign/Makefile.orig	2004-04-25 17:02:53 +0200
+++ security/nss/cmd/shlibsign/Makefile	2005-11-30 14:56:57 +0100
@@ -91,6 +91,17 @@
 
 include $(CORE_DEPTH)/coreconf/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 #######################################################################
 # (6) Execute "component" rules. (OPTIONAL)                           #
 #######################################################################
@@ -104,8 +115,8 @@
 include ../platrules.mk
 
 %.chk: %.$(DLL_SUFFIX) 
-ifeq ($(OS_TARGET), OS2)
-	@cmd.exe /c sign.cmd $(DIST) $(OBJDIR) $(OS_TARGET) $<
+ifeq ($(OS_TARGET), SunOS)
+	touch `echo $< | cut -f1,1 -d.`.chk
 else
 	@sh ./sign.sh $(DIST) $(OBJDIR) $(OS_TARGET) $<
 endif
Index: security/nss/cmd/shlibsign/mangle/Makefile
--- security/nss/cmd/shlibsign/mangle/Makefile.orig	2004-04-25 17:02:54 +0200
+++ security/nss/cmd/shlibsign/mangle/Makefile	2005-11-30 14:56:57 +0100
@@ -65,6 +65,17 @@
 
 include $(CORE_DEPTH)/coreconf/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 #######################################################################
 # (6) Execute "component" rules. (OPTIONAL)                           #
 #######################################################################
Index: security/nss/lib/pki1/oiddata.h
--- security/nss/lib/pki1/oiddata.h.orig	2005-03-14 19:02:00 +0100
+++ security/nss/lib/pki1/oiddata.h	2005-11-30 14:57:06 +0100
@@ -42,6 +42,9 @@
 static const char OIDDATA_CVS_ID[] = "@(#) $RCSfile: oiddata.h,v $ $Revision: 1.4 $ $Date: 2005/03/14 18:02:00 $ ; @(#) $RCSfile: oiddata.h,v $ $Revision: 1.4 $ $Date: 2005/03/14 18:02:00 $";
 #endif /* DEBUG */
 
+#ifndef PKI1T_H
+#include "pki1t.h"
+#endif
 #ifndef NSSPKI1T_H
 #include "nsspki1t.h"
 #endif /* NSSPKI1T_H */
Index: widget/src/xremoteclient/Makefile.in
--- widget/src/xremoteclient/Makefile.in.orig	2005-04-04 21:08:51 +0200
+++ widget/src/xremoteclient/Makefile.in	2005-11-30 14:56:49 +0100
@@ -88,6 +88,17 @@
 
 include $(topsrcdir)/config/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) -lxpcom $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) -lxpcom $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 ifeq ($(OS_ARCH), OpenVMS)
 DEFINES		+= -DGENERIC_MOTIF_REDEFINES
 endif
Index: xpcom/tools/registry/Makefile.in
--- xpcom/tools/registry/Makefile.in.orig	2005-06-30 04:04:23 +0200
+++ xpcom/tools/registry/Makefile.in	2005-11-30 14:56:49 +0100
@@ -71,3 +71,13 @@
 
 include $(topsrcdir)/config/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) -lxpcom $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) -lxpcom $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
