mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
merge
This commit is contained in:
commit
0dc03214c5
43
README.SRC
43
README.SRC
|
@ -75,7 +75,8 @@ Tools needed to build/modify the UPX sources
|
|||
To compile the packer sources
|
||||
-----------------------------
|
||||
|
||||
set the environment variable UPX_UCLDIR to point to your UCL installation, e.g.
|
||||
set the environment variable UPX_UCLDIR to point to your
|
||||
UCL installation, e.g.
|
||||
|
||||
set UPX_UCLDIR=c:\src\ucl-1.03 (DOS / Windows)
|
||||
export UPX_UCLDIR=$HOME/local/src/ucl-1.03 (Unix)
|
||||
|
@ -99,6 +100,15 @@ If you want to modify the stub sources you'll also need
|
|||
- ASM5900 - a MIPS R3000 assembler
|
||||
http://upx.sourceforge.net/download/tools/
|
||||
|
||||
- binutils-multiarch-2.17
|
||||
http://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2
|
||||
|
||||
You have to configure binutils with something like:
|
||||
--enable-64-bit-bfd --enable-targets=all --disable-nls \
|
||||
--disable-shared \
|
||||
--program-prefix=multiarch- --program-suffix=-2.17 \
|
||||
--prefix=/home/local/packages/binutils-multiarch-2.17-upx
|
||||
|
||||
- djasm - an assembler for the djgpp stub
|
||||
http://upx.sourceforge.net/download/tools/
|
||||
|
||||
|
@ -108,7 +118,6 @@ If you want to modify the stub sources you'll also need
|
|||
- Certain versions of some i386-linux tools:
|
||||
- gcc-2.95.3
|
||||
- gcc-3.4.6
|
||||
- binutils-2.16.1
|
||||
|
||||
- Other cross compilers targeted at the following architectures.
|
||||
- arm-9tdmi-linux-gnu
|
||||
|
@ -125,26 +134,32 @@ If you want to modify the stub sources you'll also need
|
|||
|
||||
bin-upx/a68k
|
||||
bin-upx/arm-9tdmi-linux-gnu-gcc-3.4.5
|
||||
bin-upx/arm-9tdmi-linux-gnu-ld
|
||||
bin-upx/arm-9tdmi-linux-gnu-objcopy
|
||||
bin-upx/arm-9tdmi-linux-gnu-objdump
|
||||
bin-upx/asm5900
|
||||
bin-upx/djasm
|
||||
bin-upx/i386-linux-gcc-2.95.3
|
||||
bin-upx/i386-linux-gcc-3.4.6
|
||||
bin-upx/i386-linux-ld-2.16.1
|
||||
bin-upx/i386-linux-objcopy-2.16.1
|
||||
bin-upx/i386-linux-objdump
|
||||
bin-upx/multiarch-addr2line-2.17
|
||||
bin-upx/multiarch-ar-2.17
|
||||
bin-upx/multiarch-as-2.17
|
||||
bin-upx/multiarch-c++filt-2.17
|
||||
bin-upx/multiarch-coffdump-2.17
|
||||
bin-upx/multiarch-gprof-2.17
|
||||
bin-upx/multiarch-ld-2.17
|
||||
bin-upx/multiarch-nlmconv-2.17
|
||||
bin-upx/multiarch-nm-2.17
|
||||
bin-upx/multiarch-objcopy-2.17
|
||||
bin-upx/multiarch-objdump-2.17
|
||||
bin-upx/multiarch-ranlib-2.17
|
||||
bin-upx/multiarch-readelf-2.17
|
||||
bin-upx/multiarch-size-2.17
|
||||
bin-upx/multiarch-srconv-2.17
|
||||
bin-upx/multiarch-strings-2.17
|
||||
bin-upx/multiarch-strip-2.17
|
||||
bin-upx/multiarch-sysdump-2.17
|
||||
bin-upx/nasm
|
||||
bin-upx/powerpc-750-linux-gnu-gcc-3.4.4
|
||||
bin-upx/powerpc-750-linux-gnu-ld
|
||||
bin-upx/powerpc-750-linux-gnu-objcopy
|
||||
bin-upx/powerpc-750-linux-gnu-objdump
|
||||
bin-upx/sstrip [ from src/stub/util ]
|
||||
bin-upx/x86_64-unknown-linux-gnu-gcc-3.4.4
|
||||
bin-upx/x86_64-unknown-linux-gnu-ld
|
||||
bin-upx/x86_64-unknown-linux-gnu-objcopy
|
||||
bin-upx/x86_64-unknown-linux-gnu-objdump
|
||||
|
||||
|
||||
Misc. notes
|
||||
|
|
|
@ -76,11 +76,11 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
|
|||
upx_bytep dst, unsigned* dst_len,
|
||||
upx_callback_p cb,
|
||||
int method, int level,
|
||||
const struct upx_compress_config_t *conf,
|
||||
struct upx_compress_result_t *result )
|
||||
const upx_compress_config_t *cconf,
|
||||
upx_compress_result_t *cresult )
|
||||
{
|
||||
int r = UPX_E_ERROR;
|
||||
upx_compress_result_t result_buffer;
|
||||
upx_compress_result_t cresult_buffer;
|
||||
|
||||
assert(method > 0); assert(level > 0);
|
||||
|
||||
|
@ -95,43 +95,33 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
|
|||
// for UPX, we always require a reasonably sized outbut buffer
|
||||
assert(*dst_len >= MemBuffer::getSizeForCompression(src_len));
|
||||
|
||||
if (!result)
|
||||
result = &result_buffer;
|
||||
memset(result, 0, sizeof(*result));
|
||||
if (!cresult)
|
||||
cresult = &cresult_buffer;
|
||||
memset(cresult, 0, sizeof(*cresult));
|
||||
#if 1
|
||||
// debug
|
||||
result->method = method;
|
||||
result->level = level;
|
||||
result->u_len = src_len;
|
||||
result->c_len = 0;
|
||||
cresult->method = method;
|
||||
cresult->level = level;
|
||||
cresult->u_len = src_len;
|
||||
cresult->c_len = 0;
|
||||
#endif
|
||||
// assume no info available - fill in worst case results
|
||||
ucl_uint *res = result->result_ucl.result;
|
||||
//res[0] = 1; // min_offset_found - NOT USED
|
||||
res[1] = src_len - 1; // max_offset_found
|
||||
//res[2] = 2; // min_match_found - NOT USED
|
||||
res[3] = src_len - 1; // max_match_found
|
||||
//res[4] = 1; // min_run_found - NOT USED
|
||||
res[5] = src_len; // max_run_found
|
||||
res[6] = 1; // first_offset_found
|
||||
//res[7] = 999999; // same_match_offsets_found - NOT USED
|
||||
|
||||
if (method < 0) {
|
||||
}
|
||||
#if defined(WITH_LZMA)
|
||||
else if (M_IS_LZMA(method))
|
||||
r = upx_lzma_compress(src, src_len, dst, dst_len,
|
||||
cb, method, level, conf, result);
|
||||
cb, method, level, cconf, cresult);
|
||||
#endif
|
||||
#if defined(WITH_NRV)
|
||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||
r = upx_nrv_compress(src, src_len, dst, dst_len,
|
||||
cb, method, level, conf, result);
|
||||
cb, method, level, cconf, cresult);
|
||||
#endif
|
||||
#if defined(WITH_UCL)
|
||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||
r = upx_ucl_compress(src, src_len, dst, dst_len,
|
||||
cb, method, level, conf, result);
|
||||
cb, method, level, cconf, cresult);
|
||||
#endif
|
||||
else {
|
||||
throwInternalError("unknown compression method");
|
||||
|
@ -139,7 +129,7 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
|
|||
|
||||
#if 1
|
||||
// debug
|
||||
result->c_len = *dst_len;
|
||||
cresult->c_len = *dst_len;
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
@ -152,29 +142,29 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
|
|||
int upx_decompress ( const upx_bytep src, unsigned src_len,
|
||||
upx_bytep dst, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result )
|
||||
const upx_compress_result_t *cresult )
|
||||
{
|
||||
int r = UPX_E_ERROR;
|
||||
|
||||
assert(*dst_len > 0);
|
||||
assert(src_len < *dst_len); // must be compressed
|
||||
|
||||
if (result && result->method == 0)
|
||||
result = NULL;
|
||||
if (cresult && cresult->method == 0)
|
||||
cresult = NULL;
|
||||
|
||||
if (method < 0) {
|
||||
}
|
||||
#if defined(WITH_LZMA)
|
||||
else if (M_IS_LZMA(method))
|
||||
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, result);
|
||||
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||
#endif
|
||||
#if defined(WITH_NRV)
|
||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, result);
|
||||
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||
#endif
|
||||
#if defined(WITH_UCL)
|
||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||
r = upx_ucl_decompress(src, src_len, dst, dst_len, method, result);
|
||||
r = upx_ucl_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||
#endif
|
||||
else {
|
||||
throwInternalError("unknown decompression method");
|
||||
|
@ -191,12 +181,12 @@ int upx_decompress ( const upx_bytep src, unsigned src_len,
|
|||
int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||
unsigned src_len, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result )
|
||||
const upx_compress_result_t *cresult )
|
||||
{
|
||||
int r = UPX_E_ERROR;
|
||||
|
||||
if (result && result->method == 0)
|
||||
result = NULL;
|
||||
if (cresult && cresult->method == 0)
|
||||
cresult = NULL;
|
||||
|
||||
assert(*dst_len > 0);
|
||||
assert(src_len < *dst_len); // must be compressed
|
||||
|
@ -207,15 +197,15 @@ int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
|
|||
}
|
||||
#if defined(WITH_LZMA)
|
||||
else if (M_IS_LZMA(method))
|
||||
r = upx_lzma_test_overlap(buf, src_off, src_len, dst_len, method, result);
|
||||
r = upx_lzma_test_overlap(buf, src_off, src_len, dst_len, method, cresult);
|
||||
#endif
|
||||
#if defined(WITH_NRV)
|
||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||
r = upx_nrv_test_overlap(buf, src_off, src_len, dst_len, method, result);
|
||||
r = upx_nrv_test_overlap(buf, src_off, src_len, dst_len, method, cresult);
|
||||
#endif
|
||||
#if defined(WITH_UCL)
|
||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||
r = upx_ucl_test_overlap(buf, src_off, src_len, dst_len, method, result);
|
||||
r = upx_ucl_test_overlap(buf, src_off, src_len, dst_len, method, cresult);
|
||||
#endif
|
||||
else {
|
||||
throwInternalError("unknown decompression method");
|
||||
|
|
|
@ -39,16 +39,16 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||
upx_bytep dst, unsigned* dst_len,
|
||||
upx_callback_p cb,
|
||||
int method, int level,
|
||||
const struct upx_compress_config_t *conf,
|
||||
struct upx_compress_result_t *result );
|
||||
const upx_compress_config_t *cconf,
|
||||
upx_compress_result_t *cresult );
|
||||
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||
upx_bytep dst, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result );
|
||||
const upx_compress_result_t *cresult );
|
||||
int upx_lzma_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||
unsigned src_len, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result );
|
||||
const upx_compress_result_t *cresult );
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -57,16 +57,16 @@ int upx_nrv_compress ( const upx_bytep src, unsigned src_len,
|
|||
upx_bytep dst, unsigned* dst_len,
|
||||
upx_callback_p cb,
|
||||
int method, int level,
|
||||
const struct upx_compress_config_t *conf,
|
||||
struct upx_compress_result_t *result );
|
||||
const upx_compress_config_t *cconf,
|
||||
upx_compress_result_t *cresult );
|
||||
int upx_nrv_decompress ( const upx_bytep src, unsigned src_len,
|
||||
upx_bytep dst, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result );
|
||||
const upx_compress_result_t *cresult );
|
||||
int upx_nrv_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||
unsigned src_len, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result );
|
||||
const upx_compress_result_t *cresult );
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -75,16 +75,16 @@ int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
|||
upx_bytep dst, unsigned* dst_len,
|
||||
upx_callback_p cb,
|
||||
int method, int level,
|
||||
const struct upx_compress_config_t *conf,
|
||||
struct upx_compress_result_t *result );
|
||||
const upx_compress_config_t *cconf,
|
||||
upx_compress_result_t *cresult );
|
||||
int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
|
||||
upx_bytep dst, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result );
|
||||
const upx_compress_result_t *cresult );
|
||||
int upx_ucl_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||
unsigned src_len, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result );
|
||||
const upx_compress_result_t *cresult );
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -155,16 +155,15 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||
upx_bytep dst, unsigned* dst_len,
|
||||
upx_callback_p cb,
|
||||
int method, int level,
|
||||
const struct upx_compress_config_t *conf_parm,
|
||||
struct upx_compress_result_t *result )
|
||||
const upx_compress_config_t *cconf_parm,
|
||||
upx_compress_result_t *cresult )
|
||||
{
|
||||
assert(method == M_LZMA);
|
||||
assert(level > 0); assert(result != NULL);
|
||||
UNUSED(conf_parm);
|
||||
assert(level > 0); assert(cresult != NULL);
|
||||
|
||||
int r = UPX_E_ERROR;
|
||||
HRESULT rh;
|
||||
lzma_compress_result_t *res = &result->result_lzma;
|
||||
lzma_compress_result_t *res = &cresult->result_lzma;
|
||||
|
||||
MyLzma::InStreamRam is; is.AddRef();
|
||||
MyLzma::OutStreamRam os; os.AddRef();
|
||||
|
@ -189,13 +188,20 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||
pr[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
|
||||
|
||||
// setup defaults
|
||||
pr[0].uintVal = 2;
|
||||
pr[1].uintVal = 0;
|
||||
pr[2].uintVal = 3;
|
||||
pr[0].uintVal = 2; // 0..4
|
||||
pr[1].uintVal = 0; // 0..4
|
||||
pr[2].uintVal = 3; // 0..8
|
||||
pr[3].uintVal = 1024 * 1024;
|
||||
pr[4].uintVal = 2;
|
||||
pr[5].uintVal = 64;
|
||||
pr[5].uintVal = 64; // 5..
|
||||
pr[6].uintVal = 0;
|
||||
#if 0
|
||||
// DEBUG - set sizes so that we use a maxmimum amount of stack.
|
||||
// These settings cause res->num_probs == 3147574, i.e. we will
|
||||
// need about 6 MB of stack during runtime decompression.
|
||||
pr[1].uintVal = 4;
|
||||
pr[2].uintVal = 8;
|
||||
#endif
|
||||
|
||||
// FIXME: tune these settings according to level
|
||||
switch (level)
|
||||
|
@ -228,9 +234,33 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||
goto error;
|
||||
}
|
||||
|
||||
// limit dictionary size
|
||||
if (pr[3].uintVal > src_len)
|
||||
pr[3].uintVal = src_len;
|
||||
|
||||
// limit num_probs
|
||||
if (cconf_parm && cconf_parm->conf_lzma.max_num_probs)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
unsigned n = 1846 + (768 << (pr[2].uintVal + pr[1].uintVal));
|
||||
if (n <= cconf_parm->conf_lzma.max_num_probs)
|
||||
break;
|
||||
if (pr[1].uintVal > pr[2].uintVal)
|
||||
{
|
||||
if (pr[1].uintVal == 0)
|
||||
goto error;
|
||||
pr[1].uintVal -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pr[2].uintVal == 0)
|
||||
goto error;
|
||||
pr[2].uintVal -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res->pos_bits = pr[0].uintVal;
|
||||
res->lit_pos_bits = pr[1].uintVal;
|
||||
res->lit_context_bits = pr[2].uintVal;
|
||||
|
@ -320,7 +350,7 @@ error:
|
|||
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||
upx_bytep dst, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result )
|
||||
const upx_compress_result_t *cresult )
|
||||
{
|
||||
assert(method == M_LZMA);
|
||||
// see res->num_probs above
|
||||
|
@ -354,13 +384,13 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
|||
src += 2; src_len -= 2;
|
||||
#endif
|
||||
|
||||
if (result)
|
||||
if (cresult)
|
||||
{
|
||||
assert(result->method == method);
|
||||
assert(result->result_lzma.pos_bits == (unsigned) s.Properties.pb);
|
||||
assert(result->result_lzma.lit_pos_bits == (unsigned) s.Properties.lp);
|
||||
assert(result->result_lzma.lit_context_bits == (unsigned) s.Properties.lc);
|
||||
assert(result->result_lzma.num_probs == (unsigned) LzmaGetNumProbs(&s.Properties));
|
||||
assert(cresult->method == method);
|
||||
assert(cresult->result_lzma.pos_bits == (unsigned) s.Properties.pb);
|
||||
assert(cresult->result_lzma.lit_pos_bits == (unsigned) s.Properties.lp);
|
||||
assert(cresult->result_lzma.lit_context_bits == (unsigned) s.Properties.lc);
|
||||
assert(cresult->result_lzma.num_probs == (unsigned) LzmaGetNumProbs(&s.Properties));
|
||||
}
|
||||
s.Probs = (CProb *) malloc(sizeof(CProb) * LzmaGetNumProbs(&s.Properties));
|
||||
if (!s.Probs)
|
||||
|
@ -382,7 +412,7 @@ error:
|
|||
*dst_len = dst_out;
|
||||
free(s.Probs);
|
||||
|
||||
UNUSED(result);
|
||||
UNUSED(cresult);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -394,7 +424,7 @@ error:
|
|||
int upx_lzma_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||
unsigned src_len, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result )
|
||||
const upx_compress_result_t *cresult )
|
||||
{
|
||||
assert(method == M_LZMA);
|
||||
|
||||
|
@ -408,7 +438,7 @@ int upx_lzma_test_overlap ( const upx_bytep buf, unsigned src_off,
|
|||
if ((int)overlap_overhead >= 256)
|
||||
return UPX_E_OK;
|
||||
|
||||
UNUSED(result);
|
||||
UNUSED(cresult);
|
||||
return UPX_E_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,11 +101,11 @@ int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
|||
upx_bytep dst, unsigned* dst_len,
|
||||
upx_callback_p cb_parm,
|
||||
int method, int level,
|
||||
const struct upx_compress_config_t *conf_parm,
|
||||
struct upx_compress_result_t *result )
|
||||
const upx_compress_config_t *cconf_parm,
|
||||
upx_compress_result_t *cresult )
|
||||
{
|
||||
int r;
|
||||
assert(level > 0); assert(result != NULL);
|
||||
assert(level > 0); assert(cresult != NULL);
|
||||
|
||||
ucl_progress_callback_t cb;
|
||||
cb.callback = 0;
|
||||
|
@ -115,20 +115,29 @@ int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
|||
cb.user = cb_parm;
|
||||
}
|
||||
|
||||
ucl_compress_config_t conf;
|
||||
memset(&conf, 0xff, sizeof(conf));
|
||||
if (conf_parm)
|
||||
conf = conf_parm->conf_ucl; // struct copy
|
||||
ucl_compress_config_t cconf;
|
||||
memset(&cconf, 0xff, sizeof(cconf));
|
||||
if (cconf_parm)
|
||||
cconf = cconf_parm->conf_ucl; // struct copy
|
||||
|
||||
ucl_uint *res = result->result_ucl.result;
|
||||
ucl_uint *res = cresult->result_ucl.result;
|
||||
// assume no info available - fill in worst case results
|
||||
//res[0] = 1; // min_offset_found - NOT USED
|
||||
res[1] = src_len - 1; // max_offset_found
|
||||
//res[2] = 2; // min_match_found - NOT USED
|
||||
res[3] = src_len - 1; // max_match_found
|
||||
//res[4] = 1; // min_run_found - NOT USED
|
||||
res[5] = src_len; // max_run_found
|
||||
res[6] = 1; // first_offset_found
|
||||
//res[7] = 999999; // same_match_offsets_found - NOT USED
|
||||
|
||||
// prepare bit-buffer settings
|
||||
conf.bb_endian = 0;
|
||||
conf.bb_size = 0;
|
||||
cconf.bb_endian = 0;
|
||||
cconf.bb_size = 0;
|
||||
if (method >= M_NRV2B_LE32 && method <= M_CL1B_LE16)
|
||||
{
|
||||
static const unsigned char sizes[3]={32,8,16};
|
||||
conf.bb_size = sizes[(method - M_NRV2B_LE32) % 3];
|
||||
static const unsigned char sizes[3] = {32, 8, 16};
|
||||
cconf.bb_size = sizes[(method - M_NRV2B_LE32) % 3];
|
||||
}
|
||||
else {
|
||||
throwInternalError("unknown compression method");
|
||||
|
@ -136,20 +145,20 @@ int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
|||
}
|
||||
|
||||
// optimize compression parms
|
||||
if (level <= 3 && conf.max_offset == UCL_UINT_MAX)
|
||||
conf.max_offset = 8*1024-1;
|
||||
else if (level == 4 && conf.max_offset == UCL_UINT_MAX)
|
||||
conf.max_offset = 32*1024-1;
|
||||
if (level <= 3 && cconf.max_offset == UCL_UINT_MAX)
|
||||
cconf.max_offset = 8*1024-1;
|
||||
else if (level == 4 && cconf.max_offset == UCL_UINT_MAX)
|
||||
cconf.max_offset = 32*1024-1;
|
||||
|
||||
if M_IS_NRV2B(method)
|
||||
r = ucl_nrv2b_99_compress(src, src_len, dst, dst_len,
|
||||
&cb, level, &conf, res);
|
||||
&cb, level, &cconf, res);
|
||||
else if M_IS_NRV2D(method)
|
||||
r = ucl_nrv2d_99_compress(src, src_len, dst, dst_len,
|
||||
&cb, level, &conf, res);
|
||||
&cb, level, &cconf, res);
|
||||
else if M_IS_NRV2E(method)
|
||||
r = ucl_nrv2e_99_compress(src, src_len, dst, dst_len,
|
||||
&cb, level, &conf, res);
|
||||
&cb, level, &cconf, res);
|
||||
else {
|
||||
throwInternalError("unknown compression method");
|
||||
return UPX_E_ERROR;
|
||||
|
@ -166,7 +175,7 @@ int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
|||
int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
|
||||
upx_bytep dst, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result )
|
||||
const upx_compress_result_t *cresult )
|
||||
{
|
||||
int r;
|
||||
|
||||
|
@ -204,7 +213,7 @@ int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
|
|||
return UPX_E_ERROR;
|
||||
}
|
||||
|
||||
UNUSED(result);
|
||||
UNUSED(cresult);
|
||||
return convert_errno_from_ucl(r);
|
||||
}
|
||||
|
||||
|
@ -216,7 +225,7 @@ int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
|
|||
int upx_ucl_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||
unsigned src_len, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result )
|
||||
const upx_compress_result_t *cresult )
|
||||
{
|
||||
int r;
|
||||
|
||||
|
@ -254,7 +263,7 @@ int upx_ucl_test_overlap ( const upx_bytep buf, unsigned src_off,
|
|||
return UPX_E_ERROR;
|
||||
}
|
||||
|
||||
UNUSED(result);
|
||||
UNUSED(cresult);
|
||||
return convert_errno_from_ucl(r);
|
||||
}
|
||||
|
||||
|
|
15
src/conf.h
15
src/conf.h
|
@ -199,25 +199,28 @@ typedef void (__acc_cdecl *upx_progress_func_t)
|
|||
|
||||
struct upx_callback_t
|
||||
{
|
||||
#if 0
|
||||
upx_alloc_func_t nalloc;
|
||||
upx_free_func_t nfree;
|
||||
#endif
|
||||
upx_progress_func_t nprogress;
|
||||
void * user1;
|
||||
#if 0
|
||||
unsigned user2;
|
||||
unsigned user3;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
struct lzma_compress_config_t
|
||||
{
|
||||
unsigned max_num_probs;
|
||||
#if 0
|
||||
unsigned pos_bits; // pb
|
||||
unsigned lit_pos_bits; // lp
|
||||
unsigned lit_context_bits; // lc
|
||||
unsigned dict_size;
|
||||
unsigned mf_passes;
|
||||
#else
|
||||
int dummy;
|
||||
#endif
|
||||
void reset() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
@ -634,16 +637,16 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
|
|||
upx_bytep dst, unsigned* dst_len,
|
||||
upx_callback_p cb,
|
||||
int method, int level,
|
||||
const struct upx_compress_config_t *conf,
|
||||
struct upx_compress_result_t *result );
|
||||
const upx_compress_config_t *cconf,
|
||||
upx_compress_result_t *cresult );
|
||||
int upx_decompress ( const upx_bytep src, unsigned src_len,
|
||||
upx_bytep dst, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result );
|
||||
const upx_compress_result_t *cresult );
|
||||
int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||
unsigned src_len, unsigned* dst_len,
|
||||
int method,
|
||||
const struct upx_compress_result_t *result );
|
||||
const upx_compress_result_t *cresult );
|
||||
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -86,6 +86,13 @@ struct options_t {
|
|||
// compression runtime parameters - see struct ucl_compress_config_t
|
||||
struct crp_lzma_t {
|
||||
int dummy;
|
||||
#if 0
|
||||
unsigned pos_bits; // pb
|
||||
unsigned lit_pos_bits; // lp
|
||||
unsigned lit_context_bits; // lc
|
||||
unsigned dict_size;
|
||||
unsigned mf_passes;
|
||||
#endif
|
||||
void reset() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
struct crp_ucl_t {
|
||||
|
|
|
@ -1904,7 +1904,7 @@ void PackArmPe::pack(OutputFile *fo)
|
|||
}
|
||||
|
||||
compressWithFilters(&ft, 2048, strategy,
|
||||
NULL, 0, 0, ih.codebase, rvamin);
|
||||
NULL, NULL, ih.codebase, rvamin);
|
||||
// info: see buildLoader()
|
||||
newvsize = (ph.u_len + rvamin + ph.overlap_overhead + oam1) &~ oam1;
|
||||
if (tlsindex && ((newvsize - ph.c_len - 1024 + oam1) &~ oam1) > tlsindex + 4)
|
||||
|
|
|
@ -293,7 +293,12 @@ void PackDjgpp2::pack(OutputFile *fo)
|
|||
ft.buf_len = usize - data->size;
|
||||
ft.addvalue = text->vaddr - hdrsize;
|
||||
// compress
|
||||
compressWithFilters(&ft, 512);
|
||||
upx_compress_config_t cconf; cconf.reset();
|
||||
#if 1
|
||||
// limit stack size needed for runtime decompression
|
||||
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ~28 kB stack
|
||||
#endif
|
||||
compressWithFilters(&ft, 512, 0, NULL, &cconf);
|
||||
|
||||
// patch coff header #2
|
||||
const unsigned lsize = getLoaderSize();
|
||||
|
|
|
@ -413,8 +413,10 @@ void PackExe::pack(OutputFile *fo)
|
|||
ph.u_len = ih_imagesize + relocsize;
|
||||
// prepare filter
|
||||
Filter ft(ph.level);
|
||||
// compress
|
||||
compressWithFilters(&ft, 32, 0, NULL, 0, MAXMATCH);
|
||||
// compress (max_match = 8192)
|
||||
upx_compress_config_t cconf; cconf.reset();
|
||||
cconf.conf_ucl.max_match = MAXMATCH;
|
||||
compressWithFilters(&ft, 32, 0, NULL, &cconf);
|
||||
if (ph.max_run_found + ph.max_match_found > 0x8000)
|
||||
throwCantPack("decompressor limit exceeded, send a bugreport");
|
||||
|
||||
|
|
|
@ -302,7 +302,9 @@ void PackPs1::pack(OutputFile *fo)
|
|||
Filter ft(ph.level);
|
||||
|
||||
// compress (max_match = 65535)
|
||||
compressWithFilters(&ft, 512, 0, NULL, 0, 65535);
|
||||
upx_compress_config_t cconf; cconf.reset();
|
||||
cconf.conf_ucl.max_match = 65535;
|
||||
compressWithFilters(&ft, 512, 0, NULL, &cconf);
|
||||
|
||||
if (ph.overlap_overhead > sa_cnt)
|
||||
{
|
||||
|
|
|
@ -489,7 +489,9 @@ void PackTos::pack(OutputFile *fo)
|
|||
// prepare filter
|
||||
Filter ft(ph.level);
|
||||
// compress (max_match = 65535)
|
||||
compressWithFilters(&ft, 512, 0, NULL, 0, 65535);
|
||||
upx_compress_config_t cconf; cconf.reset();
|
||||
cconf.conf_ucl.max_match = 65535;
|
||||
compressWithFilters(&ft, 512, 0, NULL, &cconf);
|
||||
|
||||
// get loader
|
||||
const unsigned lsize = getLoaderSize();
|
||||
|
|
|
@ -348,7 +348,7 @@ void PackUnix::packExtent(
|
|||
ft->cto = 0;
|
||||
|
||||
compressWithFilters(ft, OVERHEAD, strategy,
|
||||
NULL, 0, 0, 0, 0, // those 5 args are the defaults
|
||||
NULL, NULL, 0, 0, // those 4 args are the defaults
|
||||
hdr_ibuf, hdr_u_len);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -220,7 +220,12 @@ void PackVmlinuxI386::pack(OutputFile *fo)
|
|||
ft.buf_len = ph.u_len;
|
||||
ft.addvalue = 0; // we are independent of actual runtime address; see ckt32
|
||||
|
||||
compressWithFilters(&ft, 1 << 20);
|
||||
upx_compress_config_t cconf; cconf.reset();
|
||||
#if 1 //{
|
||||
// limit stack size needed for runtime decompression
|
||||
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
|
||||
#endif //}
|
||||
compressWithFilters(&ft, 512, 0, NULL, &cconf);
|
||||
|
||||
const unsigned lsize = getLoaderSize();
|
||||
MemBuffer loader(lsize);
|
||||
|
@ -480,46 +485,47 @@ void PackVmlinuxI386::unpack(OutputFile *fo)
|
|||
//LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
|
||||
//
|
||||
//$(obj)/vmlinux: $(obj)/upx-head.o $(obj)/upx-piggy.o FORCE
|
||||
// $(call if_changed,ld)
|
||||
// @:
|
||||
// $(call if_changed,ld)
|
||||
// @:
|
||||
//
|
||||
//$(obj)/upx-piggy.o: vmlinux FORCE
|
||||
// rm -f $@
|
||||
// upx --best -o $@ $<
|
||||
// rm -f $@
|
||||
// upx --best -o $@ $<
|
||||
// touch $@
|
||||
//-----
|
||||
//
|
||||
//----- arch/i386/boot/compressed/upx-head.S
|
||||
// .text
|
||||
// .text
|
||||
//startup_32: .globl startup_32 # In: %esi=0x90000 setup data "real_mode pointer"
|
||||
// #cli # this must be true already
|
||||
// #cli # this must be true already
|
||||
//
|
||||
// /* The only facts about segments here, that are true for all kernels:
|
||||
// * %cs is a valid "flat" code segment; no other segment reg is valid;
|
||||
// * the next segment after %cs is a valid "flat" data segment, but
|
||||
// * no segment register designates it yet.
|
||||
// */
|
||||
// movl %cs,%eax; addl $1<<3,%eax # the next segment after %cs
|
||||
// movl %eax,%ds
|
||||
// movl %eax,%es
|
||||
// leal 0x9000(%esi),%ecx # 0x99000 typical
|
||||
// movl %ecx,-8(%ecx) # 32-bit offset for stack pointer
|
||||
// movl %eax,-4(%ecx) # segment for stack pointer
|
||||
// lss -8(%ecx),%esp # %ss:%esp= %ds:0x99000
|
||||
// /* Linux Documentation/i386/boot.txt "SAMPLE BOOT CONFIGURATION" says
|
||||
// 0x8000-0x8FFF Stack and heap [inside the "real mode segment",
|
||||
// just below the command line at offset 0x9000].
|
||||
// /* The only facts about segments here, that are true for all kernels:
|
||||
// * %cs is a valid "flat" code segment; no other segment reg is valid;
|
||||
// * the next segment after %cs is a valid "flat" data segment, but
|
||||
// * no segment register designates it yet.
|
||||
// */
|
||||
// movl %cs,%eax; addl $1<<3,%eax # the next segment after %cs
|
||||
// movl %eax,%ds
|
||||
// movl %eax,%es
|
||||
// leal 0x9000(%esi),%ecx # 0x99000 typical
|
||||
// movl %ecx,-8(%ecx) # 32-bit offset for stack pointer
|
||||
// movl %eax,-4(%ecx) # segment for stack pointer
|
||||
// lss -8(%ecx),%esp # %ss:%esp= %ds:0x99000
|
||||
// /* Linux Documentation/i386/boot.txt "SAMPLE BOOT CONFIGURATION" says
|
||||
// 0x8000-0x8FFF Stack and heap [inside the "real mode segment",
|
||||
// just below the command line at offset 0x9000].
|
||||
//
|
||||
// arch/i386/boot/compressed/head.S "Do the decompression ..." says
|
||||
// %esi contains the "real mode pointer" [as a 32-bit addr].
|
||||
// arch/i386/boot/compressed/head.S "Do the decompression ..." says
|
||||
// %esi contains the "real mode pointer" [as a 32-bit addr].
|
||||
//
|
||||
// In any case, avoid EBDA (Extended BIOS Data Area) below 0xA0000.
|
||||
// boot.txt says 0x9A000 is the limit. LILO goes up to 0x9B000.
|
||||
// */
|
||||
// In any case, avoid EBDA (Extended BIOS Data Area) below 0xA0000.
|
||||
// boot.txt says 0x9A000 is the limit. LILO goes up to 0x9B000.
|
||||
// */
|
||||
//
|
||||
// pushl $0; popf # subsumes "cli; cld"; also clears NT for buggy BIOS
|
||||
// pushl $0; popf # subsumes "cli; cld"; also clears NT for buggy BIOS
|
||||
//
|
||||
// movl $ 0x100000,%eax # destination of uncompression (and entry point)
|
||||
// push %cs
|
||||
// movl $ 0x100000,%eax # destination of uncompression (and entry point)
|
||||
// push %cs
|
||||
/* Fall into .text of upx-compressed vmlinux. */
|
||||
//-----
|
||||
|
||||
|
@ -560,6 +566,7 @@ void PackVmlinuxI386::unpack(OutputFile *fo)
|
|||
//upx-piggy.o: $(SYSTEM)
|
||||
// $(RM) -f $@
|
||||
// upx --best -o $@ $<
|
||||
// touch $@
|
||||
//
|
||||
//clean:
|
||||
// rm -f vmlinux bvmlinux _tmp_*
|
||||
|
|
|
@ -60,12 +60,12 @@ protected:
|
|||
|
||||
int n_ptload;
|
||||
unsigned sz_ptload;
|
||||
Elf32_Phdr *phdri; // from input file
|
||||
Elf32_Shdr *shdri; // from input file
|
||||
Elf32_Shdr *p_text;
|
||||
Elf32_Shdr *p_note0;
|
||||
Elf32_Shdr *p_note1;
|
||||
Elf32_Ehdr ehdri; // from input file
|
||||
Elf_LE32_Phdr *phdri; // from input file
|
||||
Elf_LE32_Shdr *shdri; // from input file
|
||||
Elf_LE32_Shdr *p_text;
|
||||
Elf_LE32_Shdr *p_note0;
|
||||
Elf_LE32_Shdr *p_note1;
|
||||
Elf_LE32_Ehdr ehdri; // from input file
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -276,8 +276,14 @@ void PackVmlinuzI386::pack(OutputFile *fo)
|
|||
Filter ft(ph.level);
|
||||
ft.buf_len = ph.u_len;
|
||||
ft.addvalue = kernel_entry; // saves 4 bytes in unfilter code
|
||||
|
||||
// compress
|
||||
compressWithFilters(&ft, 1 << 20);
|
||||
upx_compress_config_t cconf; cconf.reset();
|
||||
#if 1 //{
|
||||
// limit stack size needed for runtime decompression
|
||||
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
|
||||
#endif //}
|
||||
compressWithFilters(&ft, 512, 0, NULL, &cconf);
|
||||
|
||||
const unsigned lsize = getLoaderSize();
|
||||
MemBuffer loader(lsize);
|
||||
|
@ -352,8 +358,13 @@ void PackBvmlinuzI386::pack(OutputFile *fo)
|
|||
Filter ft(ph.level);
|
||||
ft.buf_len = ph.u_len;
|
||||
ft.addvalue = kernel_entry; // saves 4 bytes in unfilter code
|
||||
// compress
|
||||
compressWithFilters(&ft, 512);
|
||||
|
||||
upx_compress_config_t cconf; cconf.reset();
|
||||
#if 1 //{
|
||||
// limit stack size needed for runtime decompression
|
||||
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
|
||||
#endif //}
|
||||
compressWithFilters(&ft, 512, 0, NULL, &cconf);
|
||||
|
||||
// align everything to dword boundary - it is easier to handle
|
||||
unsigned c_len = ph.c_len;
|
||||
|
|
|
@ -1924,7 +1924,7 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||
}
|
||||
|
||||
compressWithFilters(&ft, 2048, strategy,
|
||||
NULL, 0, 0, ih.codebase, rvamin);
|
||||
NULL, NULL, ih.codebase, rvamin);
|
||||
// info: see buildLoader()
|
||||
newvsize = (ph.u_len + rvamin + ph.overlap_overhead + oam1) &~ oam1;
|
||||
if (tlsindex && ((newvsize - ph.c_len - 1024 + oam1) &~ oam1) > tlsindex + 4)
|
||||
|
|
|
@ -154,15 +154,18 @@ bool Packer::skipVerify() const
|
|||
|
||||
|
||||
/*************************************************************************
|
||||
// compress
|
||||
// compress - wrap call to low-level upx_compress()
|
||||
**************************************************************************/
|
||||
|
||||
bool Packer::compress(upx_bytep in, upx_bytep out,
|
||||
unsigned max_offset, unsigned max_match)
|
||||
const upx_compress_config_t *cconf_parm)
|
||||
{
|
||||
ph.c_len = 0;
|
||||
assert(ph.level >= 1); assert(ph.level <= 10);
|
||||
|
||||
// Avoid too many progress bar updates. 64 is s->bar_len in ui.cpp.
|
||||
unsigned step = (ph.u_len < 64*1024) ? 0 : ph.u_len / 64;
|
||||
|
||||
// save current checksums
|
||||
ph.saved_u_adler = ph.u_adler;
|
||||
ph.saved_c_adler = ph.c_adler;
|
||||
|
@ -170,31 +173,27 @@ bool Packer::compress(upx_bytep in, upx_bytep out,
|
|||
ph.u_adler = upx_adler32(in, ph.u_len, ph.u_adler);
|
||||
|
||||
// set compression paramters
|
||||
upx_compress_config_t conf;
|
||||
conf.reset();
|
||||
// arguments
|
||||
if (max_offset != 0)
|
||||
conf.conf_ucl.max_offset = max_offset;
|
||||
if (max_match != 0)
|
||||
conf.conf_ucl.max_match = max_match;
|
||||
// options
|
||||
if (opt->crp.crp_ucl.c_flags != -1)
|
||||
conf.conf_ucl.c_flags = opt->crp.crp_ucl.c_flags;
|
||||
if (opt->crp.crp_ucl.p_level != -1)
|
||||
conf.conf_ucl.p_level = opt->crp.crp_ucl.p_level;
|
||||
if (opt->crp.crp_ucl.h_level != -1)
|
||||
conf.conf_ucl.h_level = opt->crp.crp_ucl.h_level;
|
||||
if (opt->crp.crp_ucl.max_offset != UINT_MAX && opt->crp.crp_ucl.max_offset < conf.conf_ucl.max_offset)
|
||||
conf.conf_ucl.max_offset = opt->crp.crp_ucl.max_offset;
|
||||
if (opt->crp.crp_ucl.max_match != UINT_MAX && opt->crp.crp_ucl.max_match < conf.conf_ucl.max_match)
|
||||
conf.conf_ucl.max_match = opt->crp.crp_ucl.max_match;
|
||||
|
||||
// Avoid too many progress bar updates. 64 is s->bar_len in ui.cpp.
|
||||
unsigned step = (ph.u_len < 64*1024) ? 0 : ph.u_len / 64;
|
||||
upx_compress_config_t cconf; cconf.reset();
|
||||
if (cconf_parm)
|
||||
cconf = *cconf_parm;
|
||||
// cconf options
|
||||
if (M_IS_NRV2B(ph.method) || M_IS_NRV2D(ph.method) || M_IS_NRV2E(ph.method))
|
||||
{
|
||||
if (opt->crp.crp_ucl.c_flags != -1)
|
||||
cconf.conf_ucl.c_flags = opt->crp.crp_ucl.c_flags;
|
||||
if (opt->crp.crp_ucl.p_level != -1)
|
||||
cconf.conf_ucl.p_level = opt->crp.crp_ucl.p_level;
|
||||
if (opt->crp.crp_ucl.h_level != -1)
|
||||
cconf.conf_ucl.h_level = opt->crp.crp_ucl.h_level;
|
||||
if (opt->crp.crp_ucl.max_offset != UINT_MAX && opt->crp.crp_ucl.max_offset < cconf.conf_ucl.max_offset)
|
||||
cconf.conf_ucl.max_offset = opt->crp.crp_ucl.max_offset;
|
||||
if (opt->crp.crp_ucl.max_match != UINT_MAX && opt->crp.crp_ucl.max_match < cconf.conf_ucl.max_match)
|
||||
cconf.conf_ucl.max_match = opt->crp.crp_ucl.max_match;
|
||||
#if defined(WITH_NRV)
|
||||
if (ph.level >= 7 || (ph.level >= 4 && ph.u_len >= 512*1024))
|
||||
step = 0;
|
||||
if (ph.level >= 7 || (ph.level >= 4 && ph.u_len >= 512*1024))
|
||||
step = 0;
|
||||
#endif
|
||||
}
|
||||
if (ui_pass >= 0)
|
||||
ui_pass++;
|
||||
uip->startCallback(ph.u_len, step, ui_pass, ui_total_passes);
|
||||
|
@ -205,7 +204,7 @@ bool Packer::compress(upx_bytep in, upx_bytep out,
|
|||
// compress
|
||||
int r = upx_compress(in, ph.u_len, out, &ph.c_len,
|
||||
uip->getCallback(),
|
||||
ph.method, ph.level, &conf, &ph.compress_result);
|
||||
ph.method, ph.level, &cconf, &ph.compress_result);
|
||||
|
||||
//uip->finalCallback(ph.u_len, ph.c_len);
|
||||
uip->endCallback();
|
||||
|
@ -215,17 +214,23 @@ bool Packer::compress(upx_bytep in, upx_bytep out,
|
|||
if (r != UPX_E_OK)
|
||||
throwInternalError("compression failed");
|
||||
|
||||
ucl_uint *res = ph.compress_result.result_ucl.result;
|
||||
//ph.min_offset_found = res[0];
|
||||
ph.max_offset_found = res[1];
|
||||
//ph.min_match_found = res[2];
|
||||
ph.max_match_found = res[3];
|
||||
//ph.min_run_found = res[4];
|
||||
ph.max_run_found = res[5];
|
||||
ph.first_offset_found = res[6];
|
||||
//ph.same_match_offsets_found = res[7];
|
||||
assert(max_offset == 0 || max_offset >= ph.max_offset_found);
|
||||
assert(max_match == 0 || max_match >= ph.max_match_found);
|
||||
if (M_IS_NRV2B(ph.method) || M_IS_NRV2D(ph.method) || M_IS_NRV2E(ph.method))
|
||||
{
|
||||
ucl_uint *res = ph.compress_result.result_ucl.result;
|
||||
//ph.min_offset_found = res[0];
|
||||
ph.max_offset_found = res[1];
|
||||
//ph.min_match_found = res[2];
|
||||
ph.max_match_found = res[3];
|
||||
//ph.min_run_found = res[4];
|
||||
ph.max_run_found = res[5];
|
||||
ph.first_offset_found = res[6];
|
||||
//ph.same_match_offsets_found = res[7];
|
||||
if (cconf_parm)
|
||||
{
|
||||
assert(cconf.conf_ucl.max_offset == 0 || cconf.conf_ucl.max_offset >= ph.max_offset_found);
|
||||
assert(cconf.conf_ucl.max_match == 0 || cconf.conf_ucl.max_match >= ph.max_match_found);
|
||||
}
|
||||
}
|
||||
|
||||
//printf("\nPacker::compress: %d/%d: %7d -> %7d\n", ph.method, ph.level, ph.u_len, ph.c_len);
|
||||
if (!checkCompressionRatio(ph.u_len, ph.c_len))
|
||||
|
@ -1140,7 +1145,7 @@ int Packer::getLoaderSectionStart(const char *name, int *slen) const
|
|||
void Packer::compressWithFilters(Filter *parm_ft,
|
||||
const unsigned overlap_range,
|
||||
int strategy, const int *parm_filters,
|
||||
unsigned max_offset, unsigned max_match,
|
||||
const upx_compress_config_t *cconf,
|
||||
unsigned filter_off, unsigned compress_buf_off,
|
||||
unsigned char *hdr_buf,
|
||||
unsigned hdr_u_len)
|
||||
|
@ -1323,7 +1328,7 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
|||
ph.filter_cto = ft.cto;
|
||||
ph.n_mru = ft.n_mru;
|
||||
// compress
|
||||
if (compress(ibuf + compress_buf_off, *otemp, max_offset, max_match))
|
||||
if (compress(ibuf + compress_buf_off, *otemp, cconf))
|
||||
{
|
||||
unsigned lsize = 0;
|
||||
if (ph.c_len + lsize + hdr_c_len <= best_ph.c_len + best_ph_lsize + best_hdr_c_len)
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
protected:
|
||||
// main compression drivers
|
||||
virtual bool compress(upx_bytep in, upx_bytep out,
|
||||
unsigned max_offset = 0, unsigned max_match = 0);
|
||||
const upx_compress_config_t *cconf = NULL);
|
||||
virtual void decompress(const upx_bytep in, upx_bytep out,
|
||||
bool verify_checksum = true, Filter *ft = NULL);
|
||||
virtual bool checkCompressionRatio(unsigned u_len, unsigned c_len) const;
|
||||
|
@ -176,7 +176,7 @@ protected:
|
|||
const unsigned overlap_range,
|
||||
int strategy = 0,
|
||||
const int *filters = NULL,
|
||||
unsigned max_offset = 0, unsigned max_match = 0,
|
||||
const upx_compress_config_t *cconf = NULL,
|
||||
unsigned filter_buf_off = 0,
|
||||
unsigned compress_buf_off = 0,
|
||||
unsigned char *header_buffer = 0,
|
||||
|
|
|
@ -11,6 +11,7 @@ MAKEFLAGS += -rR
|
|||
.SUFFIXES:
|
||||
.SECONDEXPANSION:
|
||||
export SHELL = /bin/sh
|
||||
export LC_ALL = C
|
||||
|
||||
ifneq ($(findstring $(firstword $(MAKE_VERSION)),3.79 3.79.1 3.80),)
|
||||
$(error GNU make 3.81 or better is required)
|
||||
|
@ -77,20 +78,20 @@ endif
|
|||
ifndef default.targets
|
||||
ifeq ($(wildcard .all-stamp),)
|
||||
default.targets =
|
||||
default: $(default.targets)
|
||||
default: $$(default.targets)
|
||||
@echo "UPX info: type 'make all' if you have all the required build tools."
|
||||
else
|
||||
default.targets = all
|
||||
default: $(default.targets)
|
||||
default: $$(default.targets)
|
||||
endif
|
||||
endif
|
||||
|
||||
all.targets ?= tmp/.tmp-stamp .all-stamp
|
||||
all: $(all.targets)
|
||||
all: $$(all.targets)
|
||||
tmp/.tmp-stamp:
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "timestamp" > $@
|
||||
.all-stamp: $(STUBS)
|
||||
.all-stamp: $$(STUBS)
|
||||
@echo "timestamp" > $@
|
||||
|
||||
ifeq ($(wildcard .all-stamp),)
|
||||
|
@ -121,19 +122,25 @@ tc.default.bin2h = python $(srcdir)/scripts/bin2h.py
|
|||
tc.default.brandelf = perl -w $(srcdir)/scripts/brandelf.pl
|
||||
tc.default.djasm = djasm
|
||||
tc.default.gpp_inc = python $(srcdir)/scripts/gpp_inc.py
|
||||
tc.default.o2bin = perl $(srcdir)/scripts/o2bin.pl
|
||||
tc.default.m-objcopy = multiarch-objcopy-2.17
|
||||
tc.default.m-objdump = multiarch-objdump-2.17
|
||||
tc.default.m-ld = multiarch-ld-2.17
|
||||
tc.default.m-nm = multiarch-nm-2.17
|
||||
tc.default.m-readelf = multiarch-readelf-2.17
|
||||
tc.default.nasm = nasm
|
||||
tc.default.nasm += -I$(srcdir)/ -I$(srcdir)/src/
|
||||
tc.default.nasm += -O99 -w+macro-params -w+macro-selfref -w+number-overflow -w+orphan-labels
|
||||
tc.default.nasm += -Dstub_$(subst .,_,$(subst -,_,$(basename $(notdir $@))))=1
|
||||
tc.default.o2bin = perl $(srcdir)/scripts/o2bin.pl
|
||||
tc.default.pp-asm = i386-linux-gcc-2.95.3 -E -nostdinc -x assembler-with-cpp -Wall -Wp,-P,-C,-traditional
|
||||
tc.default.pp-nasm = $(tc.default.gpp_inc) --mode=nasm -I$(srcdir)/ -I$(srcdir)/src/
|
||||
tc.default.readelf = readelf
|
||||
tc.default.sstrip = sstrip
|
||||
|
||||
# some common settings for $(tc_list)
|
||||
tc.i086.app-nasm = perl -w $(srcdir)/src/arch/i086/app-nasm.pl
|
||||
tc.i386.app-nasm = perl -w $(srcdir)/src/arch/i386/app-nasm.pl
|
||||
tc.arch-i086.app-nasm = perl -w $(srcdir)/src/arch/i086/app-nasm.pl
|
||||
tc.arch-i086.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD
|
||||
tc.arch-i386.app-nasm = perl -w $(srcdir)/src/arch/i386/app-nasm.pl
|
||||
tc.arch-i386.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD
|
||||
|
||||
|
||||
# slightly tricky make stuff follows
|
||||
|
@ -143,7 +150,7 @@ __tc_varlist = tc.$(basename $(notdir $@)).$1 $(foreach v,$(tc_list),tc.$v.$1)
|
|||
# return the name of the first variable that is not empty
|
||||
__tc_varsearch = $(firstword $(foreach v,$1,$(if $($v),$v,)))
|
||||
# error sentinel for missing commands
|
||||
__tc_FALSE = false tc_FALSE: '$1' '$@' '$<'
|
||||
__tc_FALSE = false tc_FALSE: '$1' '$@' '$<' '$(tc_list)'
|
||||
# expand the first variable that is not empty
|
||||
tc = $($(call __tc_varsearch,$(call __tc_varlist,$1) __tc_FALSE))
|
||||
|
||||
|
@ -166,9 +173,12 @@ amd64-linux.elf% : tc_list = amd64-linux.elf default
|
|||
tc.amd64-linux.elf.gcc = x86_64-unknown-linux-gnu-gcc-3.4.4 -m64 -nostdinc -MMD
|
||||
tc.amd64-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||
tc.amd64-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||
tc.amd64-linux.elf.ld = x86_64-unknown-linux-gnu-ld -m elf_x86_64
|
||||
tc.amd64-linux.elf.objcopy = x86_64-unknown-linux-gnu-objcopy
|
||||
tc.amd64-linux.elf.objdump = x86_64-unknown-linux-gnu-objdump
|
||||
##tc.amd64-linux.elf.ld = x86_64-unknown-linux-gnu-ld -m elf_x86_64
|
||||
##tc.amd64-linux.elf.objcopy = x86_64-unknown-linux-gnu-objcopy
|
||||
##tc.amd64-linux.elf.objdump = x86_64-unknown-linux-gnu-objdump
|
||||
tc.amd64-linux.elf.ld = $(call tc,m-ld) -b elf64-x86-64
|
||||
tc.amd64-linux.elf.objcopy = $(call tc,m-objcopy) -I elf64-x86-64
|
||||
tc.amd64-linux.elf.objdump = $(call tc,m-objdump) -b elf64-x86-64
|
||||
tc.amd64-linux.elf.objstrip = $(call tc,objcopy) -R .comment -R .note
|
||||
|
||||
amd64-linux.elf-entry.h : $(srcdir)/src/$$T.S
|
||||
|
@ -200,9 +210,12 @@ arm-linux.elf% : tc_list = arm-linux.elf default
|
|||
tc.arm-linux.elf.gcc = arm-9tdmi-linux-gnu-gcc-3.4.5 -march=armv4 -nostdinc -MMD
|
||||
tc.arm-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||
tc.arm-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||
tc.arm-linux.elf.ld = arm-9tdmi-linux-gnu-ld
|
||||
tc.arm-linux.elf.objcopy = arm-9tdmi-linux-gnu-objcopy
|
||||
tc.arm-linux.elf.objdump = arm-9tdmi-linux-gnu-objdump
|
||||
##tc.arm-linux.elf.ld = arm-9tdmi-linux-gnu-ld
|
||||
##tc.arm-linux.elf.objcopy = arm-9tdmi-linux-gnu-objcopy
|
||||
##tc.arm-linux.elf.objdump = arm-9tdmi-linux-gnu-objdump
|
||||
tc.arm-linux.elf.ld = $(call tc,m-ld) -b elf32-littlearm
|
||||
tc.arm-linux.elf.objcopy = $(call tc,m-objcopy) -I elf32-littlearm
|
||||
tc.arm-linux.elf.objdump = $(call tc,m-objdump) -b elf32-littlearm
|
||||
tc.arm-linux.elf.objstrip = $(call tc,objcopy) -R .comment -R .note
|
||||
|
||||
arm-linux.elf-entry.h : $(srcdir)/src/$$T.S
|
||||
|
@ -248,11 +261,11 @@ arm.v4t-wince.pe.h : $(srcdir)/src/$$T.S
|
|||
# // i086-dos16.com
|
||||
# ************************************************************************/
|
||||
|
||||
i086-dos16.com% : tc_list = i086 default
|
||||
i086-dos16.com% : tc_list = arch-i086 default
|
||||
|
||||
i086-dos16.com.h : $(srcdir)/src/$$T.asm
|
||||
gcc -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||
objdump -trwh tmp/$T.bin >> tmp/$T.bin
|
||||
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
|
||||
$(call tc,bin2h) --ident=nrv2b_loader tmp/$T.bin $@
|
||||
|
||||
|
||||
|
@ -260,11 +273,11 @@ i086-dos16.com.h : $(srcdir)/src/$$T.asm
|
|||
# // i086-dos16.exe
|
||||
# ************************************************************************/
|
||||
|
||||
i086-dos16.exe% : tc_list = i086 default
|
||||
i086-dos16.exe% : tc_list = arch-i086 default
|
||||
|
||||
i086-dos16.exe.h : $(srcdir)/src/$$T.asm
|
||||
gcc -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||
objdump -trwh tmp/$T.bin >> tmp/$T.bin
|
||||
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
|
||||
$(call tc,bin2h) --ident=nrv_loader tmp/$T.bin $@
|
||||
|
||||
|
||||
|
@ -272,11 +285,11 @@ i086-dos16.exe.h : $(srcdir)/src/$$T.asm
|
|||
# // i086-dos16.sys
|
||||
# ************************************************************************/
|
||||
|
||||
i086-dos16.sys% : tc_list = i086 default
|
||||
i086-dos16.sys% : tc_list = arch-i086 default
|
||||
|
||||
i086-dos16.sys.h : $(srcdir)/src/$$T.asm
|
||||
gcc -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||
objdump -trwh tmp/$T.bin >> tmp/$T.bin
|
||||
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
|
||||
$(call tc,bin2h) --ident=nrv2b_loader tmp/$T.bin $@
|
||||
|
||||
|
||||
|
@ -284,7 +297,7 @@ i086-dos16.sys.h : $(srcdir)/src/$$T.asm
|
|||
# // i386-dos32.djgpp2
|
||||
# ************************************************************************/
|
||||
|
||||
i386-dos32.djgpp2% : tc_list = i386 default
|
||||
i386-dos32.djgpp2% : tc_list = arch-i386 default
|
||||
|
||||
i386-dos32.djgpp2.h : $(srcdir)/src/$$T.asm
|
||||
$(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1
|
||||
|
@ -301,7 +314,7 @@ i386-dos32.djgpp2-stubify.h : $(srcdir)/src/$$T.asm
|
|||
# // i386-dos32.tmt
|
||||
# ************************************************************************/
|
||||
|
||||
i386-dos32.tmt% : tc_list = i386 default
|
||||
i386-dos32.tmt% : tc_list = arch-i386 default
|
||||
|
||||
i386-dos32.tmt.h : $(srcdir)/src/$$T.asm
|
||||
$(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1
|
||||
|
@ -314,7 +327,7 @@ i386-dos32.tmt.h : $(srcdir)/src/$$T.asm
|
|||
# // i386-dos32.watcom.le
|
||||
# ************************************************************************/
|
||||
|
||||
i386-dos32.watcom.le% : tc_list = i386 default
|
||||
i386-dos32.watcom.le% : tc_list = arch-i386 default
|
||||
|
||||
i386-dos32.watcom.le.h : $(srcdir)/src/$$T.asm
|
||||
$(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1
|
||||
|
@ -327,9 +340,9 @@ i386-dos32.watcom.le.h : $(srcdir)/src/$$T.asm
|
|||
# // i386-linux.elf
|
||||
# ************************************************************************/
|
||||
|
||||
i386-linux.elf% : tc_list = i386-linux.elf i386 default
|
||||
i386-linux.elf% : tc_list = i386-linux.elf arch-i386 default
|
||||
|
||||
tc.i386-linux.elf.gcc = i386-linux-gcc-3.4.6 -m32 -nostdinc -MMD
|
||||
tc.i386-linux.elf.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD
|
||||
tc.i386-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||
tc.i386-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||
tc.i386-linux.elf.gcc += -march=i386 -mtune=k6
|
||||
|
@ -338,9 +351,12 @@ tc.i386-linux.elf.gcc += -momit-leaf-frame-pointer
|
|||
tc.i386-linux.elf.gcc += -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops
|
||||
tc.i386-linux.elf.gcc += -mpreferred-stack-boundary=2
|
||||
tc.i386-linux.elf.gcc += -fweb
|
||||
tc.i386-linux.elf.ld = i386-linux-ld-2.16.1
|
||||
tc.i386-linux.elf.objcopy = i386-linux-objcopy-2.16.1
|
||||
tc.i386-linux.elf.objdump = i386-linux-objdump
|
||||
##tc.i386-linux.elf.ld = i386-linux-ld-2.16.1
|
||||
##tc.i386-linux.elf.objcopy = i386-linux-objcopy-2.16.1
|
||||
##tc.i386-linux.elf.objdump = i386-linux-objdump
|
||||
tc.i386-linux.elf.ld = $(call tc,m-ld) -b elf32-i386
|
||||
tc.i386-linux.elf.objcopy = $(call tc,m-objcopy) -I elf32-i386
|
||||
tc.i386-linux.elf.objdump = $(call tc,m-objdump) -b elf32-i386
|
||||
tc.i386-linux.elf.objstrip = $(call tc,objcopy) -R .comment -R .note
|
||||
|
||||
i386-linux.elf-entry.h : $(srcdir)/src/$$T.asm
|
||||
|
@ -458,7 +474,7 @@ tmp/i386-linux.elf.shell-main.o : $(srcdir)/src/$$T.c
|
|||
# // i386-linux.kernel.vmlinuz
|
||||
# ************************************************************************/
|
||||
|
||||
i386-linux.kernel.vmlin% : tc_list = i386 default
|
||||
i386-linux.kernel.vmlin% : tc_list = arch-i386 default
|
||||
|
||||
i386-linux.kernel%.h : $(srcdir)/src/$$T.asm
|
||||
$(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1
|
||||
|
@ -471,7 +487,7 @@ i386-linux.kernel%.h : $(srcdir)/src/$$T.asm
|
|||
# // i386-win32.pe
|
||||
# ************************************************************************/
|
||||
|
||||
i386-win32.pe% : tc_list = i386 default
|
||||
i386-win32.pe% : tc_list = arch-i386 default
|
||||
|
||||
i386-win32.pe.h : $(srcdir)/src/$$T.asm
|
||||
$(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1
|
||||
|
@ -539,9 +555,12 @@ powerpc-linux.elf% : tc_list = powerpc-linux.elf default
|
|||
tc.powerpc-linux.elf.gcc = powerpc-750-linux-gnu-gcc-3.4.4 -mcpu=405 -nostdinc -MMD
|
||||
tc.powerpc-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||
tc.powerpc-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||
tc.powerpc-linux.elf.ld = powerpc-750-linux-gnu-ld
|
||||
tc.powerpc-linux.elf.objcopy = powerpc-750-linux-gnu-objcopy
|
||||
tc.powerpc-linux.elf.objdump = powerpc-750-linux-gnu-objdump
|
||||
##tc.powerpc-linux.elf.ld = powerpc-750-linux-gnu-ld
|
||||
##tc.powerpc-linux.elf.objcopy = powerpc-750-linux-gnu-objcopy
|
||||
##tc.powerpc-linux.elf.objdump = powerpc-750-linux-gnu-objdump
|
||||
tc.powerpc-linux.elf.ld = $(call tc,m-ld) -b elf32-powerpc
|
||||
tc.powerpc-linux.elf.objcopy = $(call tc,m-objcopy) -I elf32-powerpc
|
||||
tc.powerpc-linux.elf.objdump = $(call tc,m-objdump) -b elf32-powerpc
|
||||
tc.powerpc-linux.elf.objstrip = $(call tc,objcopy) -R .comment -R .note
|
||||
|
||||
powerpc-linux.elf-entry.h : $(srcdir)/src/$$T.S
|
||||
|
@ -594,9 +613,11 @@ tmp/powerpc-darwin.macho-main.o : $(srcdir)/src/$$T.c
|
|||
# // dependencies
|
||||
# ************************************************************************/
|
||||
|
||||
ifneq ($(STUBS),)
|
||||
# FIXME: we want a dependency-only-prerequisite here
|
||||
##$(STUBS): | tmp/.tmp-stamp
|
||||
##$(STUBS): $(MAKEFILE_LIST)
|
||||
endif
|
||||
-include tmp/*.d
|
||||
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
|
||||
#define LINUX_ELF64AMD_FOLD_SIZE 1699
|
||||
#define LINUX_ELF64AMD_FOLD_ADLER32 0x85c88c53
|
||||
#define LINUX_ELF64AMD_FOLD_CRC32 0xb486db08
|
||||
#define LINUX_ELF64AMD_FOLD_ADLER32 0x87378ad9
|
||||
#define LINUX_ELF64AMD_FOLD_CRC32 0x774d6ce1
|
||||
|
||||
unsigned char linux_elf64amd_fold[1699] = {
|
||||
127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */
|
||||
|
@ -39,9 +39,9 @@ unsigned char linux_elf64amd_fold[1699] = {
|
|||
1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 40 */
|
||||
0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, /* 0x 50 */
|
||||
163, 6, 0, 0, 0, 0, 0, 0,164, 6, 0, 0, 0, 0, 0, 0, /* 0x 60 */
|
||||
0, 0, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, /* 0x 70 */
|
||||
163, 6, 0, 0, 0, 0, 0, 0,164, 6, 16, 0, 0, 0, 0, 0, /* 0x 80 */
|
||||
164, 6, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 90 */
|
||||
0, 0, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
|
||||
163, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 80 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 90 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, /* 0x a0 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,232, 80, 0, 0, /* 0x b0 */
|
||||
0,131,249, 73,117, 74, 72,137,241, 72,137,254,235, 44,138, 7, /* 0x c0 */
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
|
||||
#define LINUX_ELF32ARM_FOLD_SIZE 2084
|
||||
#define LINUX_ELF32ARM_FOLD_ADLER32 0x0ec054f2
|
||||
#define LINUX_ELF32ARM_FOLD_CRC32 0x981e01bb
|
||||
#define LINUX_ELF32ARM_FOLD_ADLER32 0x6ecb5394
|
||||
#define LINUX_ELF32ARM_FOLD_CRC32 0x1f581fa7
|
||||
|
||||
unsigned char linux_elf32arm_fold[2084] = {
|
||||
127, 69, 76, 70, 1, 1, 1, 97, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */
|
||||
|
@ -37,8 +37,8 @@ unsigned char linux_elf32arm_fold[2084] = {
|
|||
0, 0, 0, 0, 2, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0, /* 0x 30 */
|
||||
0,128, 0, 0, 36, 8, 0, 0, 36, 8, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0,128, 0, 0, 1, 0, 0, 0, 36, 8, 0, 0, 36,136, 0, 0, /* 0x 50 */
|
||||
36,136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, /* 0x 60 */
|
||||
0,128, 0, 0, 1, 0, 0, 0, 36, 8, 0, 0, 0, 0, 0, 0, /* 0x 50 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 60 */
|
||||
0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
|
||||
12, 48,157,229, 3, 49,141,224, 20, 48,131,226, 4, 0,147,228, /* 0x 80 */
|
||||
0, 0, 80,227,252,255,255, 26, 3, 32,160,225, 8, 0,146,228, /* 0x 90 */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,8 +28,8 @@
|
|||
|
||||
|
||||
#define LINUX_I386ELF_FOLD_SIZE 1623
|
||||
#define LINUX_I386ELF_FOLD_ADLER32 0xaec8bf31
|
||||
#define LINUX_I386ELF_FOLD_CRC32 0x20b6d044
|
||||
#define LINUX_I386ELF_FOLD_ADLER32 0x7624bccf
|
||||
#define LINUX_I386ELF_FOLD_CRC32 0x41216340
|
||||
|
||||
unsigned char linux_i386elf_fold[1623] = {
|
||||
127, 69, 76, 70, 1, 1, 1, 0, 76,105,110,117,120, 0, 0, 0, /* 0x 0 */
|
||||
|
@ -37,8 +37,8 @@ unsigned char linux_i386elf_fold[1623] = {
|
|||
0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16,192, 0, /* 0x 30 */
|
||||
0, 16,192, 0, 87, 6, 0, 0, 88, 6, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0, 87, 6, 0, 0, 88, 22,192, 0, /* 0x 50 */
|
||||
88, 22,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, /* 0x 60 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0, 87, 6, 0, 0, 0, 0, 0, 0, /* 0x 50 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 60 */
|
||||
0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
|
||||
41,201,186,120, 2, 0, 0,137,230,137,231,232,121, 0, 0, 0, /* 0x 80 */
|
||||
137,230,209,234, 25,192, 41,193,141, 36,196,133,210,117,243,137, /* 0x 90 */
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
|
||||
#define LINUX_I386PTI_FOLD_SIZE 1531
|
||||
#define LINUX_I386PTI_FOLD_ADLER32 0xc7639b18
|
||||
#define LINUX_I386PTI_FOLD_CRC32 0x45f45f94
|
||||
#define LINUX_I386PTI_FOLD_ADLER32 0x54fe990e
|
||||
#define LINUX_I386PTI_FOLD_CRC32 0xa290f522
|
||||
|
||||
unsigned char linux_i386pti_fold[1531] = {
|
||||
127, 69, 76, 70, 1, 1, 1, 0, 76,105,110,117,120, 0, 0, 0, /* 0x 0 */
|
||||
|
@ -37,8 +37,8 @@ unsigned char linux_i386pti_fold[1531] = {
|
|||
0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, /* 0x 30 */
|
||||
0, 0, 1, 0,251, 5, 0, 0,252, 5, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0,251, 5, 0, 0,252, 5, 1, 0, /* 0x 50 */
|
||||
252, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, /* 0x 60 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0,251, 5, 0, 0, 0, 0, 0, 0, /* 0x 50 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 60 */
|
||||
0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
|
||||
93, 89, 88,141,124,132, 4, 80, 41,192,175,117,253,175,137,254, /* 0x 80 */
|
||||
139, 6,131,248, 3,116, 8,131,198, 8,131,248, 0,117,241,139, /* 0x 90 */
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
|
||||
#define LINUX_ELFPPC32_FOLD_SIZE 1936
|
||||
#define LINUX_ELFPPC32_FOLD_ADLER32 0xa51c716b
|
||||
#define LINUX_ELFPPC32_FOLD_CRC32 0xaa049b2f
|
||||
#define LINUX_ELFPPC32_FOLD_ADLER32 0x1a2f7017
|
||||
#define LINUX_ELFPPC32_FOLD_CRC32 0xf69d4404
|
||||
|
||||
unsigned char linux_elfppc32_fold[1936] = {
|
||||
127, 69, 76, 70, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */
|
||||
|
@ -37,8 +37,8 @@ unsigned char linux_elfppc32_fold[1936] = {
|
|||
0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, /* 0x 20 */
|
||||
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 16, 0, 0, /* 0x 30 */
|
||||
0, 16, 0, 0, 0, 0, 7,144, 0, 0, 7,144, 0, 0, 0, 5, /* 0x 40 */
|
||||
0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 7,144, 0, 16, 7,144, /* 0x 50 */
|
||||
0, 16, 7,144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, /* 0x 60 */
|
||||
0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 7,144, 0, 0, 0, 0, /* 0x 50 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 60 */
|
||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
|
||||
72, 0, 0,125, 40, 6, 0,208, 76,130, 0, 32, 84,132,240,191, /* 0x 80 */
|
||||
77,130, 0, 32, 60, 0, 0, 16,124, 4, 0, 64, 65,128, 0, 8, /* 0x 90 */
|
||||
|
|
|
@ -1,28 +1,36 @@
|
|||
MAKEFLAGS += -rR
|
||||
.SUFFIXES:
|
||||
.SECONDEXPANSION:
|
||||
export SHELL = /bin/sh
|
||||
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||
ifndef top_srcdir
|
||||
__dir_list = . .. ../.. ../../.. ../../../.. ../../../../..
|
||||
__dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||
endif
|
||||
|
||||
default.targets = all
|
||||
all.targets = tmp/.tmp-stamp $(STUBS)
|
||||
include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))../../../Makefile
|
||||
STUBS = NO_STUBS
|
||||
include $(top_srcdir)/src/stub/Makefile
|
||||
STUBS =
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // amd64-lzma
|
||||
# ************************************************************************/
|
||||
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||
|
||||
lzma_d_cf.S : tc_list = amd64-lzma amd64-linux.elf default
|
||||
lzma_d_cs.S : tc_list = amd64-lzma amd64-linux.elf default
|
||||
|
||||
tc.amd64-lzma.gcc = $(tc.amd64-linux.elf.gcc)
|
||||
tc.amd64-lzma.gcc += -ffunction-sections
|
||||
tc.amd64-lzma.gcc += -Os
|
||||
tc.amd64-lzma.gcc += -ffunction-sections
|
||||
tc.amd64-lzma.gcc += -I$(UPX_LZMADIR)
|
||||
tc.amd64-lzma.gcc += -I$(top_srcdir)/src
|
||||
|
||||
lzma_d_c%.S : lzma_d_c.c
|
||||
$(call tc,gcc) $(PP_FLAGS) -c $< -o tmp/$T.o
|
||||
|
@ -32,10 +40,7 @@ lzma_d_c%.S : lzma_d_c.c
|
|||
$(call tc,objdump) -b binary -m i386:x86-64 -D tmp/$T.out > tmp/$T.out.lst
|
||||
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
||||
|
||||
lzma_d_cf.S : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.S : PP_FLAGS = -DSMALL
|
||||
|
||||
lzma_d_cf.S : $(MAKEFILE_LIST)
|
||||
lzma_d_cs.S : $(MAKEFILE_LIST)
|
||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||
|
||||
endif
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#define ACC_LIBC_NAKED
|
||||
#define ACC_OS_FREESTANDING
|
||||
#include "../../../../miniacc.h"
|
||||
#include "miniacc.h"
|
||||
|
||||
#undef _LZMA_IN_CB
|
||||
#undef _LZMA_OUT_READ
|
||||
|
|
|
@ -1,21 +1,28 @@
|
|||
MAKEFLAGS += -rR
|
||||
.SUFFIXES:
|
||||
.SECONDEXPANSION:
|
||||
export SHELL = /bin/sh
|
||||
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||
ifndef top_srcdir
|
||||
__dir_list = . .. ../.. ../../.. ../../../.. ../../../../..
|
||||
__dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||
endif
|
||||
|
||||
default.targets = all
|
||||
all.targets = tmp/.tmp-stamp $(STUBS)
|
||||
include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))../../../../Makefile
|
||||
STUBS = NO_STUBS
|
||||
include $(top_srcdir)/src/stub/Makefile
|
||||
STUBS =
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // arm-lzma
|
||||
# ************************************************************************/
|
||||
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||
|
||||
lzma_d_cf.S : tc_list = arm-lzma arm-linux.elf default
|
||||
lzma_d_cs.S : tc_list = arm-lzma arm-linux.elf default
|
||||
|
||||
|
@ -24,6 +31,7 @@ tc.arm-lzma.gcc += -march=armv4 -fPIC
|
|||
tc.arm-lzma.gcc += -Os
|
||||
tc.arm-lzma.gcc += -ffunction-sections
|
||||
tc.arm-lzma.gcc += -I$(UPX_LZMADIR)
|
||||
tc.arm-lzma.gcc += -I$(top_srcdir)/src
|
||||
|
||||
lzma_d_c%.S : lzma_d_c.c
|
||||
$(call tc,gcc) $(PP_FLAGS) -c $< -o tmp/$T.o
|
||||
|
@ -33,10 +41,7 @@ lzma_d_c%.S : lzma_d_c.c
|
|||
$(call tc,objdump) -b binary -m armv4 -D tmp/$T.out > tmp/$T.out.lst
|
||||
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
||||
|
||||
lzma_d_cf.S : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.S : PP_FLAGS = -DSMALL
|
||||
|
||||
lzma_d_cf.S : $(MAKEFILE_LIST)
|
||||
lzma_d_cs.S : $(MAKEFILE_LIST)
|
||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||
|
||||
endif
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#define ACC_LIBC_NAKED
|
||||
#define ACC_OS_FREESTANDING
|
||||
#include "../../../../../miniacc.h"
|
||||
#include "miniacc.h"
|
||||
|
||||
#undef _LZMA_IN_CB
|
||||
#undef _LZMA_OUT_READ
|
||||
|
|
|
@ -1,21 +1,28 @@
|
|||
MAKEFLAGS += -rR
|
||||
.SUFFIXES:
|
||||
.SECONDEXPANSION:
|
||||
export SHELL = /bin/sh
|
||||
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||
ifndef top_srcdir
|
||||
__dir_list = . .. ../.. ../../.. ../../../.. ../../../../..
|
||||
__dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||
endif
|
||||
|
||||
default.targets = all
|
||||
all.targets = tmp/.tmp-stamp $(STUBS)
|
||||
include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))../../../../Makefile
|
||||
STUBS = NO_STUBS
|
||||
include $(top_srcdir)/src/stub/Makefile
|
||||
STUBS =
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // arm-lzma
|
||||
# ************************************************************************/
|
||||
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||
|
||||
lzma_d_cf.S : tc_list = arm-lzma arm-linux.elf default
|
||||
lzma_d_cs.S : tc_list = arm-lzma arm-linux.elf default
|
||||
|
||||
|
@ -24,6 +31,7 @@ tc.arm-lzma.gcc += -march=armv4t -mthumb -fPIC
|
|||
tc.arm-lzma.gcc += -Os
|
||||
tc.arm-lzma.gcc += -ffunction-sections
|
||||
tc.arm-lzma.gcc += -I$(UPX_LZMADIR)
|
||||
tc.arm-lzma.gcc += -I$(top_srcdir)/src
|
||||
|
||||
lzma_d_c%.S : lzma_d_c.c
|
||||
$(call tc,gcc) $(PP_FLAGS) -c $< -o tmp/$T.o
|
||||
|
@ -33,10 +41,7 @@ lzma_d_c%.S : lzma_d_c.c
|
|||
$(call tc,objdump) -b binary -m armv4t -M force-thumb -D tmp/$T.out > tmp/$T.out.lst
|
||||
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
||||
|
||||
lzma_d_cf.S : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.S : PP_FLAGS = -DSMALL
|
||||
|
||||
lzma_d_cf.S : $(MAKEFILE_LIST)
|
||||
lzma_d_cs.S : $(MAKEFILE_LIST)
|
||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||
|
||||
endif
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#define ACC_LIBC_NAKED
|
||||
#define ACC_OS_FREESTANDING
|
||||
#include "../../../../../miniacc.h"
|
||||
#include "miniacc.h"
|
||||
|
||||
#undef _LZMA_IN_CB
|
||||
#undef _LZMA_OUT_READ
|
||||
|
|
|
@ -77,7 +77,7 @@ section NRVGTD00
|
|||
cmp bp, -0xd00
|
||||
adc cx, 1
|
||||
section NRVDECO2
|
||||
lea ax, [di+bp]
|
||||
lea ax, [bp+di]
|
||||
xchg ax, si
|
||||
rep
|
||||
movsb
|
||||
|
|
|
@ -1,27 +1,35 @@
|
|||
MAKEFLAGS += -rR
|
||||
.SUFFIXES:
|
||||
.SECONDEXPANSION:
|
||||
export SHELL = /bin/sh
|
||||
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.ash lzma_d_cs.ash
|
||||
ifndef top_srcdir
|
||||
__dir_list = . .. ../.. ../../.. ../../../.. ../../../../..
|
||||
__dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||
endif
|
||||
|
||||
default.targets = all
|
||||
all.targets = tmp/.tmp-stamp $(STUBS)
|
||||
include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))../../../Makefile
|
||||
STUBS = NO_STUBS
|
||||
include $(top_srcdir)/src/stub/Makefile
|
||||
STUBS =
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // i386-lzma
|
||||
# ************************************************************************/
|
||||
|
||||
lzma_d_cf.ash : tc_list = i386-lzma i386-linux.elf i386 default
|
||||
lzma_d_cs.ash : tc_list = i386-lzma i386-linux.elf i386 default
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.ash lzma_d_cs.ash
|
||||
|
||||
lzma_d_cf.ash : tc_list = i386-lzma i386-linux.elf arch-i386 default
|
||||
lzma_d_cs.ash : tc_list = i386-lzma i386-linux.elf arch-i386 default
|
||||
|
||||
tc.i386-lzma.gcc = $(tc.i386-linux.elf.gcc)
|
||||
tc.i386-lzma.gcc += -ffunction-sections
|
||||
tc.i386-lzma.gcc += -I$(UPX_LZMADIR)
|
||||
tc.i386-lzma.gcc += -I$(top_srcdir)/src
|
||||
|
||||
lzma_d_c%.ash : lzma_d_c.c
|
||||
$(call tc,gcc) $(PP_FLAGS) -c $< -o tmp/$T.o
|
||||
|
@ -31,10 +39,7 @@ lzma_d_c%.ash : lzma_d_c.c
|
|||
$(call tc,objdump) -b binary -m i386 -D tmp/$T.out > tmp/$T.out.lst
|
||||
$(call tc,bin2h) --mode=nasm tmp/$T.out $@
|
||||
|
||||
lzma_d_cf.ash : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.ash : PP_FLAGS = -DSMALL
|
||||
|
||||
lzma_d_cf.ash : $(MAKEFILE_LIST)
|
||||
lzma_d_cs.ash : $(MAKEFILE_LIST)
|
||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||
|
||||
endif
|
||||
|
|
|
@ -127,7 +127,7 @@ LZMA_LIT_SIZE equ 768
|
|||
mov [ ebx],al ; store lit_context_bits
|
||||
shr cl,4
|
||||
mov [1+ ebx],cl ; store lit_pos_bits
|
||||
|
||||
|
||||
push edx ; inSize -2
|
||||
push esi ; in
|
||||
push ebx ; &CLzmaDecoderState
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#define ACC_LIBC_NAKED
|
||||
#define ACC_OS_FREESTANDING
|
||||
#include "../../../../miniacc.h"
|
||||
#include "miniacc.h"
|
||||
|
||||
#undef _LZMA_IN_CB
|
||||
#undef _LZMA_OUT_READ
|
||||
|
|
|
@ -1,21 +1,28 @@
|
|||
MAKEFLAGS += -rR
|
||||
.SUFFIXES:
|
||||
.SECONDEXPANSION:
|
||||
export SHELL = /bin/sh
|
||||
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||
ifndef top_srcdir
|
||||
__dir_list = . .. ../.. ../../.. ../../../.. ../../../../..
|
||||
__dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||
endif
|
||||
|
||||
default.targets = all
|
||||
all.targets = tmp/.tmp-stamp $(STUBS)
|
||||
include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))../../../../Makefile
|
||||
STUBS = NO_STUBS
|
||||
include $(top_srcdir)/src/stub/Makefile
|
||||
STUBS =
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // powerpc-lzma
|
||||
# ************************************************************************/
|
||||
|
||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||
|
||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||
|
||||
lzma_d_cf.S : tc_list = powerpc-lzma powerpc-linux.elf default
|
||||
lzma_d_cs.S : tc_list = powerpc-lzma powerpc-linux.elf default
|
||||
|
||||
|
@ -24,6 +31,7 @@ tc.powerpc-lzma.gcc += -mcpu=405 -fPIC
|
|||
tc.powerpc-lzma.gcc += -Os
|
||||
tc.powerpc-lzma.gcc += -ffunction-sections
|
||||
tc.powerpc-lzma.gcc += -I$(UPX_LZMADIR)
|
||||
tc.powerpc-lzma.gcc += -I$(top_srcdir)/src
|
||||
|
||||
lzma_d_c%.S : lzma_d_c.c
|
||||
$(call tc,gcc) $(PP_FLAGS) -c $< -o tmp/$T.o
|
||||
|
@ -33,10 +41,7 @@ lzma_d_c%.S : lzma_d_c.c
|
|||
$(call tc,objdump) -b binary -m powerpc -D tmp/$T.out > tmp/$T.out.lst
|
||||
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
||||
|
||||
lzma_d_cf.S : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.S : PP_FLAGS = -DSMALL
|
||||
|
||||
lzma_d_cf.S : $(MAKEFILE_LIST)
|
||||
lzma_d_cs.S : $(MAKEFILE_LIST)
|
||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||
|
||||
endif
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#define ACC_LIBC_NAKED
|
||||
#define ACC_OS_FREESTANDING
|
||||
#include "../../../../../miniacc.h"
|
||||
#include "miniacc.h"
|
||||
|
||||
#undef _LZMA_IN_CB
|
||||
#undef _LZMA_OUT_READ
|
||||
|
|
Loading…
Reference in New Issue
Block a user