The root CMakeLists.txt has a minimum CMake version of 3.5, and
CheckHiddenVisibility.cmake's workarounds are only needed for
CMake 3.2 and earlier.
Set CMP0063 unconditionally (added in CMake 3.3) and set the
CMAKE_<LANG>_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN
variables where CHECK_HIDDEN_VISIBILITY() was called before.
There should effectively be no code changes with this commit.
Something changed that caused the build on Xubuntu 16.04 (32-bit) to fail:
[ 63%] Linking CXX shared library ../../lib/libromdata.so
/usr/bin/ld: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
src/libromdata/CMakeFiles/romdata.dir/build.make:3614: recipe for target 'lib/libromdata.so.6.0' failed
make[2]: *** [lib/libromdata.so.6.0] Error 1
Setting POSITION_INDEPENDENT_CODE instead of "-fpic -fPIC" fixes this.
[extlib] Correctly set properties on the 'mspack' target instead of
'libmspack'. Otherwise, libmspack won't have either EXCLUDE_FROM_ALL
or POSITION_INDEPENDENT_CODE.
[libmspack-xenia] lzxd.c: Cast pointer differences to int.
[microtar] microtar.c: fwrite() and fread() return size_t.
[libcachecommon] CacheKeys.hpp: Silence C4834 and gcc -Wunused-result
for cacheKeys.c_str().
[libromdata] ELF.cpp: Cast val_dtag[] to uint32_t.
[libromdata] EXE_NE.cpp: Cast ao::uvector<> sizes to uint32_t.
[libromdata/tests] microtar_zstd.c: Cast toCopy to unsigned when passing
it to microtar functions.
[librpfile] RpFile_scsi_win32.cpp: Windows 8.1 SDK's ntddscsi.h doesn't
properly declare _NV_SEP_WRITE_CACHE_TYPE as an enum.
[librptext/tests] TextFuncsTest: Silence warnings about implicit
conversoin from double to unsigned int by only doing integer
calculations. (It's done at compile time, not runtime.)
[librptexture] PowerVR3, ValveVTF3: Explicitly cast some size_t
calculations to unsigned int.
[win32] KeyManagerTab: Explicitly cast the return value from
std::count_if() to int.
Very minor space optimization. `position_slots` is only referenced once
during lzxd initialization, so this shouldn't cause a performance issue.
Code size differences: (64-bit Gentoo Linux, gcc-12.1.0, release build, no LTO)
text data bss dec hex filename
14091 0 0 14091 370b ./extlib/libmspack-xenia/CMakeFiles/mspack.dir/lzxd.c.o
14053 0 0 14053 36e5 ./extlib/libmspack-xenia/CMakeFiles/mspack.dir/lzxd.c.o
-38 0 0 -38 -26 Difference
I would have expected the difference to be 22, since position_slots has
11 elements, but I guess reducing the size may have reduced some padding
as well.
Reference: https://fedoraproject.org/wiki/Format-Security-FAQ
-Werror=format-nonliteral is *not* enabled because there are some
legitimate uses of non-literal format strings.
Separated the warning flags into multiple variables.
Updated everything to build with this change.
- Added language specifications.
- Set the top-level project version in the PROJECT() call.
- Set CMP0063 to NEW if it's available. This enables the symbol
visibility presets on *all* target types, not just shared libraries,
module libraries, and executables with ENABLE_EXPORTS set.
ffs() is not declared in headers, even though it's a gcc built-in.
extlib/libmspack-xenia/xenia_lzx.c: In function 'bit_scan_forward':
extlib/libmspack-xenia/xenia_lzx.c:39:10: warning: implicit declaration of function 'ffs' [-Wimplicit-function-declaration]
39 | int i = ffs(v);
| ^~~
extlib/libmspack-xenia/xenia_lzx.c:39:14: warning: 'ffs' argument 1 promotes to 'uint32_t' {aka 'unsigned int'} where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
39 | int i = ffs(v);
| ^
<built-in>: note: built-in 'ffs' declared here
Upstream changes:
[CPU] Use window size for LZX ref_data_size
71780838f0
[CPU] Properly clear LZX window
c213f7d7a3
Added xe::bit_scan_forward, referenced in these commits:
[CPU] Minor LZX code cleanup.
29665ae79c
[CPU] Fix lzx_decompress misuse of xe::bit_count.
e14639c6c0
There's also a fix for the non-Windows implementation (off-by-one).
Fixes PVS-Studio V127 (Med): An overflow of the 32-bit 'window_bits'
variable is possible inside a long cycle which utilizes a memsize-type
loop counter.
[librpbase] TextFuncs.hpp:
- Don't #include "TextFuncs_libc.h". Anything that uses strnlen() or
memmem() has to include this header file directly.
- Moved RP_WIS16 from config.librpbase.h to TextFuncs.hpp. This wasn't
actually configured by cmake; it's set on Windows and unsaet on
everything else.
[libromdata] WiiWAD.cpp: #include "librpbase/config.librpbase.h"
for ENABLE_DECRYPTION.
This is a stripped-down version of libmspack containing only the necessary
functionality for Xbox 360 executables.
Xenia commit: e706cf0d5413c31b7e80a50411cc88cc7c71af30
License: LGPLv2.1
config.h.in: Modified for cmake; removed unnecessary checks.
debian/copyright: Added copyright information.
cmake/options.cmake: Added an ENABLE_LIBMSPACK option. (default is ON)