all: minor cleanups
This commit is contained in:
@@ -59,9 +59,9 @@ RUN cd /root \
|
|||||||
|
|
||||||
# install official UPX release binaries into /usr/local/bin; not required but convenient for testing
|
# install official UPX release binaries into /usr/local/bin; not required but convenient for testing
|
||||||
RUN cd /root \
|
RUN cd /root \
|
||||||
&& wget -q https://github.com/upx/upx/releases/download/v3.91/upx-3.91-amd64_linux.tar.bz2 \
|
&& curl -sS -L -O https://github.com/upx/upx/releases/download/v3.91/upx-3.91-amd64_linux.tar.bz2 \
|
||||||
&& xzversions="3.92 3.93 3.94 3.95 3.96 4.0.0 4.0.1 4.0.2 4.1.0 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4" \
|
&& xzversions="3.92 3.93 3.94 3.95 3.96 4.0.0 4.0.1 4.0.2 4.1.0 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4" \
|
||||||
&& for v in $xzversions; do wget -q https://github.com/upx/upx/releases/download/v${v}/upx-${v}-amd64_linux.tar.xz; done \
|
&& for v in $xzversions; do curl -sS -L -O https://github.com/upx/upx/releases/download/v${v}/upx-${v}-amd64_linux.tar.xz; done \
|
||||||
&& for f in ./upx-*.tar.*; do tar -xoaf $f; done \
|
&& for f in ./upx-*.tar.*; do tar -xoaf $f; done \
|
||||||
&& for v in 3.91 $xzversions; do d=upx-${v}-amd64_linux; ./$d/upx -qq -d $d/upx -o /usr/local/bin/upx-${v}; done \
|
&& for v in 3.91 $xzversions; do d=upx-${v}-amd64_linux; ./$d/upx -qq -d $d/upx -o /usr/local/bin/upx-${v}; done \
|
||||||
&& rm -r ./upx-*.tar.* ./upx-*linux \
|
&& rm -r ./upx-*.tar.* ./upx-*linux \
|
||||||
|
|||||||
Generated
+4
-4
@@ -144,7 +144,7 @@ ii libgcc-s1:i386 14-20240412-0ubuntu1 i386
|
|||||||
ii libgcrypt20:amd64 1.10.3-2build1 amd64 LGPL Crypto library - runtime library
|
ii libgcrypt20:amd64 1.10.3-2build1 amd64 LGPL Crypto library - runtime library
|
||||||
ii libgdbm-compat4t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (legacy support runtime version)
|
ii libgdbm-compat4t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (legacy support runtime version)
|
||||||
ii libgdbm6t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (runtime version)
|
ii libgdbm6t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (runtime version)
|
||||||
ii libglib2.0-0t64:amd64 2.80.0-6ubuntu1 amd64 GLib library of C routines
|
ii libglib2.0-0t64:amd64 2.80.0-6ubuntu3.1 amd64 GLib library of C routines
|
||||||
ii libgmp10:amd64 2:6.3.0+dfsg-2ubuntu6 amd64 Multiprecision arithmetic library
|
ii libgmp10:amd64 2:6.3.0+dfsg-2ubuntu6 amd64 Multiprecision arithmetic library
|
||||||
ii libgnutls30t64:amd64 3.8.3-1.1ubuntu3.1 amd64 GNU TLS library - main runtime library
|
ii libgnutls30t64:amd64 3.8.3-1.1ubuntu3.1 amd64 GNU TLS library - main runtime library
|
||||||
ii libgomp1:amd64 14-20240412-0ubuntu1 amd64 GCC OpenMP (GOMP) support library
|
ii libgomp1:amd64 14-20240412-0ubuntu1 amd64 GCC OpenMP (GOMP) support library
|
||||||
@@ -186,7 +186,7 @@ ii libmspack0t64:amd64 0.11-1.1build1 amd64
|
|||||||
ii libncurses6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling
|
ii libncurses6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling
|
||||||
ii libncursesw6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling (wide character support)
|
ii libncursesw6:amd64 6.4+20240113-1ubuntu2 amd64 shared libraries for terminal handling (wide character support)
|
||||||
ii libnettle8t64:amd64 3.9.1-2.2build1 amd64 low level cryptographic library (symmetric and one-way cryptos)
|
ii libnettle8t64:amd64 3.9.1-2.2build1 amd64 low level cryptographic library (symmetric and one-way cryptos)
|
||||||
ii libnghttp2-14:amd64 1.59.0-1build4 amd64 library implementing HTTP/2 protocol (shared library)
|
ii libnghttp2-14:amd64 1.59.0-1ubuntu0.1 amd64 library implementing HTTP/2 protocol (shared library)
|
||||||
ii libnl-3-200:amd64 3.7.0-0.3build1 amd64 library for dealing with netlink sockets
|
ii libnl-3-200:amd64 3.7.0-0.3build1 amd64 library for dealing with netlink sockets
|
||||||
ii libnl-genl-3-200:amd64 3.7.0-0.3build1 amd64 library for dealing with netlink sockets - generic netlink
|
ii libnl-genl-3-200:amd64 3.7.0-0.3build1 amd64 library for dealing with netlink sockets - generic netlink
|
||||||
ii libnpth0t64:amd64 1.6-3.1build1 amd64 replacement for GNU Pth using system threads
|
ii libnpth0t64:amd64 1.6-3.1build1 amd64 replacement for GNU Pth using system threads
|
||||||
@@ -361,7 +361,7 @@ ii zstd 1.5.5+dfsg2-2build1 amd64
|
|||||||
||/ Name Version Architecture Description
|
||/ Name Version Architecture Description
|
||||||
|
|
||||||
Packages sorted by Installed-Size:
|
Packages sorted by Installed-Size:
|
||||||
964659 ===== TOTAL (355 packages)
|
964903 ===== TOTAL (355 packages)
|
||||||
76943 valgrind amd64
|
76943 valgrind amd64
|
||||||
72249 gcc-13-x86-64-linux-gnu amd64
|
72249 gcc-13-x86-64-linux-gnu amd64
|
||||||
37841 g++-13-x86-64-linux-gnu amd64
|
37841 g++-13-x86-64-linux-gnu amd64
|
||||||
@@ -411,10 +411,10 @@ Packages sorted by Installed-Size:
|
|||||||
4879 libhwasan0 amd64
|
4879 libhwasan0 amd64
|
||||||
4341 ncurses-term all
|
4341 ncurses-term all
|
||||||
4244 minify amd64
|
4244 minify amd64
|
||||||
|
4193 libglib2.0-0t64 amd64
|
||||||
4103 apt amd64
|
4103 apt amd64
|
||||||
3983 gojq amd64
|
3983 gojq amd64
|
||||||
3956 python3-pycryptodome amd64
|
3956 python3-pycryptodome amd64
|
||||||
3949 libglib2.0-0t64 amd64
|
|
||||||
3849 libgprofng0 amd64
|
3849 libgprofng0 amd64
|
||||||
3806 liblsan0 amd64
|
3806 liblsan0 amd64
|
||||||
3721 groff-base amd64
|
3721 groff-base amd64
|
||||||
|
|||||||
+36
-11
@@ -232,6 +232,7 @@ struct CheckIntegral {
|
|||||||
checkU<typename std::add_const<T>::type>();
|
checkU<typename std::add_const<T>::type>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct CheckAlignment {
|
struct CheckAlignment {
|
||||||
static void check(void) noexcept {
|
static void check(void) noexcept {
|
||||||
@@ -256,16 +257,17 @@ struct CheckAlignment {
|
|||||||
UNUSED(t2);
|
UNUSED(t2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct TestBELE {
|
struct TestBELE {
|
||||||
static noinline bool test(void) noexcept {
|
static noinline bool test(void) noexcept {
|
||||||
CheckIntegral<T>::check();
|
CheckIntegral<T>::check();
|
||||||
CheckAlignment<T>::check();
|
CheckAlignment<T>::check();
|
||||||
// arithmetic checks
|
// arithmetic checks
|
||||||
T allbits = {};
|
T all_bits = {};
|
||||||
assert_noexcept(allbits == 0);
|
assert_noexcept(all_bits == 0);
|
||||||
allbits += 1;
|
all_bits += 1;
|
||||||
allbits -= 2;
|
all_bits -= 2;
|
||||||
T v1;
|
T v1;
|
||||||
v1 = 1;
|
v1 = 1;
|
||||||
v1 *= 4;
|
v1 *= 4;
|
||||||
@@ -279,7 +281,7 @@ struct TestBELE {
|
|||||||
assert_noexcept((v1 >= v2));
|
assert_noexcept((v1 >= v2));
|
||||||
assert_noexcept(!(v1 < v2));
|
assert_noexcept(!(v1 < v2));
|
||||||
assert_noexcept(!(v1 > v2));
|
assert_noexcept(!(v1 > v2));
|
||||||
v2 ^= allbits;
|
v2 ^= all_bits;
|
||||||
assert_noexcept(!(v1 == v2));
|
assert_noexcept(!(v1 == v2));
|
||||||
assert_noexcept((v1 != v2));
|
assert_noexcept((v1 != v2));
|
||||||
assert_noexcept((v1 <= v2));
|
assert_noexcept((v1 <= v2));
|
||||||
@@ -305,6 +307,25 @@ struct TestBELE {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T, bool T_is_signed>
|
||||||
|
struct CheckSignedness {
|
||||||
|
template <class U, bool U_is_signed>
|
||||||
|
static inline void checkU(void) noexcept {
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U) == sizeof(T));
|
||||||
|
COMPILE_TIME_ASSERT(alignof(U) == alignof(T));
|
||||||
|
COMPILE_TIME_ASSERT(U_is_signed ? ((U) 0 - 1 < 0) : ((U) 0 - 1 > 0));
|
||||||
|
constexpr U all_bits = (U) (U(0) - U(1));
|
||||||
|
COMPILE_TIME_ASSERT(U_is_signed ? (all_bits < 0) : (all_bits > 0));
|
||||||
|
}
|
||||||
|
static void check(void) noexcept {
|
||||||
|
checkU<T, T_is_signed>();
|
||||||
|
using signed_type = std::make_signed_t<T>;
|
||||||
|
checkU<signed_type, true>();
|
||||||
|
using unsigned_type = std::make_unsigned_t<T>;
|
||||||
|
checkU<unsigned_type, false>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <class A, class B>
|
template <class A, class B>
|
||||||
struct TestNoAliasingStruct {
|
struct TestNoAliasingStruct {
|
||||||
static noinline bool test(A *a, B *b) noexcept {
|
static noinline bool test(A *a, B *b) noexcept {
|
||||||
@@ -501,12 +522,16 @@ void upx_compiler_sanity_check(void) noexcept {
|
|||||||
CheckIntegral<upx_ptraddr_t>::check();
|
CheckIntegral<upx_ptraddr_t>::check();
|
||||||
CheckIntegral<upx_uintptr_t>::check();
|
CheckIntegral<upx_uintptr_t>::check();
|
||||||
|
|
||||||
COMPILE_TIME_ASSERT(ptrdiff_t(0) - 1 < 0);
|
CheckSignedness<long long, true>::check();
|
||||||
COMPILE_TIME_ASSERT(intptr_t(0) - 1 < 0);
|
CheckSignedness<ptrdiff_t, true>::check();
|
||||||
COMPILE_TIME_ASSERT(size_t(0) - 1 > 0);
|
CheckSignedness<intptr_t, true>::check();
|
||||||
COMPILE_TIME_ASSERT(uintptr_t(0) - 1 > 0);
|
CheckSignedness<unsigned long long, false>::check();
|
||||||
COMPILE_TIME_ASSERT(upx_ptraddr_t(0) - 1 > 0);
|
CheckSignedness<size_t, false>::check();
|
||||||
COMPILE_TIME_ASSERT(upx_uintptr_t(0) - 1 > 0);
|
CheckSignedness<uintptr_t, false>::check();
|
||||||
|
CheckSignedness<upx_off_t, true>::check();
|
||||||
|
CheckSignedness<upx_ptraddr_t, false>::check();
|
||||||
|
CheckSignedness<upx_sptraddr_t, true>::check();
|
||||||
|
CheckSignedness<upx_uintptr_t, false>::check();
|
||||||
|
|
||||||
COMPILE_TIME_ASSERT(sizeof(upx_charptr_unit_type) == 1)
|
COMPILE_TIME_ASSERT(sizeof(upx_charptr_unit_type) == 1)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(upx_charptr_unit_type)
|
COMPILE_TIME_ASSERT_ALIGNED1(upx_charptr_unit_type)
|
||||||
|
|||||||
+2
-1
@@ -145,7 +145,8 @@ typedef acc_int64_t upx_int64_t;
|
|||||||
typedef acc_uint64_t upx_uint64_t;
|
typedef acc_uint64_t upx_uint64_t;
|
||||||
typedef acc_uintptr_t upx_uintptr_t;
|
typedef acc_uintptr_t upx_uintptr_t;
|
||||||
// see CHERI ptraddr_t / vaddr_t
|
// see CHERI ptraddr_t / vaddr_t
|
||||||
typedef upx_uintptr_t upx_ptraddr_t;
|
typedef acc_uintptr_t upx_ptraddr_t;
|
||||||
|
typedef acc_intptr_t upx_sptraddr_t;
|
||||||
|
|
||||||
// UPX convention: use "byte" when dealing with data; use "char/uchar" when dealing
|
// UPX convention: use "byte" when dealing with data; use "char/uchar" when dealing
|
||||||
// with strings; use "upx_uint8_t" when dealing with small integers
|
// with strings; use "upx_uint8_t" when dealing with small integers
|
||||||
|
|||||||
+1
-2
@@ -78,8 +78,7 @@ void xspan_check_range(const void *ptr, const void *base, ptrdiff_t size_in_byte
|
|||||||
xspan_fail_range_nullbase();
|
xspan_fail_range_nullbase();
|
||||||
#if defined(__SANITIZE_ADDRESS__) || 1
|
#if defined(__SANITIZE_ADDRESS__) || 1
|
||||||
// info: pointers are out of range deliberately during internal doctest checks; see dt_xspan.cpp
|
// info: pointers are out of range deliberately during internal doctest checks; see dt_xspan.cpp
|
||||||
ACC_COMPILE_TIME_ASSERT(sizeof(intptr_t) == sizeof(upx_ptraddr_t))
|
const upx_sptraddr_t off = ptr_get_address(ptr) - ptr_get_address(base);
|
||||||
const intptr_t off = ptr_get_address(ptr) - ptr_get_address(base);
|
|
||||||
#else
|
#else
|
||||||
const ptrdiff_t off = (const charptr) ptr - (const charptr) base;
|
const ptrdiff_t off = (const charptr) ptr - (const charptr) base;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user