mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Matt Mackall <mpm@selenic.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [CFT] inflate.c rework arch testing needed
Date: Fri, 19 Mar 2004 21:39:57 +0000	[thread overview]
Message-ID: <20040319213957.K14431@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20040319171615.GN11010@waste.org>; from mpm@selenic.com on Fri, Mar 19, 2004 at 11:16:15AM -0600

On Fri, Mar 19, 2004 at 11:16:15AM -0600, Matt Mackall wrote:
> On Fri, Mar 19, 2004 at 10:31:26AM +0000, Russell King wrote:
> > On Thu, Mar 18, 2004 at 05:10:06PM -0600, Matt Mackall wrote:
> > > I've reworked the mess that is lib/inflate.c, including:
> > 
> > Please don't - this will probably break the PIC decompressor on ARM.
> 
> If it works now, I don't see why it should. My last version of this
> was test-booted on ARM.

One test boot isn't sufficient - it's a combination of toolchain and
the way you boot which will bring up the issue.  Maybe you're using an
older toolchain from me, or not actually using the relocatable feature.

Basically, we rely on the toolchain generating GOT relocations for
data references, and we use the GOT table to point them to an area
of RAM.  However, later toolchains seem to "optimise" this and use
GOTOFF relocations for static data.  The GOT table is at a fixed
offset from the text segment, and this effectively makes the whole
thing unrelocatable.

(Having GOTOFF relocs for static read only data is fine though.
It's the read/write data which must use GOT relocs.)

> > There are un-merged patches in the pipeline which make this all work
> > correctly with todays toolchains - which mostly means getting rid of
> > all static data to make the compiler produce the right relocations.
> 
> Well perhaps you could send them to me.

I think this is everything...

diff -urpN orig/arch/arm/boot/compressed/misc.c linux/arch/arm/boot/compressed/misc.c
--- orig/arch/arm/boot/compressed/misc.c	Sun Sep 28 09:53:47 2003
+++ linux/arch/arm/boot/compressed/misc.c	Sun Sep 28 09:46:13 2003
@@ -113,7 +113,7 @@ static inline __ptr_t memcpy(__ptr_t __d
  * gzip delarations
  */
 #define OF(args)  args
-#define STATIC static
+#define STATIC
 
 typedef unsigned char  uch;
 typedef unsigned short ush;
@@ -122,12 +122,12 @@ typedef unsigned long  ulg;
 #define WSIZE 0x8000		/* Window size must be at least 32k, */
 				/* and a power of two */
 
-static uch *inbuf;		/* input buffer */
-static uch window[WSIZE];	/* Sliding window buffer */
+unsigned char *inbuf;		/* input buffer */
+unsigned char window[WSIZE];	/* Sliding window buffer */
 
-static unsigned insize;		/* valid bytes in inbuf */
-static unsigned inptr;		/* index of next byte to be processed in inbuf */
-static unsigned outcnt;		/* bytes in output buffer */
+unsigned int insize;		/* valid bytes in inbuf */
+unsigned int inptr;		/* index of next byte to be processed in inbuf */
+unsigned int outcnt;		/* bytes in output buffer */
 
 /* gzip flag byte */
 #define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
@@ -166,9 +166,9 @@ static void gzip_release(void **);
 extern char input_data[];
 extern char input_data_end[];
 
-static uch *output_data;
-static ulg output_ptr;
-static ulg bytes_out;
+unsigned char *output_data;
+unsigned long output_ptr;
+unsigned long bytes_out;
 
 static void *malloc(int size);
 static void free(void *where);
@@ -179,8 +179,8 @@ static void gzip_release(void **);
 static void puts(const char *);
 
 extern int end;
-static ulg free_mem_ptr;
-static ulg free_mem_ptr_end;
+unsigned long free_mem_ptr;
+unsigned long free_mem_ptr_end;
 
 #define HEAP_SIZE 0x2000
 
--- orig/lib/inflate.c	Fri Jan  9 22:40:07 2004
+++ linux/lib/inflate.c	Fri Jan  9 22:52:48 2004
@@ -1025,8 +1025,8 @@ STATIC int inflate(void)
  *
  **********************************************************************/
 
-static ulg crc_32_tab[256];
-static ulg crc;		/* initialized in makecrc() so it'll reside in bss */
+STATIC ulg crc_32_tab[256];
+STATIC ulg crc;		/* initialized in makecrc() so it'll reside in bss */
 #define CRC_VALUE (crc ^ 0xffffffffUL)
 
 /*



-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

  reply	other threads:[~2004-03-19 21:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18 23:10 Matt Mackall
2004-03-19  0:32 ` Jörn Engel
2004-03-19  3:09   ` Matt Mackall
2004-03-19  9:29     ` Jörn Engel
2004-03-28  7:00     ` [discuss] " Pavel Machek
2004-04-01 12:14       ` Jörn Engel
2004-03-19 10:31 ` Russell King
2004-03-19 17:16   ` Matt Mackall
2004-03-19 21:39     ` Russell King [this message]
2004-03-19 22:25       ` Matt Mackall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040319213957.K14431@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome