1
0
mirror of https://github.com/upx/upx.git synced 2025-08-07 22:46:51 +08:00

all: minor updates

This commit is contained in:
Markus F.X.J. Oberhumer
2022-12-15 16:20:22 +01:00
parent 9934e33b99
commit c23c7a9379
7 changed files with 29 additions and 18 deletions

View File

@ -12,6 +12,7 @@ on:
branches: branches:
- '*' - '*'
- '!appveyor*' - '!appveyor*'
- '!gitea*'
- '!gitlab*' - '!gitlab*'
- '!travis*' - '!travis*'
workflow_dispatch: workflow_dispatch:
@ -28,13 +29,14 @@ jobs:
run: | run: |
uname -a; pwd; id; umask uname -a; pwd; id; umask
cd ..; mkdir -p deps; cd deps; mkdir packages cd ..; mkdir -p deps; cd deps; mkdir packages
# for ubuntu-22.04: install python2 # for ubuntu-22.04: install python2-minimal
##export DEBIAN_FRONTEND=noninteractive ##export DEBIAN_FRONTEND=noninteractive
##sudo apt-get install -y --no-install-recommends python2-minimal ##sudo apt-get update && sudo apt-get install -y --no-install-recommends python2-minimal
# manually install compat libs from Ubuntu 16.04 # manually install compat libs from Ubuntu 16.04
wget -q 'http://archive.kernel.org/ubuntu-archive/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.6-1_amd64.deb' wget -q 'http://archive.kernel.org/ubuntu-archive/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.6-1_amd64.deb'
for f in ./*.deb; do dpkg -x $f ./packages; done for f in ./*.deb; do dpkg -x $f ./packages; done
sudo mv -v -n ./packages/usr/lib/x86_64-linux-gnu/lib* /usr/lib/x86_64-linux-gnu/ sudo mv -v -n ./packages/usr/lib/x86_64-linux-gnu/lib* /usr/lib/x86_64-linux-gnu/
rm -rf ./*.deb ./packages
sudo ldconfig sudo ldconfig
wget -q -O - https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz | tar -xJ wget -q -O - https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz | tar -xJ
- name: 'Check out code' - name: 'Check out code'
@ -43,6 +45,14 @@ jobs:
- name: 'Rebuild and verify stubs' - name: 'Rebuild and verify stubs'
run: | run: |
env C=gcc X=rebuild-stubs TRAVIS_OS_NAME=linux bash ./.github/travis_build.sh env C=gcc X=rebuild-stubs TRAVIS_OS_NAME=linux bash ./.github/travis_build.sh
if ! git diff --quiet; then git diff; exit 1; fi
- name: 'Rebuild and verify stubs v2'
run: |
export PATH="$(readlink -fn ../deps/bin-upx-20221212/.):$PATH"
make -C src/stub maintainer-clean extra-clean
git status || true
make -C src/stub extra-all all
if ! git diff --quiet; then git diff; exit 1; fi
- name: 'Check source code formatting' - name: 'Check source code formatting'
run: | run: |
bash ./misc/scripts/check_whitespace_git.sh bash ./misc/scripts/check_whitespace_git.sh
@ -100,7 +110,7 @@ jobs:
matrix: matrix:
include: include:
- { os: macos-11, gcc: gcc-10, gxx: 'g++-10' } - { os: macos-11, gcc: gcc-10, gxx: 'g++-10' }
# { os: macos-12, gcc: gcc-11, gxx: 'g++-11' } # disable gcc - XCode 14.0 ld bug # { os: macos-12, gcc: gcc-11, gxx: 'g++-11' } # disable gcc - XCode 14.0 ld bug; supposed to be fixed in 14.1
- { os: macos-12 } - { os: macos-12 }
steps: steps:
- name: 'Check out code' - name: 'Check out code'

6
.gitignore vendored
View File

@ -30,20 +30,14 @@ doc/*.ps
doc/*.tex doc/*.tex
src/stub/**/.*-stamp src/stub/**/.*-stamp
src/stub/**/MMakefile
src/stub/tmp*/*.bin src/stub/tmp*/*.bin
src/stub/tmp*/*.bin.bindump src/stub/tmp*/*.bin.bindump
src/stub/tmp*/*.bin.disasm src/stub/tmp*/*.bin.disasm
src/stub/tmp*/*.d
src/stub/tmp*/*.o
src/stub/tmp*/*.o.disasm src/stub/tmp*/*.o.disasm
src/stub/tmp*/mips.r3000-*.[is] src/stub/tmp*/mips.r3000-*.[is]
src/stub/tmp*/mipsel.r3000-*.[is] src/stub/tmp*/mipsel.r3000-*.[is]
src/stub/src/**/tmp*/* src/stub/src/**/tmp*/*
src/stub/tools/armpe/armpe_tester.exe
src/stub/tools/armpe/armpe_tester.out
src/stub/tools/sstrip/amd64-linux-sstrip src/stub/tools/sstrip/amd64-linux-sstrip
src/stub/tools/sstrip/i386-linux-sstrip src/stub/tools/sstrip/i386-linux-sstrip
src/stub/tools/sstrip/sstrip src/stub/tools/sstrip/sstrip

View File

@ -355,6 +355,15 @@ inline const T& UPX_MAX(const T& a, const T& b) { if (a < b) return b; return a;
template <class T> template <class T>
inline const T& UPX_MIN(const T& a, const T& b) { if (a < b) return a; return b; } inline const T& UPX_MIN(const T& a, const T& b) { if (a < b) return a; return b; }
template <size_t TypeSize>
struct USizeOfTypeImpl {
__acc_static_forceinline constexpr unsigned value() {
COMPILE_TIME_ASSERT(TypeSize >= 1 && TypeSize <= 64 * 1024); // arbitrary limit
return ACC_ICONV(unsigned, TypeSize);
}
};
#define usizeof(type) (USizeOfTypeImpl<sizeof(type)>::value())
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(int) == 4)
// An Array allocates memory on the heap, and automatically // An Array allocates memory on the heap, and automatically
// gets destructed when leaving scope or on exceptions. // gets destructed when leaving scope or on exceptions.

View File

@ -62,8 +62,6 @@ unsigned char PackLinuxElf::o_shstrtab[] = { \
/*offset 20*/ '.','s','h','s','t','r','t','a','b','\0' /*offset 20*/ '.','s','h','s','t','r','t','a','b','\0'
}; };
#define usizeof(x) ((unsigned) sizeof(x))
static unsigned static unsigned
umin(unsigned a, unsigned b) umin(unsigned a, unsigned b)
{ {
@ -5178,7 +5176,7 @@ void PackLinuxElf64::unpack(OutputFile *fo)
fi->seek(overlay_offset - sizeof(l_info), SEEK_SET); fi->seek(overlay_offset - sizeof(l_info), SEEK_SET);
fi->readx(&linfo, sizeof(linfo)); fi->readx(&linfo, sizeof(linfo));
if (UPX_MAGIC_LE32 != get_le32(&linfo.l_magic)) { if (UPX_MAGIC_LE32 != get_le32(&linfo.l_magic)) {
unsigned const *const lp = (unsigned const *)(void const *)&linfo; NE32 const *const lp = (NE32 const *)(void const *)&linfo;
// Workaround for bug of extra linfo by some asl_pack2_Shdrs(). // Workaround for bug of extra linfo by some asl_pack2_Shdrs().
if (0==lp[0] && 0==lp[1] && 0==lp[2]) { // looks like blank extra if (0==lp[0] && 0==lp[1] && 0==lp[2]) { // looks like blank extra
fi->readx(&linfo, sizeof(linfo)); fi->readx(&linfo, sizeof(linfo));

View File

@ -49,8 +49,6 @@
#define DT_STRSZ Elf32_Dyn::DT_STRSZ #define DT_STRSZ Elf32_Dyn::DT_STRSZ
#endif #endif
#define usizeof(x) ((unsigned) sizeof(x))
/************************************************************************* /*************************************************************************
// linux/386 (generic "execve" format) // linux/386 (generic "execve" format)

View File

@ -25,8 +25,9 @@
<markus@oberhumer.com> <ezerotven+github@gmail.com> <markus@oberhumer.com> <ezerotven+github@gmail.com>
*/ */
#ifndef __UPX_P_TMT_H #pragma once
#define __UPX_P_TMT_H 1 #ifndef UPX_P_TMT_H__
#define UPX_P_TMT_H__ 1
/************************************************************************* /*************************************************************************
// tmt/adam // tmt/adam

View File

@ -25,8 +25,9 @@
<markus@oberhumer.com> <ezerotven+github@gmail.com> <markus@oberhumer.com> <ezerotven+github@gmail.com>
*/ */
#ifndef __UPX_P_TOS_H #pragma once
#define __UPX_P_TOS_H 1 #ifndef UPX_P_TOS_H__
#define UPX_P_TOS_H__ 1
/************************************************************************* /*************************************************************************
// atari/tos // atari/tos