Skip to contentSkip to conversation

net-2.6.24 breaks powerpc mysteriously

DISCUSSION Andrew Morton 4 participants 11 messages Oct 12, 2007 – Oct 14, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

With net-2.6.24 (pulled yesterday) applied:

g5:/usr/src/25> ml arch/powerpc/boot/inflate.o
Using ARCH=powerpc CROSS_COMPILE=

  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
  BOOTCC  arch/powerpc/boot/inflate.o

arch/powerpc/boot/inflate.c:920:19: errno.h: No such file or directory arch/powerpc/boot/inflate.c:921:18: slab.h: No such file or directory arch/powerpc/boot/inflate.c:922:21: vmalloc.h: No such file or directory arch/powerpc/boot/inflate.c: In function `zlib_inflate_blob':
arch/powerpc/boot/inflate.c:928: error: syntax error before '*' token arch/powerpc/boot/inflate.c:932: error: `ENOMEM' undeclared (first use in this function) arch/powerpc/boot/inflate.c:932: error: (Each undeclared identifier is reported only once arch/powerpc/boot/inflate.c:932: error: for each function it appears in.) arch/powerpc/boot/inflate.c:933: warning: implicit declaration of function kmalloc' arch/powerpc/boot/inflate.c:933: error: GFP_KERNEL' undeclared (first use in this function) arch/powerpc/boot/inflate.c:933: warning: assignment makes pointer from integer without a cast arch/powerpc/boot/inflate.c:936: warning: assignment makes pointer from integer without a cast arch/powerpc/boot/inflate.c:943: error: zbuf' undeclared (first use in this function) arch/powerpc/boot/inflate.c:955: error: EINVAL' undeclared (first use in this function) arch/powerpc/boot/inflate.c:960: warning: implicit declaration of function `kfree'

without it applied:

g5:/usr/src/25> ml arch/powerpc/boot/inflate.o
scripts/kconfig/conf -s arch/powerpc/Kconfig
#

# configuration written to .config
#
  Using ARCH=powerpc CROSS_COMPILE=
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTLD  scripts/mod/modpost
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CC      arch/powerpc/kernel/asm-offsets.s
  GEN     include/asm-powerpc/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  COPY    arch/powerpc/boot/zlib.h
  COPY    arch/powerpc/boot/inflate.c
  BOOTCC  arch/powerpc/boot/inflate.o
.config:308:warning: trying to assign nonexistent symbol INET_LRO
.config:638:warning: trying to assign nonexistent symbol VETH
.config:639:warning: trying to assign nonexistent symbol IP1000

Note that those two COPY commands didn't happen with net-2.6.24 applied, although that might be because `make' decided they were already performed, dunno.

I also have today's git-kbuild applied here, as well as yesterday's git-powerpc.

But I have enough to fix here so I'm going to do a report-and-run on this one. I'll release 2.6.23-mm1 in this state for your bug-hunting convenience ;)

maintainer Acked-by Michael Chan
#1 lore raw

From: Andrew Morton <[email protected]>
Date: Thu, 11 Oct 2007 19:22:33 -0700

Quoted 8 lines

With net-2.6.24 (pulled yesterday) applied:

g5:/usr/src/25> ml arch/powerpc/boot/inflate.o
Using ARCH=powerpc CROSS_COMPILE=

  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
  BOOTCC  arch/powerpc/boot/inflate.o
Quoted 5 lines

