# DP: Update the gdc driver to use the up-to-date system zlib

--- a/src/gcc/d/d-spec.c	2011-07-24 15:48:55.820035782 +0100
+++ b/src/gcc/d/d-spec.c	2011-07-24 18:12:57.750888801 +0100
@@ -119,7 +119,7 @@
     /* The number of arguments being added to what's in argv, other than
        libraries.  We use this to track the number of times we've inserted
        -xd/-xnone.  */
-    int added = 0;
+    int added = 1; /* -lz */
 
     /* The new argument list will be contained in this.  */
     struct cl_decoded_option *new_decoded_options;
@@ -505,6 +505,11 @@
     {
         /* Handled in gcc.c  */
         need_pthreads = 1;
+        /* Use the up-to-date system zlib with libphobos */
+        generate_option (OPT_l, "z", 1, CL_DRIVER,
+                         &new_decoded_options[j]);
+        added_libraries++;
+        j++;
     }
 
     if (saw_librt)
--- a/src/gcc/d/phobos2/etc/c/zlib.d	2011-07-24 15:48:57.068041974 +0100
+++ b/src/gcc/d/phobos2/etc/c/zlib.d	2011-07-24 18:14:18.775290585 +0100
@@ -35,8 +35,8 @@
 
 extern (C):
 
-const char[] ZLIB_VERSION = "1.2.3";
-const ZLIB_VERNUM = 0x1230;
+const char[] ZLIB_VERSION = "1.2.3.4";
+const ZLIB_VERNUM = 0x1234;
 
 /*
      The 'zlib' compression library provides in-memory compression and
--- a/src/gcc/d/phobos2/Makefile.am	2011-07-24 15:48:57.004041665 +0100
+++ b/src/gcc/d/phobos2/Makefile.am	2011-07-24 18:16:01.115798057 +0100
@@ -288,7 +288,7 @@
 std/stream.t.o: std/stream.d $(D_PREREQ_SRCS)
 	$(GDC) -o $@ $(ALL_DFLAGS) -fdeprecated -c $<
 
-ALL_PHOBOS_OBJS = $(D_EXTRA_OBJS) $(MAIN_OBJS) $(ZLIB_OBJS)
+ALL_PHOBOS_OBJS = $(D_EXTRA_OBJS) $(MAIN_OBJS)
 
 
 libgphobos2.a : libgdruntime.a $(ALL_PHOBOS_OBJS)
--- a/src/gcc/d/phobos2/Makefile.in	2011-07-24 15:48:57.016041704 +0100
+++ b/src/gcc/d/phobos2/Makefile.in	2011-07-24 18:16:08.787836103 +0100
@@ -379,7 +379,7 @@
 	     std/windows/charset.o std/windows/iunknown.o std/windows/registry.o \
 	     std/windows/syserror.o std/__fileinit.o 
 
-ALL_PHOBOS_OBJS = $(D_EXTRA_OBJS) $(MAIN_OBJS) $(ZLIB_OBJS)
+ALL_PHOBOS_OBJS = $(D_EXTRA_OBJS) $(MAIN_OBJS)
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
