mirror of
https://github.com/shadps4-emu/ext-zlib-ng.git
synced 2024-10-07 00:13:58 +00:00
Make unaligned access being disabled configurable via build scripts.
This commit is contained in:
parent
e38c493337
commit
c78c835a49
3
.github/workflows/cmake.yml
vendored
3
.github/workflows/cmake.yml
vendored
@ -51,10 +51,11 @@ jobs:
|
||||
codecov: ubuntu_gcc_osb
|
||||
cflags: -O1 -g3
|
||||
|
||||
- name: Ubuntu GCC -O3
|
||||
- name: Ubuntu GCC -O3 No Unaligned
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cxx-compiler: g++
|
||||
cmake-args: -DWITH_UNALIGNED=OFF
|
||||
codecov: ubuntu_gcc_o3
|
||||
cflags: -O3
|
||||
|
||||
|
@ -87,6 +87,7 @@ option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF)
|
||||
option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF)
|
||||
option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF)
|
||||
option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF)
|
||||
option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON)
|
||||
|
||||
set(ZLIB_SYMBOL_PREFIX "" CACHE STRING "Give this prefix to all publicly exported symbols.
|
||||
Useful when embedding into a larger library.
|
||||
@ -137,6 +138,7 @@ mark_as_advanced(FORCE
|
||||
WITH_POWER8
|
||||
WITH_INFLATE_STRICT
|
||||
WITH_INFLATE_ALLOW_INVALID_DIST
|
||||
WITH_UNALIGNED
|
||||
INSTALL_UTILS
|
||||
)
|
||||
|
||||
@ -247,6 +249,12 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set architecture alignment requirements
|
||||
if(NOT WITH_UNALIGNED)
|
||||
add_definitions(-DNO_UNALIGNED)
|
||||
message(STATUS "Unaligned reads manually disabled")
|
||||
endif()
|
||||
|
||||
# Apply warning compiler flags
|
||||
if(WITH_MAINTAINER_WARNINGS)
|
||||
add_compile_options(${WARNFLAGS} ${WARNFLAGS_MAINTAINER} ${WARNFLAGS_DISABLE})
|
||||
|
@ -211,6 +211,7 @@ Advanced Build Options
|
||||
| WITH_CRC32_VX | --without-crc32-vx | Build with vectorized CRC32 on IBM Z | ON |
|
||||
| WITH_DFLTCC_DEFLATE | --with-dfltcc-deflate | Build with DFLTCC intrinsics for compression on IBM Z | OFF |
|
||||
| WITH_DFLTCC_INFLATE | --with-dfltcc-inflate | Build with DFLTCC intrinsics for decompression on IBM Z | OFF |
|
||||
| WITH_UNALIGNED | --without-unaligned | Allow optimizations that use unaligned reads if safe on current arch| ON |
|
||||
| WITH_INFLATE_STRICT | | Build with strict inflate distance checking | OFF |
|
||||
| WITH_INFLATE_ALLOW_INVALID_DIST | | Build with zero fill for inflate invalid distances | OFF |
|
||||
| INSTALL_UTILS | | Copy minigzip and minideflate during install | OFF |
|
||||
|
12
configure
vendored
12
configure
vendored
@ -86,6 +86,7 @@ mandir=${mandir-'${prefix}/share/man'}
|
||||
shared_ext='.so'
|
||||
shared=1
|
||||
gzfileops=1
|
||||
unalignedok=1
|
||||
compat=0
|
||||
cover=0
|
||||
build32=0
|
||||
@ -162,7 +163,8 @@ case "$1" in
|
||||
echo ' [--warn] Enables extra compiler warnings' | tee -a configure.log
|
||||
echo ' [--debug] Enables extra debug prints during operation' | tee -a configure.log
|
||||
echo ' [--zlib-compat] Compiles for zlib-compatible API instead of zlib-ng API' | tee -a configure.log
|
||||
echo ' [--without-gzfileops] Compiles with the gzfile parts of the API enabled' | tee -a configure.log
|
||||
echo ' [--without-unaligned] Compiles without fast unaligned access' | tee -a configure.log
|
||||
echo ' [--without-gzfileops] Compiles without the gzfile parts of the API enabled' | tee -a configure.log
|
||||
echo ' [--without-optimizations] Compiles without support for optional instruction sets' | tee -a configure.log
|
||||
echo ' [--without-new-strategies] Compiles without using new additional deflate strategies' | tee -a configure.log
|
||||
echo ' [--without-acle] Compiles without ARM C Language Extensions' | tee -a configure.log
|
||||
@ -194,6 +196,7 @@ case "$1" in
|
||||
-s* | --shared | --enable-shared) shared=1; shift ;;
|
||||
-t | --static) shared=0; shift ;;
|
||||
--zlib-compat) compat=1; shift ;;
|
||||
--without-unaligned) unalignedok=0; shift ;;
|
||||
--without-gzfileops) gzfileops=0; shift ;;
|
||||
--cover) cover=1; shift ;;
|
||||
-3* | --32) build32=1; shift ;;
|
||||
@ -910,6 +913,13 @@ else
|
||||
PIC_TESTOBJG="\$(OBJG)"
|
||||
fi
|
||||
|
||||
# set architecture alignment requirements
|
||||
if test $unalignedok -eq 0; then
|
||||
CFLAGS="${CFLAGS} -DNO_UANLIGNED"
|
||||
SFLAGS="${SFLAGS} -DNO_UNALIGNED"
|
||||
echo "Unaligned reads manually disabled." | tee -a configure.log
|
||||
fi
|
||||
|
||||
# enable reduced memory configuration
|
||||
if test $reducedmem -eq 1; then
|
||||
echo "Configuring for reduced memory environment." | tee -a configure.log
|
||||
|
34
zbuild.h
34
zbuild.h
@ -194,25 +194,27 @@
|
||||
# define Tracecv(c, x)
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64) || defined(__amd64__) || defined(_M_AMD64)
|
||||
# define UNALIGNED_OK
|
||||
# define UNALIGNED64_OK
|
||||
#elif defined(__i386__) || defined(__i486__) || defined(__i586__) || \
|
||||
defined(__i686__) || defined(_X86_) || defined(_M_IX86)
|
||||
# define UNALIGNED_OK
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
# if (defined(__GNUC__) && defined(__ARM_FEATURE_UNALIGNED)) || !defined(__GNUC__)
|
||||
#ifndef NO_UNALIGNED
|
||||
# if defined(__x86_64__) || defined(_M_X64) || defined(__amd64__) || defined(_M_AMD64)
|
||||
# define UNALIGNED_OK
|
||||
# define UNALIGNED64_OK
|
||||
# endif
|
||||
#elif defined(__arm__) || (_M_ARM >= 7)
|
||||
# if (defined(__GNUC__) && defined(__ARM_FEATURE_UNALIGNED)) || !defined(__GNUC__)
|
||||
# elif defined(__i386__) || defined(__i486__) || defined(__i586__) || \
|
||||
defined(__i686__) || defined(_X86_) || defined(_M_IX86)
|
||||
# define UNALIGNED_OK
|
||||
# endif
|
||||
#elif defined(__powerpc64__) || defined(__ppc64__)
|
||||
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define UNALIGNED_OK
|
||||
# define UNALIGNED64_OK
|
||||
# elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
# if (defined(__GNUC__) && defined(__ARM_FEATURE_UNALIGNED)) || !defined(__GNUC__)
|
||||
# define UNALIGNED_OK
|
||||
# define UNALIGNED64_OK
|
||||
# endif
|
||||
# elif defined(__arm__) || (_M_ARM >= 7)
|
||||
# if (defined(__GNUC__) && defined(__ARM_FEATURE_UNALIGNED)) || !defined(__GNUC__)
|
||||
# define UNALIGNED_OK
|
||||
# endif
|
||||
# elif defined(__powerpc64__) || defined(__ppc64__)
|
||||
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define UNALIGNED_OK
|
||||
# define UNALIGNED64_OK
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user