From: hansr Date: Wed, 5 Nov 2014 12:54:07 +0000 (+0100) Subject: Remove support for ASMV and ASMINF defines and clean up match.c handling. X-Git-Tag: 1.9.9-b1~895 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=860f6b19f7473ca3a0d901f150e9b5d7b44d4e1c;p=thirdparty%2Fzlib-ng.git Remove support for ASMV and ASMINF defines and clean up match.c handling. This makes it easier to implement support for ASM replacements using configure parameters if needed later. Also since zlib-ng uses compiler intrinsics, this needed a cleanup in any case. --- diff --git a/Makefile.in b/Makefile.in index e9dd54518..972283fc3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -7,10 +7,6 @@ # Normally configure builds both a static and a shared library. # If you want to build just a static library, use: ./configure --static -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o - # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: # make install # To install in $HOME instead of /usr/local, use: @@ -28,7 +24,6 @@ SFLAGS=-O LDFLAGS= TEST_LDFLAGS=-L. libz.a LDSHARED=$(CC) -CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so @@ -58,21 +53,17 @@ mandir = ${prefix}/share/man man3dir = ${mandir}/man3 pkgconfigdir = ${libdir}/pkgconfig -OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o $(ARCH_STATIC_OBJS) +OBJZ = adler32.o crc32.o deflate.o match.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o $(ARCH_STATIC_OBJS) OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o OBJC = $(OBJZ) $(OBJG) -PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo $(ARCH_SHARED_OBJS) +PIC_OBJZ = adler32.lo crc32.lo deflate.lo match.o infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo $(ARCH_SHARED_OBJS) PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG) -# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo -OBJA = -PIC_OBJA = - -OBJS = $(OBJC) $(OBJA) +OBJS = $(OBJC) -PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA) +PIC_OBJS = $(PIC_OBJC) all: $(ARCHDIR) static shared @@ -141,18 +132,6 @@ libz.a: $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 -match.o: match.S - $(CPP) match.S > _match.s - $(CC) -c _match.s - mv _match.o match.o - rm -f _match.s - -match.lo: match.S - $(CPP) match.S > _match.s - $(CC) -c -fPIC _match.s - mv _match.o match.lo - rm -f _match.s - example.o: test/example.c zlib.h zconf.h $(CC) $(CFLAGS) -I. -c -o $@ test/example.c diff --git a/configure b/configure index 560324975..6b5d8773b 100755 --- a/configure +++ b/configure @@ -176,7 +176,6 @@ EOF test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log cc=${CC-${CROSS_PREFIX}gcc} cflags=${CFLAGS-"-O3"} -# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure case "$cc" in *gcc*) gcc=1 ;; *clang*) gcc=1 ;; @@ -430,20 +429,6 @@ else TEST="all teststatic testshared" fi -# check for underscores in external names for use by assembler code -CPP=${CPP-"$CC -E"} -case $CFLAGS in - *ASMV*) - echo >> configure.log - show "$NM $test.o | grep _hello" - if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then - CPP="$CPP -DNO_UNDERLINE" - echo Checking for underline in external names... No. | tee -a configure.log - else - echo Checking for underline in external names... Yes. | tee -a configure.log - fi ;; -esac - echo >> configure.log # check for large file support, and if none, check for fseeko() @@ -724,7 +709,6 @@ echo AR = $AR >> configure.log echo ARFLAGS = $ARFLAGS >> configure.log echo CC = $CC >> configure.log echo CFLAGS = $CFLAGS >> configure.log -echo CPP = $CPP >> configure.log echo EXE = $EXE >> configure.log echo LDCONFIG = $LDCONFIG >> configure.log echo LDFLAGS = $LDFLAGS >> configure.log @@ -759,7 +743,6 @@ sed < Makefile.in " /^SFLAGS *=/s#=.*#=$SFLAGS# /^LDFLAGS *=/s#=.*#=$LDFLAGS# /^LDSHARED *=/s#=.*#=$LDSHARED# -/^CPP *=/s#=.*#=$CPP# /^STATICLIB *=/s#=.*#=$STATICLIB# /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# @@ -796,7 +779,6 @@ sed < $ARCHDIR/Makefile.in " sed < zlib.pc.in " /^CC *=/s#=.*#=$CC# /^CFLAGS *=/s#=.*#=$CFLAGS# -/^CPP *=/s#=.*#=$CPP# /^LDSHARED *=/s#=.*#=$LDSHARED# /^STATICLIB *=/s#=.*#=$STATICLIB# /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# diff --git a/deflate.c b/deflate.c index 6ac69c41f..7b531b017 100644 --- a/deflate.c +++ b/deflate.c @@ -50,6 +50,7 @@ /* @(#) $Id$ */ #include "deflate.h" +#include "match.h" #if defined(X86_CPUID) #include "arch/x86/x86.h" @@ -83,12 +84,6 @@ local void lm_init (deflate_state *s); local void putShortMSB (deflate_state *s, uInt b); ZLIB_INTERNAL void flush_pending (z_streamp strm); ZLIB_INTERNAL int read_buf (z_streamp strm, Byte *buf, unsigned size); -#ifdef ASMV - void match_init (void); /* asm code initialization */ - uInt longest_match (deflate_state *s, IPos cur_match); -#else -local uInt longest_match (deflate_state *s, IPos cur_match); -#endif #ifdef DEBUG local void check_match (deflate_state *s, IPos start, IPos match, int length); @@ -1170,13 +1165,8 @@ local void lm_init (deflate_state *s) s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif } -#include "match.c" - #ifdef DEBUG /* =========================================================================== * Check that the match at match_start is indeed a match. diff --git a/inffast.c b/inffast.c index 9747028c0..6ab7c5588 100644 --- a/inffast.c +++ b/inffast.c @@ -8,8 +8,6 @@ #include "inflate.h" #include "inffast.h" -#ifndef ASMINF - /* Allow machine dependent optimization for post-increment or pre-increment. Based on testing to date, Pre-increment preferred for: @@ -340,5 +338,3 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) - Larger unrolled copy loops (three is about right) - Moving len -= 3 statement into middle of loop */ - -#endif /* !ASMINF */ diff --git a/match.c b/match.c index 5ca958fa2..0843933ac 100644 --- a/match.c +++ b/match.c @@ -13,16 +13,18 @@ #include "deflate.h" #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) -# define longest_match std2_longest_match +# define std2_longest_match #else -# define longest_match std1_longest_match +# define std1_longest_match #endif +#ifdef std1_longest_match + /* * Standard longest_match * */ -local unsigned std1_longest_match(deflate_state *z_const s, IPos cur_match) +ZLIB_INTERNAL unsigned longest_match(deflate_state *z_const s, IPos cur_match) { z_const unsigned wmask = s->w_mask; z_const Pos *prev = s->prev; @@ -135,12 +137,14 @@ local unsigned std1_longest_match(deflate_state *z_const s, IPos cur_match) return best_len; return s->lookahead; } +#endif +#ifdef std2_longest_match /* * UNALIGNED_OK longest_match * */ -local unsigned std2_longest_match(deflate_state *z_const s, IPos cur_match) +ZLIB_INTERNAL unsigned longest_match(deflate_state *z_const s, IPos cur_match) { z_const unsigned wmask = s->w_mask; z_const Pos *prev = s->prev; @@ -256,3 +260,4 @@ local unsigned std2_longest_match(deflate_state *z_const s, IPos cur_match) return best_len; return s->lookahead; } +#endif diff --git a/zutil.c b/zutil.c index afad9804a..cabca8683 100644 --- a/zutil.c +++ b/zutil.c @@ -60,9 +60,6 @@ uLong ZEXPORT zlibCompileFlags() #ifdef DEBUG flags += 1 << 8; #endif -#if defined(ASMV) || defined(ASMINF) - flags += 1 << 9; -#endif #ifdef ZLIB_WINAPI flags += 1 << 10; #endif