lib: Mark gunzip as relocation code

Mark the gunzip code as needed by relocation. This is used to decompress
the next-phase image.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-01-26 11:43:24 -07:00
committed by Tom Rini
parent 4ca2970390
commit 5c751dc091
2 changed files with 15 additions and 12 deletions

View File

@@ -15,6 +15,7 @@
#include <u-boot/crc.h> #include <u-boot/crc.h>
#include <watchdog.h> #include <watchdog.h>
#include <u-boot/zlib.h> #include <u-boot/zlib.h>
#include <asm/sections.h>
#define HEADER0 '\x1f' #define HEADER0 '\x1f'
#define HEADER1 '\x8b' #define HEADER1 '\x8b'
@@ -43,7 +44,7 @@ void gzfree(void *x, void *addr, unsigned nb)
free (addr); free (addr);
} }
int gzip_parse_header(const unsigned char *src, unsigned long len) __rcode int gzip_parse_header(const unsigned char *src, unsigned long len)
{ {
int i, flags; int i, flags;
@@ -71,7 +72,7 @@ int gzip_parse_header(const unsigned char *src, unsigned long len)
return i; return i;
} }
int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp) __rcode int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)
{ {
int offset = gzip_parse_header(src, *lenp); int offset = gzip_parse_header(src, *lenp);
@@ -274,8 +275,8 @@ out:
/* /*
* Uncompress blocks compressed with zlib without headers * Uncompress blocks compressed with zlib without headers
*/ */
int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp, __rcode int zunzip(void *dst, int dstlen, unsigned char *src,
int stoponerr, int offset) unsigned long *lenp, int stoponerr, int offset)
{ {
z_stream s; z_stream s;
int err = 0; int err = 0;

View File

@@ -2,10 +2,12 @@
* Copyright (C) 1995-2005 Mark Adler * Copyright (C) 1995-2005 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
#include <asm/sections.h>
local void fixedtables OF((struct inflate_state FAR *state)); local void fixedtables OF((struct inflate_state FAR *state));
local int updatewindow OF((z_streamp strm, unsigned out)); local int updatewindow OF((z_streamp strm, unsigned out));
int ZEXPORT inflateReset(z_streamp strm) __rcode int ZEXPORT inflateReset(z_streamp strm)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
@@ -30,8 +32,8 @@ int ZEXPORT inflateReset(z_streamp strm)
return Z_OK; return Z_OK;
} }
int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, __rcode int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
int stream_size) int stream_size)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
@@ -67,12 +69,12 @@ int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
return inflateReset(strm); return inflateReset(strm);
} }
int ZEXPORT inflateInit_(z_streamp strm, int stream_size) __rcode int ZEXPORT inflateInit_(z_streamp strm, int stream_size)
{ {
return inflateInit2_(strm, DEF_WBITS, stream_size); return inflateInit2_(strm, DEF_WBITS, stream_size);
} }
local void fixedtables(struct inflate_state FAR *state) __rcode local void fixedtables(struct inflate_state FAR *state)
{ {
state->lencode = lenfix; state->lencode = lenfix;
state->lenbits = 9; state->lenbits = 9;
@@ -94,7 +96,7 @@ local void fixedtables(struct inflate_state FAR *state)
output will fall in the output data, making match copies simpler and faster. output will fall in the output data, making match copies simpler and faster.
The advantage may be dependent on the size of the processor's data caches. The advantage may be dependent on the size of the processor's data caches.
*/ */
local int updatewindow(z_streamp strm, unsigned out) __rcode local int updatewindow(z_streamp strm, unsigned int out)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
unsigned copy, dist; unsigned copy, dist;
@@ -322,7 +324,7 @@ local int updatewindow(z_streamp strm, unsigned out)
when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
will return Z_BUF_ERROR if it has not reached the end of the stream. will return Z_BUF_ERROR if it has not reached the end of the stream.
*/ */
int ZEXPORT inflate(z_streamp strm, int flush) __rcode int ZEXPORT inflate(z_streamp strm, int flush)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
unsigned char FAR *next; /* next input */ unsigned char FAR *next; /* next input */
@@ -924,7 +926,7 @@ int ZEXPORT inflate(z_streamp strm, int flush)
return ret; return ret;
} }
int ZEXPORT inflateEnd(z_streamp strm) __rcode int ZEXPORT inflateEnd(z_streamp strm)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)