arch/powerpc/boot/inflate.c:920:19: errno.h: No such file or directory arch/powerpc/boot/inflate.c:921:18: slab.h: No such file or directory arch/powerpc/boot/inflate.c:922:21: vmalloc.h: No such file or directory arch/powerpc/boot/inflate.c: In function `zlib_inflate_blob':
arch/powerpc/boot/inflate.c:928: error: syntax error before '*' token

The only thing we touched in zlib is in the patch below.

I suspect the lib/zlib_inflate/inflate.c changes, I had no idea that some pieces of code try to use this into userspace.

I supposed a hacky fix is to add __KERNEL__ ifdef protection around zlib_inflate_blob() and those troublesome includes. A nicer fix is probably to change the zlib_inflate_blob() interface to pass in pointers to alloc() and free() routines instead of calling kernel ones directly.

Denys?

commit 8336793baf962163c9fab5a3f39614295fdbab27

Author: Denys Vlasenko <[email protected]>
Date:   Sun Sep 30 17:56:49 2007 -0700

[ZLIB]: Move bnx2 driver gzip unpacker into zlib.

drivers/net/bnx2.c +3 -45
index 73d4a57..6d6ea56 100644
@@ -2761,48 +2761,6 @@ bnx2_set_rx_mode(struct net_device *dev)
 	spin_unlock_bh(&bp->phy_lock);
 }
 
-/* To be moved to generic lib/ */
-static int
-bnx2_gunzip(void *gunzip_buf, unsigned sz, u8 *zbuf, int len)
-{
-	struct z_stream_s *strm;
-	int rc;
-
-	/* gzip header (1f,8b,08... 10 bytes total + possible asciz filename)
-	 * is stripped */
-
-	rc = -ENOMEM;
-	strm = kmalloc(sizeof(*strm), GFP_KERNEL);
-	if (strm == NULL)
-		goto gunzip_nomem2;
-	strm->workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
-	if (strm->workspace == NULL)
-		goto gunzip_nomem3;
-
-	strm->next_in = zbuf;
-	strm->avail_in = len;
-	strm->next_out = gunzip_buf;
-	strm->avail_out = sz;
-
-	rc = zlib_inflateInit2(strm, -MAX_WBITS);
-	if (rc == Z_OK) {
-		rc = zlib_inflate(strm, Z_FINISH);
-		/* after Z_FINISH, only Z_STREAM_END is "we unpacked it all" */
-		if (rc == Z_STREAM_END)
-			rc = sz - strm->avail_out;
-		else
-			rc = -EINVAL;
-		zlib_inflateEnd(strm);
-	} else
-		rc = -EINVAL;
-
-	kfree(strm->workspace);
-gunzip_nomem3:
-	kfree(strm);
-gunzip_nomem2:
-	return rc;
-}
-
 static void
 load_rv2p_fw(struct bnx2 *bp, u32 *rv2p_code, u32 rv2p_code_len,
 	u32 rv2p_proc)
@@ -2858,7 +2816,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
 		text = vmalloc(FW_BUF_SIZE);
 		if (!text)
 			return -ENOMEM;
-		rc = bnx2_gunzip(text, FW_BUF_SIZE, fw->gz_text, fw->gz_text_len);
+		rc = zlib_inflate_blob(text, FW_BUF_SIZE, fw->gz_text, fw->gz_text_len);
 		if (rc < 0) {
 			vfree(text);
 			return rc;
@@ -2935,14 +2893,14 @@ bnx2_init_cpus(struct bnx2 *bp)
 	text = vmalloc(FW_BUF_SIZE);
 	if (!text)
 		return -ENOMEM;
-	rc = bnx2_gunzip(text, FW_BUF_SIZE, bnx2_rv2p_proc1, sizeof(bnx2_rv2p_proc1));
+	rc = zlib_inflate_blob(text, FW_BUF_SIZE, bnx2_rv2p_proc1, sizeof(bnx2_rv2p_proc1));
 	if (rc < 0) {
 		vfree(text);
 		goto init_cpu_err;
 	}
 	load_rv2p_fw(bp, text, rc /* == len */, RV2P_PROC1);
 
-	rc = bnx2_gunzip(text, FW_BUF_SIZE, bnx2_rv2p_proc2, sizeof(bnx2_rv2p_proc2));
+	rc = zlib_inflate_blob(text, FW_BUF_SIZE, bnx2_rv2p_proc2, sizeof(bnx2_rv2p_proc2));
 	if (rc < 0) {
 		vfree(text);
 		goto init_cpu_err;
include/linux/zlib.h +5 -1
index 9e3192a..40c49cb 100644
@@ -82,7 +82,7 @@
 struct internal_state;
 
 typedef struct z_stream_s {
-    Byte    *next_in;   /* next input byte */
+    const Byte *next_in;   /* next input byte */
     uInt     avail_in;  /* number of bytes available at next_in */
     uLong    total_in;  /* total nb of input bytes read so far */
 
@@ -699,4 +699,8 @@ extern int zlib_inflateInit2(z_streamp strm, int  windowBits);
     struct internal_state {int dummy;}; /* hack for buggy compilers */
 #endif
 
+/* Utility function: initialize zlib, unpack binary blob, clean up zlib,
+ * return len or negative error code. */
+extern int zlib_inflate_blob(void *dst, unsigned dst_sz, const void *src, unsigned src_sz);
+
 #endif /* _ZLIB_H */
lib/zlib_inflate/inffast.c +9 -9
index d84560c..8550b0c 100644
@@ -69,22 +69,22 @@
 void inflate_fast(z_streamp strm, unsigned start)
 {
     struct inflate_state *state;
-    unsigned char *in;      /* local strm->next_in */
-    unsigned char *last;    /* while in < last, enough input available */
-    unsigned char *out;     /* local strm->next_out */
-    unsigned char *beg;     /* inflate()'s initial strm->next_out */
-    unsigned char *end;     /* while out < end, enough space available */
+    const unsigned char *in;    /* local strm->next_in */
+    const unsigned char *last;  /* while in < last, enough input available */
+    unsigned char *out;         /* local strm->next_out */
+    unsigned char *beg;         /* inflate()'s initial strm->next_out */
+    unsigned char *end;         /* while out < end, enough space available */
 #ifdef INFLATE_STRICT
     unsigned dmax;              /* maximum distance from zlib header */
 #endif
     unsigned wsize;             /* window size or zero if not using window */
     unsigned whave;             /* valid bytes in the window */
     unsigned write;             /* window write index */
-    unsigned char *window;  /* allocated sliding window, if wsize != 0 */
+    unsigned char *window;      /* allocated sliding window, if wsize != 0 */
     unsigned long hold;         /* local strm->hold */
     unsigned bits;              /* local strm->bits */
-    code const *lcode;      /* local strm->lencode */
-    code const *dcode;      /* local strm->distcode */
+    code const *lcode;          /* local strm->lencode */
+    code const *dcode;          /* local strm->distcode */
     unsigned lmask;             /* mask for first level of length codes */
     unsigned dmask;             /* mask for first level of distance codes */
     code this;                  /* retrieved table entry */
@@ -92,7 +92,7 @@ void inflate_fast(z_streamp strm, unsigned start)
                                 /*  window position, window bytes to copy */
     unsigned len;               /* match length, unused bytes */
     unsigned dist;              /* match distance */
-    unsigned char *from;    /* where to copy match from */
+    unsigned char *from;        /* where to copy match from */
 
     /* copy state to local variables */
     state = (struct inflate_state *)strm->state;
lib/zlib_inflate/inflate.c +51 -4

75 lines not on this page · raw message

lib/zlib_inflate/inflate_syms.c +1 -0
index 2061d4f..67329fe 100644
@@ -16,4 +16,5 @@ EXPORT_SYMBOL(zlib_inflateInit2);
 EXPORT_SYMBOL(zlib_inflateEnd);
 EXPORT_SYMBOL(zlib_inflateReset);
 EXPORT_SYMBOL(zlib_inflateIncomp); 
+EXPORT_SYMBOL(zlib_inflate_blob);
 MODULE_LICENSE("GPL");
#2 lore raw
Quoted 4 lines · David Miller

The only thing we touched in zlib is in the patch below.

I suspect the lib/zlib_inflate/inflate.c changes, I had no idea that some pieces of code try to use this into userspace.

Not userspace; the zImage wrapper uses inflate.c to gunzip the compressed kernel image. It is a separate program to the kernel, however, and is compiled in an environment where the headers it uses are not the kernel headers.

Quoted 2 lines

I supposed a hacky fix is to add __KERNEL__ ifdef protection around zlib_inflate_blob() and those troublesome includes. A nicer fix is

That would do, but I don't see why zlib_inflate_blob had to be added to inflate.c rather than being in a new file under lib/zlib_inflate. If nothing else, that bloats configs that currently use inflate.c (in the kernel) but don't need zlib_inflate_blob() - which would be all the existing uses. :)

Paul.

#3 lore raw
Quoted 5 lines · Paul Mackerras
Quoted 2 lines

I supposed a hacky fix is to add __KERNEL__ ifdef protection around zlib_inflate_blob() and those troublesome includes. A nicer fix is

That would do, but I don't see why zlib_inflate_blob had to be added to inflate.c rather than being in a new file under lib/zlib_inflate.

Done.

Quoted 3 lines

If nothing else, that bloats configs that currently use inflate.c (in the kernel) but don't need zlib_inflate_blob() - which would be all the existing uses. :)

I did it.

However, in general I prefer to have a better linker, one which is capable of eliminate unused fuctions/data on the per-object basis, not per .o file.

Patches to implement that are sent to Sam Ravnborg. Hopefully they will make it to mainline.
--
vda

#4 lore raw
In reply to David Miller
Quoted 31 lines · David Miller

From: Andrew Morton <[email protected]>
Date: Thu, 11 Oct 2007 19:22:33 -0700

Quoted 8 lines

With net-2.6.24 (pulled yesterday) applied:

g5:/usr/src/25> ml arch/powerpc/boot/inflate.o
Using ARCH=powerpc CROSS_COMPILE=

  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
  BOOTCC  arch/powerpc/boot/inflate.o
Quoted 5 lines

arch/powerpc/boot/inflate.c:920:19: errno.h: No such file or directory arch/powerpc/boot/inflate.c:921:18: slab.h: No such file or directory arch/powerpc/boot/inflate.c:922:21: vmalloc.h: No such file or directory arch/powerpc/boot/inflate.c: In function `zlib_inflate_blob':
arch/powerpc/boot/inflate.c:928: error: syntax error before '*' token

The only thing we touched in zlib is in the patch below.

I suspect the lib/zlib_inflate/inflate.c changes, I had no idea that some pieces of code try to use this into userspace.

I supposed a hacky fix is to add __KERNEL__ ifdef protection around zlib_inflate_blob() and those troublesome includes. A nicer fix is probably to change the zlib_inflate_blob() interface to pass in pointers to alloc() and free() routines instead of calling kernel ones directly.

Denys?

commit 8336793baf962163c9fab5a3f39614295fdbab27

Quoted 8 lines
Author: Denys Vlasenko <[email protected]>
Date:   Sun Sep 30 17:56:49 2007 -0700

[ZLIB]: Move bnx2 driver gzip unpacker into zlib.

Please find updated patch in attachment.
Compile-tested.
--
vda

drivers/net/bnx2.c +3 -45
@@ -2761,48 +2761,6 @@ bnx2_set_rx_mode(struct net_device *dev)
 	spin_unlock_bh(&bp->phy_lock);
 }
 
-/* To be moved to generic lib/ */
-static int
-bnx2_gunzip(void *gunzip_buf, unsigned sz, u8 *zbuf, int len)
-{
-	struct z_stream_s *strm;
-	int rc;
-
-	/* gzip header (1f,8b,08... 10 bytes total + possible asciz filename)
-	 * is stripped */
-
-	rc = -ENOMEM;
-	strm = kmalloc(sizeof(*strm), GFP_KERNEL);
-	if (strm == NULL)
-		goto gunzip_nomem2;
-	strm->workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
-	if (strm->workspace == NULL)
-		goto gunzip_nomem3;
-
-	strm->next_in = zbuf;
-	strm->avail_in = len;
-	strm->next_out = gunzip_buf;
-	strm->avail_out = sz;
-
-	rc = zlib_inflateInit2(strm, -MAX_WBITS);
-	if (rc == Z_OK) {
-		rc = zlib_inflate(strm, Z_FINISH);
-		/* after Z_FINISH, only Z_STREAM_END is "we unpacked it all" */
-		if (rc == Z_STREAM_END)
-			rc = sz - strm->avail_out;
-		else
-			rc = -EINVAL;
-		zlib_inflateEnd(strm);
-	} else
-		rc = -EINVAL;
-
-	kfree(strm->workspace);
-gunzip_nomem3:
-	kfree(strm);
-gunzip_nomem2:
-	return rc;
-}
-
 static void
 load_rv2p_fw(struct bnx2 *bp, u32 *rv2p_code, u32 rv2p_code_len,
 	u32 rv2p_proc)
@@ -2858,7 +2816,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
 		text = vmalloc(FW_BUF_SIZE);
 		if (!text)
 			return -ENOMEM;
-		rc = bnx2_gunzip(text, FW_BUF_SIZE, fw->gz_text, fw->gz_text_len);
+		rc = zlib_inflate_blob(text, FW_BUF_SIZE, fw->gz_text, fw->gz_text_len);
 		if (rc < 0) {
 			vfree(text);
 			return rc;
@@ -2935,14 +2893,14 @@ bnx2_init_cpus(struct bnx2 *bp)
 	text = vmalloc(FW_BUF_SIZE);
 	if (!text)
 		return -ENOMEM;
-	rc = bnx2_gunzip(text, FW_BUF_SIZE, bnx2_rv2p_proc1, sizeof(bnx2_rv2p_proc1));
+	rc = zlib_inflate_blob(text, FW_BUF_SIZE, bnx2_rv2p_proc1, sizeof(bnx2_rv2p_proc1));
 	if (rc < 0) {
 		vfree(text);
 		goto init_cpu_err;
 	}
 	load_rv2p_fw(bp, text, rc /* == len */, RV2P_PROC1);
 
-	rc = bnx2_gunzip(text, FW_BUF_SIZE, bnx2_rv2p_proc2, sizeof(bnx2_rv2p_proc2));
+	rc = zlib_inflate_blob(text, FW_BUF_SIZE, bnx2_rv2p_proc2, sizeof(bnx2_rv2p_proc2));
 	if (rc < 0) {
 		vfree(text);
 		goto init_cpu_err;
include/linux/zlib.h +5 -1
@@ -82,7 +82,7 @@
 struct internal_state;
 
 typedef struct z_stream_s {
-    Byte    *next_in;   /* next input byte */
+    const Byte *next_in;   /* next input byte */
     uInt     avail_in;  /* number of bytes available at next_in */
     uLong    total_in;  /* total nb of input bytes read so far */
 
@@ -699,4 +699,8 @@ extern int zlib_inflateInit2(z_streamp strm, int  windowBits);
     struct internal_state {int dummy;}; /* hack for buggy compilers */
 #endif
 
+/* Utility function: initialize zlib, unpack binary blob, clean up zlib,
+ * return len or negative error code. */
+extern int zlib_inflate_blob(void *dst, unsigned dst_sz, const void *src, unsigned src_sz);
+
 #endif /* _ZLIB_H */
lib/zlib_inflate/inffast.c +9 -9
@@ -69,22 +69,22 @@
 void inflate_fast(z_streamp strm, unsigned start)
 {
     struct inflate_state *state;
-    unsigned char *in;      /* local strm->next_in */
-    unsigned char *last;    /* while in < last, enough input available */
-    unsigned char *out;     /* local strm->next_out */
-    unsigned char *beg;     /* inflate()'s initial strm->next_out */
-    unsigned char *end;     /* while out < end, enough space available */
+    const unsigned char *in;    /* local strm->next_in */
+    const unsigned char *last;  /* while in < last, enough input available */
+    unsigned char *out;         /* local strm->next_out */
+    unsigned char *beg;         /* inflate()'s initial strm->next_out */
+    unsigned char *end;         /* while out < end, enough space available */
 #ifdef INFLATE_STRICT
     unsigned dmax;              /* maximum distance from zlib header */
 #endif
     unsigned wsize;             /* window size or zero if not using window */
     unsigned whave;             /* valid bytes in the window */
     unsigned write;             /* window write index */
-    unsigned char *window;  /* allocated sliding window, if wsize != 0 */
+    unsigned char *window;      /* allocated sliding window, if wsize != 0 */
     unsigned long hold;         /* local strm->hold */
     unsigned bits;              /* local strm->bits */
-    code const *lcode;      /* local strm->lencode */
-    code const *dcode;      /* local strm->distcode */
+    code const *lcode;          /* local strm->lencode */
+    code const *dcode;          /* local strm->distcode */
     unsigned lmask;             /* mask for first level of length codes */
     unsigned dmask;             /* mask for first level of distance codes */
     code this;                  /* retrieved table entry */
@@ -92,7 +92,7 @@ void inflate_fast(z_streamp strm, unsigned start)
                                 /*  window position, window bytes to copy */
     unsigned len;               /* match length, unused bytes */
     unsigned dist;              /* match distance */
-    unsigned char *from;    /* where to copy match from */
+    unsigned char *from;        /* where to copy match from */
 
     /* copy state to local variables */
     state = (struct inflate_state *)strm->state;
lib/zlib_inflate/inflate.c +4 -4
@@ -332,14 +332,14 @@ static int zlib_inflateSyncPacket(z_streamp strm)
 int zlib_inflate(z_streamp strm, int flush)
 {
     struct inflate_state *state;
-    unsigned char *next;    /* next input */
-    unsigned char *put;     /* next output */
+    const unsigned char *next;  /* next input */
+    unsigned char *put;         /* next output */
     unsigned have, left;        /* available input and output */
     unsigned long hold;         /* bit buffer */
     unsigned bits;              /* bits in bit buffer */
     unsigned in, out;           /* save starting available input and output */
     unsigned copy;              /* number of stored or match bytes to copy */
-    unsigned char *from;    /* where to copy match bytes from */
+    unsigned char *from;        /* where to copy match bytes from */
     code this;                  /* current decoding table entry */
     code last;                  /* parent table entry */
     unsigned len;               /* length to copy for repeats, bits to drop */
@@ -897,7 +897,7 @@ int zlib_inflateIncomp(z_stream *z)
 
     /* Setup some variables to allow misuse of updateWindow */
     z->avail_out = 0;
-    z->next_out = z->next_in + z->avail_in;
+    z->next_out = (unsigned char*)z->next_in + z->avail_in;
 
     zlib_updatewindow(z, z->avail_in);
 
lib/zlib_inflate/inflate_blob.c +42 -0

42 lines not on this page · raw message

lib/zlib_inflate/Makefile +1 -1
@@ -16,4 +16,4 @@
 obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate.o
 
 zlib_inflate-objs := inffast.o inflate.o \
-		     inftrees.o inflate_syms.o
+		     inftrees.o inflate_blob.o inflate_syms.o
lib/zlib_inflate/inflate_syms.c +1 -0
@@ -16,4 +16,5 @@ EXPORT_SYMBOL(zlib_inflateInit2);
 EXPORT_SYMBOL(zlib_inflateEnd);
 EXPORT_SYMBOL(zlib_inflateReset);
 EXPORT_SYMBOL(zlib_inflateIncomp); 
+EXPORT_SYMBOL(zlib_inflate_blob);
 MODULE_LICENSE("GPL");
maintainer
#5 lore raw

From: Denys Vlasenko <[email protected]>
Date: Sun, 14 Oct 2007 04:40:46 +0100

Quoted 2 lines

Please find updated patch in attachment.
Compile-tested.

We fixed this several days ago already.

#6 lore raw
In reply to Andrew Morton
Quoted 3 lines · Andrew Morton

arch/powerpc/boot/inflate.c:920:19: errno.h: No such file or directory arch/powerpc/boot/inflate.c:921:18: slab.h: No such file or directory arch/powerpc/boot/inflate.c:922:21: vmalloc.h: No such file or directory

We used to have our own copies of inflate.c etc. for the zImage wrapper code to use under arch/powerpc/boot. Then someone said "why do we have two copies of these files?" and did a patch to make the build process copy the files from lib/zlib_inflate over and compile them. (We can't just use the compiled .o files from lib/zlib_inflate because the wrapper is 32-bit whereas the kernel is often 64-bit.)

Now it seems someone has made changes to the lib/zlib_inflate versions that are OK in the context of the kernel but not in the zImage (which is a separate program). Avoiding this kind of breakage was the reason why I made arch/powerpc/boot have its own copies originally.

So Andrew, what do you think is better - arch/powerpc/boot having its own copies of the zlib_inflate stuff, or #ifdefs of some kind in lib/zlib_inflate/*.c?

Paul.

#7 lore raw
Quoted 3 lines · On Fri, 12 Oct 2007 13:52:14 +1000 Paul Mackerras <[email protected]> wrote:

So Andrew, what do you think is better - arch/powerpc/boot having its own copies of the zlib_inflate stuff, or #ifdefs of some kind in lib/zlib_inflate/*.c?

The latter - copying code is evil. Keeping the existing code dual-mode shouldn't be too hard - it's just a matter of people knowing about it.

Perhaps such code should be in its own suitably-named directory, but whatever.

maintainer
#8 lore raw

From: Andrew Morton <[email protected]>
Date: Thu, 11 Oct 2007 21:25:39 -0700

Quoted 7 lines · On Fri, 12 Oct 2007 13:52:14 +1000 Paul Mackerras <[email protected]> wrote:
Quoted 4 lines

So Andrew, what do you think is better - arch/powerpc/boot having its own copies of the zlib_inflate stuff, or #ifdefs of some kind in lib/zlib_inflate/*.c?

Quoted 5 lines

The latter - copying code is evil. Keeping the existing code dual-mode shouldn't be too hard - it's just a matter of people knowing about it.

Perhaps such code should be in its own suitably-named directory, but whatever.

I'll work on a fix for this.

maintainer
#9 lore raw

From: David Miller <[email protected]>
Date: Thu, 11 Oct 2007 21:54:29 -0700 (PDT)

Quoted 10 lines

From: Andrew Morton <[email protected]>
Date: Thu, 11 Oct 2007 21:25:39 -0700

Quoted 7 lines · On Fri, 12 Oct 2007 13:52:14 +1000 Paul Mackerras <[email protected]> wrote:
Quoted 4 lines

So Andrew, what do you think is better - arch/powerpc/boot having its own copies of the zlib_inflate stuff, or #ifdefs of some kind in lib/zlib_inflate/*.c?

Quoted 7 lines
Quoted 5 lines

The latter - copying code is evil. Keeping the existing code dual-mode shouldn't be too hard - it's just a matter of people knowing about it.

Perhaps such code should be in its own suitably-named directory, but whatever.

I'll work on a fix for this.

Here is the patch I'm putting through some paces, let me know if it solves the powerpc problem.

Thanks!

Quoted 1 line

From 95702f93bac04b7db373e57fb606a6614c5bfcb4 Mon Sep 17 00:00:00 2001

From: David S. Miller <[email protected]>
Date: Thu, 11 Oct 2007 22:15:08 -0700
Subject: [PATCH] [ZLIB]: Fix external builds of zlib_inflate code.

Move zlib_inflate_blob() out into it's own source file, infutil.c, so that things like the powerpc zImage builder in arch/powerpc/boot/Makefile don't end up trying to compile it.

---
 lib/zlib_inflate/Makefile  |    2 +-
 lib/zlib_inflate/inflate.c |   47 ------------------------------------------
 lib/zlib_inflate/infutil.c |   49 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 48 deletions(-)
 create mode 100644 lib/zlib_inflate/infutil.c
lib/zlib_inflate/Makefile +1 -1
index bf06548..49f8ce5 100644
@@ -15,5 +15,5 @@
 
 obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate.o
 
-zlib_inflate-objs := inffast.o inflate.o \
+zlib_inflate-objs := inffast.o inflate.o infutil.o \
 		     inftrees.o inflate_syms.o
lib/zlib_inflate/inflate.c +0 -47

50 lines not on this page · raw message

lib/zlib_inflate/infutil.c new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.5.3.3