Compare commits
415 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d767332943 | |||
| f3d4503e93 | |||
| 70cb4aadda | |||
| 75325bf9ef | |||
| 669bf2251f | |||
| 190fd76583 | |||
| 8622e22be0 | |||
| 139a0324b6 | |||
| e39f2b2b2f | |||
| 7a46365296 | |||
| f83b7690e5 | |||
| 98c00d0fcb | |||
| b04d566b83 | |||
| b3c765ac7c | |||
| f7146b5af9 | |||
| 5dbf94e49b | |||
| 2e39c924d5 | |||
| 3068d19492 | |||
| 09d7d08e55 | |||
| 31ff38049f | |||
| a5f5e7fc73 | |||
| 3533ebe804 | |||
| c4ed5cc159 | |||
| 303ac34539 | |||
| e8947a6812 | |||
| 533e642945 | |||
| 8ab47ba8a4 | |||
| e4c638aa73 | |||
| 4ec866594b | |||
| a3d5a0a7b8 | |||
| 59d5d25a77 | |||
| e60ebd4027 | |||
| 3a61782f12 | |||
| 11041f44e6 | |||
| 649063c8c6 | |||
| 36271c3244 | |||
| 3c3caaa567 | |||
| d3504d8af2 | |||
| 12d1c6bbda | |||
| 466ceb4a1f | |||
| 3b71139426 | |||
| b11f043d64 | |||
| aef93548f9 | |||
| 26ca21f6cb | |||
| 404fb48668 | |||
| e85e8bec5d | |||
| 4530e5c264 | |||
| 1188d2933b | |||
| 4e88556c94 | |||
| 1f0036a460 | |||
| 5d30472ee2 | |||
| 9866b9bca9 | |||
| bbf52cee67 | |||
| b9b77965b7 | |||
| 852666010e | |||
| bbb886ae4d | |||
| b52d3e0772 | |||
| 27f8f4f62e | |||
| 21ec7e7410 | |||
| ae6d5303ba | |||
| fbbc2bc874 | |||
| 62f22d61e6 | |||
| 3f1f76f8a3 | |||
| 518712c613 | |||
| c0c08c9f43 | |||
| c4113b6bd6 | |||
| 4988868e61 | |||
| 5a513ab16f | |||
| f1a9d1bec9 | |||
| 70a3acfded | |||
| 3ec6a3cce0 | |||
| dd0a8856cc | |||
| c51a1130b8 | |||
| 9851fba246 | |||
| 8054543671 | |||
| 17d0e897ba | |||
| a7940fd19b | |||
| 1fbd34035e | |||
| 945d9157fa | |||
| 915bfbd82e | |||
| ef01a73e8f | |||
| 7e4e6a3cb1 | |||
| ca97430db2 | |||
| 7530643d1d | |||
| 073cdb0d58 | |||
| 9a93b5d1c1 | |||
| 44ce469b84 | |||
| 4d8d330f21 | |||
| 793e1622ea | |||
| 92a33fa0cc | |||
| e8c49a2c35 | |||
| d2e9db7112 | |||
| b728b0e021 | |||
| a1ef410509 | |||
| 24b4ec42e7 | |||
| 52dde5789e | |||
| 730c6ce6c5 | |||
| 5ed1d5b2b3 | |||
| 23c70ec447 | |||
| e29e73a4e4 | |||
| 27289a7589 | |||
| e509bb87e9 | |||
| 5cec09966e | |||
| b5789fb321 | |||
| a1b0fd987f | |||
| a468b92e3a | |||
| ddf0b50c6d | |||
| 3af2b21869 | |||
| c4bfebeceb | |||
| d23484b9db | |||
| 071579b5b6 | |||
| ff9d577e46 | |||
| a25c20ee0b | |||
| ff75a462a4 | |||
| e0b6ff1924 | |||
| 1c5fae74e0 | |||
| 6f650ca16f | |||
| c2da21ba4e | |||
| 903ca50391 | |||
| 70f1ab8cb7 | |||
| 6998449715 | |||
| fb0f6c6a00 | |||
| dbde75028c | |||
| 90d86ea59e | |||
| 64891286ba | |||
| e52a3ceb48 | |||
| 8cce9cf641 | |||
| 896dff9619 | |||
| 84a0347df1 | |||
| fc5e44f391 | |||
| 8bf49aa4f2 | |||
| b8079bb6eb | |||
| 5dcad7a387 | |||
| 83e5f74b3d | |||
| 3d402134f5 | |||
| b8b64a3e0f | |||
| c0bf7bf9ab | |||
| 0144f81c28 | |||
| 78f4959521 | |||
| eff1ef2d70 | |||
| 782b07c752 | |||
| bd67677389 | |||
| 8c9e04daaf | |||
| bddc05e787 | |||
| a49d023bd0 | |||
| 7b06ba0b78 | |||
| 344b73dab0 | |||
| 0870514194 | |||
| 0a61ffea3a | |||
| fbc650791d | |||
| 4b41aa1226 | |||
| 3fd68d3ec6 | |||
| d41ceb0d31 | |||
| aee970e80b | |||
| ef8a24ba53 | |||
| 2edf91d315 | |||
| 9fe377b288 | |||
| 996ca8d17d | |||
| b356595eb5 | |||
| e4668e5328 | |||
| a846e483be | |||
| f6e3df69eb | |||
| 1a6c1f0589 | |||
| e3e5d8a3a5 | |||
| 505f6b7373 | |||
| 7d907d9d65 | |||
| d00ba4b465 | |||
| d4deb2a100 | |||
| 5999b0a959 | |||
| e2f1e6697a | |||
| baee96347d | |||
| f60d8f6d18 | |||
| d3300e9564 | |||
| 877390a2ba | |||
| 5afe2af365 | |||
| 5028d559c5 | |||
| deda4f1bae | |||
| 927a9d10a7 | |||
| ad96cee14c | |||
| f95bb4953f | |||
| 8c594de432 | |||
| 330ac2443c | |||
| ebe6272ac7 | |||
| 982e732b74 | |||
| 27de5f42bb | |||
| 37dff58289 | |||
| fc9d90c231 | |||
| 68b31d31c3 | |||
| f7f08be312 | |||
| d14901548a | |||
| 6ebdf92d40 | |||
| abced6720b | |||
| f4604db164 | |||
| 8327c390cf | |||
| bd251c0dbd | |||
| d04209d30f | |||
| 8782778eb3 | |||
| c8515ae862 | |||
| a2fa417af9 | |||
| 93f420939e | |||
| 88cd02d750 | |||
| a35e50c02a | |||
| 566c1eebd2 | |||
| 65c3195b39 | |||
| 76b0b4ce9c | |||
| 02b9ac9764 | |||
| 17b94cdfe5 | |||
| 83166e21a5 | |||
| b4ea89f9d6 | |||
| 00706f0ccc | |||
| 3798dde3aa | |||
| 5bf2258505 | |||
| 33b9c68677 | |||
| 58d9b00a0a | |||
| 7ef018fed0 | |||
| 3d9fc7ab53 | |||
| 3d6b2e4617 | |||
| 886e325cbf | |||
| 60bdffee84 | |||
| a9dc43f7fb | |||
| 0cc0e51d5d | |||
| 14d75b222f | |||
| b10d2b7365 | |||
| 8aa3679323 | |||
| 3403b87cb7 | |||
| d55fdf2205 | |||
| 7cb3f40dab | |||
| 65c362efce | |||
| 8065eebca3 | |||
| 7f062c7ca5 | |||
| 0adad4a053 | |||
| cb39e6e0b8 | |||
| 94eebc3ee5 | |||
| 5d5f4d1765 | |||
| ed0665407a | |||
| 3869a67180 | |||
| 7e75491e88 | |||
| ca33d66816 | |||
| 055e3db80a | |||
| 620ddf1228 | |||
| d71fe3eda0 | |||
| bff5049a98 | |||
| 536b2c2475 | |||
| 7a3033c150 | |||
| 05db054fb9 | |||
| 8aa445e2fc | |||
| 3658136b82 | |||
| 64419ca4f4 | |||
| 913cddec61 | |||
| 25e6a31004 | |||
| 3d58035b41 | |||
| b94a150685 | |||
| 22717c15af | |||
| cb07fc2abc | |||
| ea2a190bd1 | |||
| e6f3c1b3da | |||
| 22f732aa4e | |||
| 5e531d7cca | |||
| 0deae5f0b8 | |||
| 9ff4187fb3 | |||
| 6a1e70bf40 | |||
| d097218a45 | |||
| cc87a2c867 | |||
| b26ba9c4d3 | |||
| 88c94d1cc0 | |||
| 6cda0b6016 | |||
| 66dc1d90d8 | |||
| f7cab0cf71 | |||
| 83e2df4c46 | |||
| 31216ed1b2 | |||
| e9930bb2bc | |||
| c8a0540fd2 | |||
| a9b7a0cb27 | |||
| c0ff491972 | |||
| 146c105961 | |||
| 35fca2062e | |||
| 2c4e5c7a47 | |||
| e561da33bd | |||
| 5f6bdb0a8f | |||
| 6276a4a7c4 | |||
| 4fa50b96ad | |||
| 5aef158ff0 | |||
| 4054ac192a | |||
| febe8e4d9e | |||
| c924c32d54 | |||
| 743eb5cc26 | |||
| f4585cdf77 | |||
| c36977f0b1 | |||
| 44e4bd0b54 | |||
| 1427b8137a | |||
| a9cb354225 | |||
| b4db17ab3c | |||
| ba969fb9f2 | |||
| 87ac252c8d | |||
| ada9081ea2 | |||
| d6a29e582f | |||
| 03c4184067 | |||
| 0a82280f20 | |||
| a7fa2f87c5 | |||
| 3a11a5a82e | |||
| 08a38af553 | |||
| 043a54cf3e | |||
| 16c8f6d160 | |||
| 285472bc78 | |||
| a77adcd4c7 | |||
| cebd4392f2 | |||
| 64a3de5a7a | |||
| 261609f706 | |||
| 17cf73001c | |||
| ad566d793a | |||
| b499ed3d20 | |||
| de8de9c0f0 | |||
| 3b36dce5c2 | |||
| dcd8dfd5fc | |||
| 78f3b6297c | |||
| a49fe3b04a | |||
| f23cc7daa3 | |||
| cafd9d7ace | |||
| 1b6c120864 | |||
| 99afc50ebf | |||
| 3286f7c5ba | |||
| 72ccca9faf | |||
| 3c294d9721 | |||
| 1aff5f5bb7 | |||
| 937ae4c5e0 | |||
| 056865f59a | |||
| c58246b43c | |||
| 3495d1affd | |||
| b0ce072370 | |||
| 9f4d18baac | |||
| f65c8f8c6f | |||
| e0633b89bb | |||
| c3341ce4dc | |||
| 43f9b90c92 | |||
| 6ee45dcdcd | |||
| 344246725b | |||
| 57763ca1e2 | |||
| 40b7e24fcc | |||
| 9e0f16a629 | |||
| 33f4f3a5a1 | |||
| 07a3b75b3e | |||
| bdea2539d1 | |||
| ed3d7b0c45 | |||
| cba44c45fc | |||
| 07b533f95b | |||
| 7b0a79dec5 | |||
| befd01aa96 | |||
| 1cc263624d | |||
| 4daa2c1cde | |||
| 7081c57571 | |||
| 3757579ffc | |||
| 2962dc351b | |||
| c04c685469 | |||
| 72c9769953 | |||
| 42759b94bd | |||
| aa9e69f03e | |||
| 0f3939df15 | |||
| 62265a1bc9 | |||
| 76b2cec8ee | |||
| 3d82f0cfe1 | |||
| e5546bc8b0 | |||
| 6fc0a00ac8 | |||
| 3e5ba5c064 | |||
| 4c32a8e3d4 | |||
| 2ea316d754 | |||
| 548227a55b | |||
| a831a20910 | |||
| 811f66de84 | |||
| 84d806328b | |||
| 285d4c4c65 | |||
| 8506f5b17c | |||
| a87fd56b3e | |||
| f0cb30e2b9 | |||
| 038743c694 | |||
| 0e6cef99a0 | |||
| 92c925fe95 | |||
| 4562d5459d | |||
| 8393ded1b3 | |||
| b0dc483165 | |||
| 3c0ca81311 | |||
| 157a63a023 | |||
| 80e22a7e38 | |||
| ddf2da3d76 | |||
| 0e6478a60f | |||
| aed2c085b8 | |||
| a7592b2ca2 | |||
| 265c100845 | |||
| 84e8288f61 | |||
| c69b4561fb | |||
| 6db0af8d04 | |||
| 842d2cbb0d | |||
| 9fb64ded10 | |||
| 9d26713b1a | |||
| eb3c55b5cb | |||
| 896596f672 | |||
| e4de14612f | |||
| 1d2b276425 | |||
| 35c6a200ad | |||
| 90a7faa15e | |||
| 91f5fe1c0e | |||
| d48a7d303d | |||
| bb816f0c74 | |||
| 93abe97ea5 | |||
| 97cf29ffbb | |||
| ed35613d64 | |||
| f5ec8363b4 | |||
| 87956de092 | |||
| 0f9315383c | |||
| 3538d796a7 | |||
| 24f3824524 | |||
| 70b20d7d89 | |||
| 7b21a0620b | |||
| 3949af6d3c | |||
| d1f62e3ab4 | |||
| 6e644fa480 |
+6
-1
@@ -7,9 +7,11 @@ Checks: >
|
|||||||
bugprone-*,
|
bugprone-*,
|
||||||
-bugprone-assignment-in-if-condition,
|
-bugprone-assignment-in-if-condition,
|
||||||
-bugprone-branch-clone,
|
-bugprone-branch-clone,
|
||||||
|
-bugprone-casting-through-void,
|
||||||
-bugprone-easily-swappable-parameters,
|
-bugprone-easily-swappable-parameters,
|
||||||
-bugprone-empty-catch,
|
-bugprone-empty-catch,
|
||||||
-bugprone-implicit-widening-of-multiplication-result,
|
-bugprone-implicit-widening-of-multiplication-result,
|
||||||
|
-bugprone-inc-dec-in-conditions,
|
||||||
-bugprone-macro-parentheses,
|
-bugprone-macro-parentheses,
|
||||||
-bugprone-narrowing-conversions,
|
-bugprone-narrowing-conversions,
|
||||||
-bugprone-reserved-identifier,
|
-bugprone-reserved-identifier,
|
||||||
@@ -18,13 +20,16 @@ Checks: >
|
|||||||
-bugprone-suspicious-memory-comparison,
|
-bugprone-suspicious-memory-comparison,
|
||||||
-bugprone-suspicious-string-compare,
|
-bugprone-suspicious-string-compare,
|
||||||
-bugprone-switch-missing-default-case,
|
-bugprone-switch-missing-default-case,
|
||||||
|
-bugprone-unintended-char-ostream-output,
|
||||||
clang-analyzer-*,
|
clang-analyzer-*,
|
||||||
-clang-analyzer-optin.performance.Padding,
|
-clang-analyzer-optin.performance.Padding,
|
||||||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
||||||
-clang-analyzer-security.insecureAPI.strcpy,
|
-clang-analyzer-security.insecureAPI.strcpy,
|
||||||
clang-diagnostics-*',
|
clang-diagnostic-*,
|
||||||
performance-*,
|
performance-*,
|
||||||
-performance-avoid-endl,
|
-performance-avoid-endl,
|
||||||
|
-performance-enum-size,
|
||||||
|
-performance-no-int-to-ptr,
|
||||||
-performance-unnecessary-value-param,
|
-performance-unnecessary-value-param,
|
||||||
FormatStyle: file
|
FormatStyle: file
|
||||||
HeaderFilterRegex: '.*'
|
HeaderFilterRegex: '.*'
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ If:
|
|||||||
CompileFlags:
|
CompileFlags:
|
||||||
Add:
|
Add:
|
||||||
- -std=gnu++17
|
- -std=gnu++17
|
||||||
# -std=gnu++20 # requires clang >= 10.0
|
# -std=gnu++20 # requires clangd >= 11.0
|
||||||
|
# -std=gnu++23 # requires clangd >= 18.0
|
||||||
---
|
---
|
||||||
# common flags for all C/C++ files
|
# common flags for all C/C++ files
|
||||||
If:
|
If:
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
#
|
#
|
||||||
# HINT: check settings with
|
# HINT: check settings with
|
||||||
# git ls-files | git check-attr --stdin --all
|
# git ls-files | git check-attr --stdin --all
|
||||||
|
# git ls-files --eol
|
||||||
|
|
||||||
|
# disable all line ending conversions
|
||||||
|
* -text
|
||||||
|
|
||||||
#
|
#
|
||||||
# tell diff tools that these files are generated automatically
|
# tell diff tools that these files are generated automatically
|
||||||
|
|||||||
+532
-320
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
|||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
# see https://docs.github.com/en/actions/managing-issues-and-pull-requests/closing-inactive-issues
|
||||||
|
# see https://github.com/actions/stale
|
||||||
|
|
||||||
|
# Automatically closing issues is far from perfect, but then we only
|
||||||
|
# have limited resources and this approach favors issues that people
|
||||||
|
# actually care about.
|
||||||
|
#
|
||||||
|
# also see:
|
||||||
|
# "Should I Stale or Should I Close? An Analysis of a Bot that Closes
|
||||||
|
# Abandoned Issues and Pull Request".
|
||||||
|
# https://igorwiese.com/images/papers/Paper_BotSE_19.pdf
|
||||||
|
|
||||||
|
name: GitHub - Close stale issues
|
||||||
|
on:
|
||||||
|
schedule: [cron: "50 0 * * 1"] # run weekly Monday 00:50 UTC
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
job-close-stale-issues:
|
||||||
|
if: github.repository_owner == 'upx' && github.repository == 'upx/upx'
|
||||||
|
name: Close stale issues
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/stale@v10
|
||||||
|
with:
|
||||||
|
operations-per-run: 300
|
||||||
|
exempt-all-milestones: true
|
||||||
|
exempt-issue-labels: 'blocker,bug,enhancement,help wanted,regression'
|
||||||
|
days-before-stale: 90
|
||||||
|
days-before-close: 30
|
||||||
|
stale-issue-message: 'This issue is stale because it has been open for 90 days with no activity. Please remove the stale label or add a comment or this issue will be closed in 30 days.'
|
||||||
|
stale-pr-message: 'This PR is stale because it has been open for 90 days with no activity. Please remove the stale label or add a comment or this PR will be closed in 30 days.'
|
||||||
|
close-issue-message: 'This issue was closed because it has been stalled for 30 days with no activity. Please feel free to reopen.'
|
||||||
|
close-pr-message: 'This PR was closed because it has been stalled for 30 days with no activity. Please feel free to reopen.'
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
+21
-14
@@ -1,5 +1,11 @@
|
|||||||
|
/.cache*
|
||||||
|
/.idea/
|
||||||
/.hg*
|
/.hg*
|
||||||
/.vscode*
|
/.vscode*
|
||||||
|
/.zed/
|
||||||
|
/CMakeCache*
|
||||||
|
/CMakeFiles*
|
||||||
|
/CTest*
|
||||||
/Makevars[.-]global*
|
/Makevars[.-]global*
|
||||||
/Testing*
|
/Testing*
|
||||||
/build*
|
/build*
|
||||||
@@ -9,6 +15,7 @@
|
|||||||
GNUmakefile*
|
GNUmakefile*
|
||||||
MMakefile*
|
MMakefile*
|
||||||
Makevars[.-]local*
|
Makevars[.-]local*
|
||||||
|
compile_commands*.json
|
||||||
compile_flags*.txt
|
compile_flags*.txt
|
||||||
Tmp*
|
Tmp*
|
||||||
tmp*
|
tmp*
|
||||||
@@ -37,19 +44,19 @@ tmp*
|
|||||||
*.zip
|
*.zip
|
||||||
*.zst
|
*.zst
|
||||||
|
|
||||||
doc/*.man
|
/doc/*.man
|
||||||
doc/*.ps
|
/doc/*.ps
|
||||||
doc/*.tex
|
/doc/*.tex
|
||||||
|
|
||||||
src/stub/**/.*-stamp
|
/src/stub/**/.*-stamp
|
||||||
src/stub/tmp*/*.bin
|
/src/stub/src/**/tmp*/*
|
||||||
src/stub/tmp*/*.bin.bindump
|
/src/stub/tmp*/*.bin
|
||||||
src/stub/tmp*/*.bin.disasm
|
/src/stub/tmp*/*.bin.bindump
|
||||||
src/stub/tmp*/*.o.disasm
|
/src/stub/tmp*/*.bin.disasm
|
||||||
src/stub/tmp*/mips.r3000-*.[is]
|
/src/stub/tmp*/*.o.disasm
|
||||||
src/stub/tmp*/mipsel.r3000-*.[is]
|
/src/stub/tmp*/mips.r3000-*.[is]
|
||||||
src/stub/src/**/tmp*/*
|
/src/stub/tmp*/mipsel.r3000-*.[is]
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
+81
-76
@@ -21,12 +21,17 @@
|
|||||||
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/.upx_cmake_config_done.txt")
|
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/.upx_cmake_config_done.txt")
|
||||||
if(DEFINED UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION)
|
if(DEFINED UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION)
|
||||||
cmake_minimum_required(VERSION "${UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION}" FATAL_ERROR)
|
cmake_minimum_required(VERSION "${UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION}" FATAL_ERROR)
|
||||||
|
elseif(NOT ${CMAKE_VERSION} VERSION_LESS "3.10")
|
||||||
|
cmake_minimum_required(VERSION "3.10" FATAL_ERROR)
|
||||||
else()
|
else()
|
||||||
cmake_minimum_required(VERSION "3.8" FATAL_ERROR) # CMake >= 3.8 is needed for CXX_STANDARD 17
|
cmake_minimum_required(VERSION "3.8" FATAL_ERROR) # CMake >= 3.8 is needed for CXX_STANDARD 17
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# support functions
|
# support functions and some utility
|
||||||
include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake")
|
include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake")
|
||||||
|
upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR)
|
||||||
|
upx_print_var(CMAKE_GENERATOR_TOOLSET CMAKE_GENERATOR_PLATFORM)
|
||||||
|
upx_print_env_var(CC CXX CPPFLAGS CFLAGS CXXFLAGS)
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# options
|
# options
|
||||||
@@ -35,30 +40,31 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake")
|
|||||||
upx_cmake_include_hook(1_options)
|
upx_cmake_include_hook(1_options)
|
||||||
|
|
||||||
# compilation config options
|
# compilation config options
|
||||||
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/use_strict_defaults.cmake")
|
if(NOT USE_STRICT_DEFAULTS)
|
||||||
# permissive config defaults when building from source code tarball
|
# permissive config defaults when building from source code tarball
|
||||||
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with default Git version info." ON)
|
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with Git version info." ON)
|
||||||
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with default sanitize options." ON)
|
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with sanitize options." ON)
|
||||||
|
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with -Werror option." ON)
|
||||||
option(UPX_CONFIG_DISABLE_WSTRICT "Do not compile with strict compiler warnings." ON)
|
option(UPX_CONFIG_DISABLE_WSTRICT "Do not compile with strict compiler warnings." ON)
|
||||||
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with default -Werror option." ON)
|
|
||||||
else()
|
else()
|
||||||
# strict config defaults for Git developer builds
|
# strict config defaults for Git developer builds
|
||||||
message(STATUS "===== UPX info: strict config defaults enabled")
|
message(STATUS "===== UPX NOTE: strict developer config defaults enabled =====")
|
||||||
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with default Git version info." OFF)
|
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with Git version info." OFF)
|
||||||
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with default sanitize options." OFF)
|
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with sanitize options." OFF)
|
||||||
|
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with -Werror option." OFF)
|
||||||
option(UPX_CONFIG_DISABLE_WSTRICT "Do not compile with strict compiler warnings." OFF)
|
option(UPX_CONFIG_DISABLE_WSTRICT "Do not compile with strict compiler warnings." OFF)
|
||||||
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with default -Werror option." OFF)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# test config options (see below)
|
# test config options (see below)
|
||||||
# IMPORTANT NOTE: self-pack test can only work if the host executable format is supported by UPX!
|
# IMPORTANT NOTE: self-pack test can only work if the host executable format is supported by UPX!
|
||||||
option(UPX_CONFIG_DISABLE_SELF_PACK_TEST "Do not test packing UPX with itself" OFF)
|
option(UPX_CONFIG_DISABLE_SELF_PACK_TEST "Do not test packing UPX with itself." OFF)
|
||||||
|
option(UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS "Do not run exhaustive tests." OFF)
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# init
|
# init
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
set(UPX_VERSION_STRING "4.2.3") # this should match src/version.h
|
set(UPX_VERSION_STRING "5.1.0") # this should match src/version.h
|
||||||
|
|
||||||
upx_cmake_include_hook(2_init)
|
upx_cmake_include_hook(2_init)
|
||||||
|
|
||||||
@@ -78,14 +84,15 @@ upx_cache_bool_vars(ON
|
|||||||
CMAKE_C_STANDARD_REQUIRED CMAKE_CXX_STANDARD_REQUIRED
|
CMAKE_C_STANDARD_REQUIRED CMAKE_CXX_STANDARD_REQUIRED
|
||||||
CMAKE_EXPORT_COMPILE_COMMANDS CMAKE_REQUIRED_QUIET
|
CMAKE_EXPORT_COMPILE_COMMANDS CMAKE_REQUIRED_QUIET
|
||||||
)
|
)
|
||||||
# internal UPX settings that default to OFF
|
# internal UPX settings that default to OFF; useful for CI jobs
|
||||||
upx_cache_bool_vars(OFF
|
upx_cache_bool_vars(OFF
|
||||||
UPX_CONFIG_CMAKE_DISABLE_TEST UPX_CONFIG_CMAKE_DISABLE_INSTALL
|
UPX_CONFIG_CMAKE_DISABLE_TEST UPX_CONFIG_CMAKE_DISABLE_INSTALL
|
||||||
UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO UPX_CONFIG_CMAKE_DISABLE_PLATFORM_CHECK
|
UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO UPX_CONFIG_CMAKE_DISABLE_PLATFORM_CHECK
|
||||||
UPX_CONFIG_DISABLE_C_STANDARD UPX_CONFIG_DISABLE_CXX_STANDARD
|
UPX_CONFIG_DISABLE_C_STANDARD UPX_CONFIG_DISABLE_CXX_STANDARD
|
||||||
UPX_CONFIG_EXPECT_THREADS UPX_CONFIG_REQUIRE_THREADS
|
UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST UPX_CONFIG_DISABLE_RUN_PACKED_TEST
|
||||||
|
UPX_CONFIG_DISABLE_SAVE_TEMPS UPX_CONFIG_DISABLE_SHARED_LIBS UPX_CONFIG_REQUIRE_THREADS
|
||||||
)
|
)
|
||||||
upx_print_env_var(CC CXX)
|
upx_cache_bool_vars(ON UPX_CONFIG_EXPECT_THREADS)
|
||||||
|
|
||||||
# determine Git revision
|
# determine Git revision
|
||||||
set(GITREV_SHORT "")
|
set(GITREV_SHORT "")
|
||||||
@@ -133,13 +140,14 @@ endif()
|
|||||||
upx_set_default_build_type(Release) # default is CMAKE_BUILD_TYPE=Release
|
upx_set_default_build_type(Release) # default is CMAKE_BUILD_TYPE=Release
|
||||||
project(upx VERSION "${UPX_VERSION_STRING}" LANGUAGES C CXX)
|
project(upx VERSION "${UPX_VERSION_STRING}" LANGUAGES C CXX)
|
||||||
upx_apply_build_type()
|
upx_apply_build_type()
|
||||||
|
upx_set_global_vars()
|
||||||
|
upx_check_working_build_rpath(UPX_CONFIG_HAVE_WORKING_BUILD_RPATH)
|
||||||
|
|
||||||
# set MSVC_FRONTEND and MINGW
|
if(DEFINED UPX_CONFIG_CMAKE_EXECUTABLE_SUFFIX)
|
||||||
if(NOT DEFINED MSVC_FRONTEND AND (MSVC OR CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC"))
|
set(CMAKE_EXECUTABLE_SUFFIX "${UPX_CONFIG_CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
set(MSVC_FRONTEND 1)
|
|
||||||
endif()
|
endif()
|
||||||
if(NOT DEFINED MINGW AND CMAKE_C_PLATFORM_ID MATCHES "^MinGW")
|
if(NOT UPX_CONFIG_CMAKE_DISABLE_INSTALL AND CMAKE_INSTALL_PREFIX)
|
||||||
set(MINGW 1)
|
include(GNUInstallDirs)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
@@ -151,9 +159,20 @@ include(CheckFunctionExists)
|
|||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
include(CheckStructHasMember)
|
include(CheckStructHasMember)
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
|
include(CheckTypeSize)
|
||||||
|
|
||||||
upx_cmake_include_hook(3_common_compilation_flags)
|
upx_cmake_include_hook(3_common_compilation_flags)
|
||||||
|
|
||||||
|
# assert sane type sizes
|
||||||
|
check_type_size("size_t" C_SIZEOF_SIZE_T LANGUAGE C)
|
||||||
|
check_type_size("size_t" CXX_SIZEOF_SIZE_T LANGUAGE CXX)
|
||||||
|
if(NOT "${C_SIZEOF_SIZE_T}" MATCHES "^(4|8|16)$")
|
||||||
|
message(FATAL_ERROR "ERROR: unexpected C_SIZEOF_SIZE_T '${C_SIZEOF_SIZE_T}'")
|
||||||
|
endif()
|
||||||
|
if(NOT ",${C_SIZEOF_SIZE_T}," STREQUAL ",${CXX_SIZEOF_SIZE_T},")
|
||||||
|
message(FATAL_ERROR "FATAL ERROR: '${C_SIZEOF_SIZE_T}' '${CXX_SIZEOF_SIZE_T}' mismatch")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED HAVE_UNISTD_H)
|
if(NOT DEFINED HAVE_UNISTD_H)
|
||||||
check_include_file("unistd.h" HAVE_UNISTD_H)
|
check_include_file("unistd.h" HAVE_UNISTD_H)
|
||||||
endif()
|
endif()
|
||||||
@@ -210,6 +229,8 @@ if(MSVC_FRONTEND OR WIN32 OR MINGW OR CYGWIN)
|
|||||||
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
|
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
|
||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
add_definitions(-D_SCL_SECURE_NO_DEPRECATE)
|
||||||
|
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||||
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
||||||
add_definitions(-D__USE_MINGW_ANSI_STDIO)
|
add_definitions(-D__USE_MINGW_ANSI_STDIO)
|
||||||
endif()
|
endif()
|
||||||
@@ -232,8 +253,9 @@ if(NOT CMAKE_C_COMPILER_ID MATCHES "^MSVC")
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# examine MinGW/Cygwin compiler configuration
|
# examine compiler configuration
|
||||||
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
if(NOT UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO)
|
||||||
|
upx_print_common_symbols()
|
||||||
upx_print_mingw_symbols()
|
upx_print_mingw_symbols()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -242,9 +264,9 @@ endif()
|
|||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
# internal settings; these may change in a future versions
|
# internal settings; these may change in a future versions
|
||||||
set(UPX_CONFIG_DISABLE_THREADS ON) # multithreading is currently not used; maybe in UPX version 5
|
set(UPX_CONFIG_DISABLE_THREADS ON) # multithreading is currently not used; maybe in UPX version 6
|
||||||
set(UPX_CONFIG_DISABLE_BZIP2 ON) # bzip2 is currently not used; we might need it to decompress linux kernels
|
set(UPX_CONFIG_DISABLE_BZIP2 ON) # bzip2 is currently not used; we might need it to decompress linux kernels
|
||||||
set(UPX_CONFIG_DISABLE_ZSTD ON) # zstd is currently not used; maybe in UPX version 5
|
set(UPX_CONFIG_DISABLE_ZSTD ON) # zstd is currently not used; maybe in UPX version 6
|
||||||
|
|
||||||
upx_cmake_include_hook(4_targets)
|
upx_cmake_include_hook(4_targets)
|
||||||
|
|
||||||
@@ -253,7 +275,7 @@ if(NOT UPX_CONFIG_DISABLE_THREADS)
|
|||||||
endif()
|
endif()
|
||||||
# make sure that threads are indeed fully supported in C++
|
# make sure that threads are indeed fully supported in C++
|
||||||
if(Threads_FOUND)
|
if(Threads_FOUND)
|
||||||
foreach(f std_lock_guard.cpp)
|
foreach(f std_lock_guard.cpp types_abi.cpp)
|
||||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE "EXECUTABLE")
|
set(CMAKE_TRY_COMPILE_TARGET_TYPE "EXECUTABLE")
|
||||||
if(NOT UPX_CONFIG_DISABLE_CXX_STANDARD)
|
if(NOT UPX_CONFIG_DISABLE_CXX_STANDARD)
|
||||||
try_compile(result "${CMAKE_CURRENT_BINARY_DIR}"
|
try_compile(result "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
@@ -266,7 +288,9 @@ if(Threads_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
if(NOT result)
|
if(NOT result)
|
||||||
# failed; under MinGW be sure to use the posix-threads and NOT the win32-threads version
|
# failed; under MinGW be sure to use the posix-threads and NOT the win32-threads version
|
||||||
#message(STATUS "Threads FAILED: ${output}") # debug output from try_compile
|
if(UPX_CONFIG_REQUIRE_THREADS OR (UPX_CONFIG_EXPECT_THREADS AND NOT UPX_CONFIG_DISABLE_THREADS))
|
||||||
|
message(WARNING "Threads FAILED ${f}: ${output}") # output from try_compile()
|
||||||
|
endif()
|
||||||
set(Threads_FOUND OFF)
|
set(Threads_FOUND OFF)
|
||||||
break()
|
break()
|
||||||
endif()
|
endif()
|
||||||
@@ -330,7 +354,7 @@ upx_sanitize_target(${t})
|
|||||||
target_compile_definitions(${t} PRIVATE BZ_NO_STDIO=1)
|
target_compile_definitions(${t} PRIVATE BZ_NO_STDIO=1)
|
||||||
if(MSVC_FRONTEND)
|
if(MSVC_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE ${warn_WN} -wd4127 -wd4244 -wd4267 ${warn_WX})
|
target_compile_options(${t} PRIVATE ${warn_WN} -wd4127 -wd4244 -wd4267 ${warn_WX})
|
||||||
else()
|
elseif(GNU_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2)
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2)
|
||||||
@@ -342,12 +366,13 @@ upx_compile_target_debug_with_O2(${t})
|
|||||||
upx_sanitize_target(${t})
|
upx_sanitize_target(${t})
|
||||||
if(MSVC_FRONTEND)
|
if(MSVC_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE ${warn_WN} ${warn_WX})
|
target_compile_options(${t} PRIVATE ${warn_WN} ${warn_WX})
|
||||||
else()
|
elseif(GNU_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL)
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL)
|
||||||
|
|
||||||
set(t upx_vendor_zlib)
|
set(t upx_vendor_zlib)
|
||||||
|
target_include_directories(${t} PRIVATE vendor/zlib)
|
||||||
upx_compile_target_debug_with_O2(${t})
|
upx_compile_target_debug_with_O2(${t})
|
||||||
upx_sanitize_target(${t})
|
upx_sanitize_target(${t})
|
||||||
target_compile_definitions(${t} PRIVATE HAVE_VSNPRINTF=1)
|
target_compile_definitions(${t} PRIVATE HAVE_VSNPRINTF=1)
|
||||||
@@ -356,7 +381,7 @@ if(HAVE_UNISTD_H)
|
|||||||
endif()
|
endif()
|
||||||
if(MSVC_FRONTEND)
|
if(MSVC_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE -W3 ${warn_WX})
|
target_compile_options(${t} PRIVATE -W3 ${warn_WX})
|
||||||
else()
|
elseif(GNU_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} -Wno-cast-align -Wno-cast-qual ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} -Wno-cast-align -Wno-cast-qual ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB)
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB)
|
||||||
@@ -368,7 +393,7 @@ upx_sanitize_target(${t})
|
|||||||
target_compile_definitions(${t} PRIVATE DYNAMIC_BMI2=0 ZSTD_DISABLE_ASM=1)
|
target_compile_definitions(${t} PRIVATE DYNAMIC_BMI2=0 ZSTD_DISABLE_ASM=1)
|
||||||
if(MSVC_FRONTEND)
|
if(MSVC_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE ${warn_WN} ${warn_WX})
|
target_compile_options(${t} PRIVATE ${warn_WN} ${warn_WX})
|
||||||
else()
|
elseif(GNU_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD)
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD)
|
||||||
@@ -411,7 +436,7 @@ upx_compile_source_debug_with_O2(src/filter/filter_impl.cpp)
|
|||||||
upx_sanitize_target(${t})
|
upx_sanitize_target(${t})
|
||||||
if(MSVC_FRONTEND)
|
if(MSVC_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE -EHsc ${warn_WN} ${warn_WX})
|
target_compile_options(${t} PRIVATE -EHsc ${warn_WN} ${warn_WX})
|
||||||
else()
|
elseif(GNU_FRONTEND)
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX)
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX)
|
||||||
@@ -427,32 +452,25 @@ upx_cmake_include_hook(6_test)
|
|||||||
|
|
||||||
if(NOT UPX_CONFIG_CMAKE_DISABLE_TEST)
|
if(NOT UPX_CONFIG_CMAKE_DISABLE_TEST)
|
||||||
|
|
||||||
|
add_custom_command(TARGET upx POST_BUILD COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/XTesting/$<CONFIG>")
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
if(NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR)
|
if(NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR)
|
||||||
add_test(NAME upx-version COMMAND upx --version)
|
upx_add_test(upx-version upx --version)
|
||||||
add_test(NAME upx-help COMMAND upx --help)
|
upx_add_test(upx-version-short upx --version-short)
|
||||||
add_test(NAME upx-sysinfo COMMAND upx --sysinfo -v)
|
upx_add_test(upx-license upx --license)
|
||||||
|
upx_add_test(upx-help-1 upx --help)
|
||||||
|
upx_add_test(upx-help-2 upx --help-short)
|
||||||
|
upx_add_test(upx-help-3 upx --help-verbose)
|
||||||
|
upx_add_test(upx-sysinfo-1 upx --sysinfo)
|
||||||
|
upx_add_test(upx-sysinfo-2 upx --sysinfo -v)
|
||||||
|
upx_add_test(upx-sysinfo-3 upx --sysinfo -vv)
|
||||||
if(NOT UPX_CONFIG_DISABLE_SELF_PACK_TEST)
|
if(NOT UPX_CONFIG_DISABLE_SELF_PACK_TEST)
|
||||||
# IMPORTANT NOTE: these tests can only work if the host executable format is supported by UPX!
|
# IMPORTANT NOTE: these tests can only work if the host executable format
|
||||||
set(emu "")
|
# is supported by UPX!
|
||||||
if(DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
|
include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/self_pack_test.cmake")
|
||||||
set(emu "${CMAKE_CROSSCOMPILING_EMULATOR}")
|
upx_self_pack_test()
|
||||||
endif()
|
endif()
|
||||||
set(exe "${CMAKE_EXECUTABLE_SUFFIX}")
|
|
||||||
set(upx_self_exe "$<TARGET_FILE:upx>")
|
|
||||||
set(fo "--force-overwrite")
|
|
||||||
upx_add_serial_test(upx-self-pack upx -3 "${upx_self_exe}" ${fo} -o upx-packed${exe})
|
|
||||||
upx_add_serial_test(upx-self-pack-n2b upx -3 --nrv2b "${upx_self_exe}" ${fo} -o upx-packed-n2b${exe})
|
|
||||||
upx_add_serial_test(upx-self-pack-n2d upx -3 --nrv2d "${upx_self_exe}" ${fo} -o upx-packed-n2d${exe})
|
|
||||||
upx_add_serial_test(upx-self-pack-n2e upx -3 --nrv2e "${upx_self_exe}" ${fo} -o upx-packed-n2e${exe})
|
|
||||||
upx_add_serial_test(upx-self-pack-lzma upx -1 --lzma "${upx_self_exe}" ${fo} -o upx-packed-lzma${exe})
|
|
||||||
upx_add_serial_test(upx-list upx -l upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe})
|
|
||||||
upx_add_serial_test(upx-fileinfo upx --fileinfo upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe})
|
|
||||||
upx_add_serial_test(upx-test upx -t upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe})
|
|
||||||
upx_add_serial_test(upx-unpack upx -d upx-packed${exe} ${fo} -o upx-unpacked${exe})
|
|
||||||
upx_add_serial_test(upx-run-unpacked ${emu} ./upx-unpacked${exe} --version-short)
|
|
||||||
upx_add_serial_test(upx-run-packed ${emu} ./upx-packed${exe} --version-short)
|
|
||||||
endif() # UPX_CONFIG_DISABLE_SELF_PACK_TEST
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif() # UPX_CONFIG_CMAKE_DISABLE_TEST
|
endif() # UPX_CONFIG_CMAKE_DISABLE_TEST
|
||||||
@@ -473,17 +491,14 @@ if(NOT CMAKE_INSTALL_PREFIX)
|
|||||||
#message(FATAL_ERROR "ERROR: CMAKE_INSTALL_PREFIX is not defined")
|
#message(FATAL_ERROR "ERROR: CMAKE_INSTALL_PREFIX is not defined")
|
||||||
message(WARNING "WARNING: CMAKE_INSTALL_PREFIX is not defined")
|
message(WARNING "WARNING: CMAKE_INSTALL_PREFIX is not defined")
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_INSTALL_PREFIX)
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
endif()
|
|
||||||
# install files
|
# install files
|
||||||
if(CMAKE_INSTALL_PREFIX AND DEFINED CMAKE_INSTALL_FULL_BINDIR)
|
if(CMAKE_INSTALL_PREFIX AND DEFINED CMAKE_INSTALL_BINDIR)
|
||||||
install(TARGETS upx DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
|
install(TARGETS upx DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
install(FILES
|
install(FILES
|
||||||
COPYING LICENSE NEWS README doc/THANKS.txt doc/upx-doc.html doc/upx-doc.txt
|
COPYING LICENSE NEWS README doc/THANKS.txt doc/upx-doc.html doc/upx-doc.txt
|
||||||
DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}"
|
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
|
||||||
)
|
)
|
||||||
install(FILES doc/upx.1 DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man1")
|
install(FILES doc/upx.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif() # UPX_CONFIG_CMAKE_DISABLE_INSTALL
|
endif() # UPX_CONFIG_CMAKE_DISABLE_INSTALL
|
||||||
@@ -497,25 +512,17 @@ upx_cmake_include_hook(8_summary)
|
|||||||
|
|
||||||
upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR)
|
upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR)
|
||||||
if(NOT UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO)
|
if(NOT UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO)
|
||||||
if(NOT ",${CMAKE_BINARY_DIR}," STREQUAL ",${CMAKE_CURRENT_BINARY_DIR}," OR NOT ",${CMAKE_SOURCE_DIR}," STREQUAL ",${CMAKE_CURRENT_SOURCE_DIR},")
|
# print detailed info
|
||||||
upx_print_var(CMAKE_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_SOURCE_DIR)
|
include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/print_info.cmake")
|
||||||
|
upx_print_info()
|
||||||
endif()
|
endif()
|
||||||
upx_print_var(CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_APPLE_SILICON_PROCESSOR)
|
upx_print_var(CMAKE_INSTALL_PREFIX CMAKE_CONFIGURATION_TYPES CMAKE_TRY_COMPILE_CONFIGURATION CMAKE_BUILD_TYPE)
|
||||||
upx_print_var(CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION CMAKE_SYSTEM_PROCESSOR CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR)
|
|
||||||
upx_print_var(CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT)
|
|
||||||
upx_print_var(CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_AR CMAKE_RANLIB)
|
|
||||||
upx_print_var(CMAKE_C_COMPILER_ID CMAKE_C_COMPILER_VERSION CMAKE_C_COMPILER_FRONTEND_VARIANT CMAKE_C_COMPILER_ARCHITECTURE_ID CMAKE_C_PLATFORM_ID CMAKE_C_COMPILER_ABI)
|
|
||||||
upx_print_var(CMAKE_CXX_COMPILER_ID CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_COMPILER_FRONTEND_VARIANT CMAKE_CXX_COMPILER_ARCHITECTURE_ID CMAKE_CXX_PLATFORM_ID CMAKE_CXX_COMPILER_ABI)
|
|
||||||
upx_print_var(CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_POSITION_INDEPENDENT_CODE CMAKE_TRY_COMPILE_CONFIGURATION)
|
|
||||||
upx_print_var(APPLE CYGWIN GNUC MINGW MSVC MSVC_FRONTEND MSVC_IDE UNIX WIN32 WIN64)
|
|
||||||
endif() # UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO
|
|
||||||
upx_print_var(CMAKE_INSTALL_PREFIX CMAKE_CONFIGURATION_TYPES CMAKE_BUILD_TYPE)
|
|
||||||
if(Threads_FOUND)
|
if(Threads_FOUND)
|
||||||
message(STATUS "WITH_THREADS = 1")
|
message(STATUS "WITH_THREADS = 1")
|
||||||
elseif(UPX_CONFIG_REQUIRE_THREADS)
|
elseif(UPX_CONFIG_REQUIRE_THREADS)
|
||||||
message(FATAL_ERROR "ERROR: WITH_THREADS required")
|
message(FATAL_ERROR "ERROR: WITH_THREADS required")
|
||||||
elseif(UPX_CONFIG_EXPECT_THREADS AND NOT UPX_CONFIG_DISABLE_THREADS)
|
elseif(UPX_CONFIG_EXPECT_THREADS AND NOT UPX_CONFIG_DISABLE_THREADS)
|
||||||
message(FATAL_ERROR "ERROR: WITH_THREADS expected")
|
message(FATAL_ERROR "ERROR: WITH_THREADS expected; set UPX_CONFIG_EXPECT_THREADS=OFF")
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|None|Release)$")
|
if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|None|Release)$")
|
||||||
message(WARNING "WARNING: unsupported CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}; please use \"Debug\" or \"Release\"")
|
message(WARNING "WARNING: unsupported CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}; please use \"Debug\" or \"Release\"")
|
||||||
@@ -523,10 +530,8 @@ endif()
|
|||||||
|
|
||||||
# extra sanity checks to detect incompatible C vs CXX settings
|
# extra sanity checks to detect incompatible C vs CXX settings
|
||||||
if(NOT UPX_CONFIG_CMAKE_DISABLE_PLATFORM_CHECK)
|
if(NOT UPX_CONFIG_CMAKE_DISABLE_PLATFORM_CHECK)
|
||||||
upx_platform_check_mismatch(CMAKE_C_PLATFORM_ID CMAKE_CXX_PLATFORM_ID)
|
upx_platform_check_c_cxx_mismatch()
|
||||||
upx_platform_check_mismatch(CMAKE_C_COMPILER_ABI CMAKE_CXX_COMPILER_ABI)
|
endif()
|
||||||
upx_platform_check_mismatch(CMAKE_C_COMPILER_FRONTEND_VARIANT CMAKE_CXX_COMPILER_FRONTEND_VARIANT)
|
|
||||||
endif() # UPX_CONFIG_CMAKE_DISABLE_PLATFORM_CHECK
|
|
||||||
|
|
||||||
upx_cmake_include_hook(9_finish)
|
upx_cmake_include_hook(9_finish)
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/.upx_cmake_config_done.txt" "")
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/.upx_cmake_config_done.txt" "")
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
# mkdir -p build/release
|
# mkdir -p build/release
|
||||||
# cd build/release
|
# cd build/release
|
||||||
# cmake ../.. # run config
|
# cmake ../.. # run config
|
||||||
# make -j # and run build
|
# make -j4 # and run build
|
||||||
|
|
||||||
CMAKE = cmake
|
CMAKE = cmake
|
||||||
UPX_CMAKE_BUILD_FLAGS += --parallel
|
UPX_CMAKE_BUILD_FLAGS += --parallel
|
||||||
@@ -26,10 +26,15 @@ endif
|
|||||||
|
|
||||||
.DEFAULT_GOAL = build/release
|
.DEFAULT_GOAL = build/release
|
||||||
|
|
||||||
run_cmake_config = $(CMAKE) -S . -B $1 $(UPX_CMAKE_CONFIG_FLAGS) -DCMAKE_BUILD_TYPE=$2
|
.NOTPARALLEL: # because the actual builds use "cmake --parallel"
|
||||||
run_cmake_build = $(CMAKE) --build $1 $(UPX_CMAKE_BUILD_FLAGS) --config $2
|
.PHONY: PHONY
|
||||||
|
.SECONDEXPANSION:
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
run_cmake_config = $(CMAKE) -S . -B "$1" $(UPX_CMAKE_CONFIG_FLAGS) -DCMAKE_BUILD_TYPE="$2"
|
||||||
|
run_cmake_build = $(CMAKE) --build "$1" $(UPX_CMAKE_BUILD_FLAGS) --config "$2"
|
||||||
# avoid re-running run_cmake_config if .upx_cmake_config_done.txt already exists
|
# avoid re-running run_cmake_config if .upx_cmake_config_done.txt already exists
|
||||||
run_config = $(if $(wildcard $1/CMakeFiles/.upx_cmake_config_done.txt),,$(call run_cmake_config,$1,$2))
|
run_config = $(if $(wildcard $1/CMakeFiles/.*_cmake_config_done.txt),,$(call run_cmake_config,$1,$2))
|
||||||
run_build = $(call run_cmake_build,$1,$2)
|
run_build = $(call run_cmake_build,$1,$2)
|
||||||
|
|
||||||
build/debug: PHONY
|
build/debug: PHONY
|
||||||
@@ -40,33 +45,64 @@ build/release: PHONY
|
|||||||
$(call run_config,$@,Release)
|
$(call run_config,$@,Release)
|
||||||
$(call run_build,$@,Release)
|
$(call run_build,$@,Release)
|
||||||
|
|
||||||
.NOTPARALLEL: # because the actual builds use "cmake --parallel"
|
|
||||||
.PHONY: PHONY
|
|
||||||
.SECONDEXPANSION:
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
# shortcuts (all => debug + release)
|
# shortcuts (all => debug + release)
|
||||||
debug: build/debug PHONY
|
debug: build/debug PHONY
|
||||||
release: build/release PHONY
|
release: build/release PHONY
|
||||||
all build/all: build/debug build/release PHONY
|
all build/all: build/debug build/release PHONY
|
||||||
build/%/all: $$(dir $$@)debug $$(dir $$@)release PHONY ;
|
build/%/all: $$(dir $$@)debug $$(dir $$@)release PHONY ;
|
||||||
|
|
||||||
#
|
#***********************************************************************
|
||||||
|
# test
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
CTEST = ctest
|
||||||
|
CTEST_JOBS ?= 8
|
||||||
|
CTEST_FLAGS = --output-on-failure --parallel $(CTEST_JOBS)
|
||||||
|
|
||||||
|
build/debug+test: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CTEST) $(CTEST_FLAGS) -C Debug
|
||||||
|
build/%/debug+test: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CTEST) $(CTEST_FLAGS) -C Debug
|
||||||
|
build/release+test: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CTEST) $(CTEST_FLAGS) -C Release
|
||||||
|
build/%/release+test: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CTEST) $(CTEST_FLAGS) -C Release
|
||||||
|
build/%/all+test: $$(dir $$@)debug+test $$(dir $$@)release+test PHONY ;
|
||||||
|
|
||||||
|
# shortcuts
|
||||||
|
debug+test: build/debug+test PHONY
|
||||||
|
release+test: build/release+test PHONY
|
||||||
|
all+test build/all+test: build/debug+test build/release+test PHONY
|
||||||
|
|
||||||
|
test: $$(patsubst %+test,%,$$(.DEFAULT_GOAL))+test PHONY
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# install
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
build/debug+install: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CMAKE) --install . --config Debug
|
||||||
|
build/%/debug+install: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CMAKE) --install . --config Debug
|
||||||
|
build/release+install: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CMAKE) --install . --config Release
|
||||||
|
build/%/release+install: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CMAKE) --install . --config Release
|
||||||
|
build/%/all+install: $$(dir $$@)debug+install $$(dir $$@)release+install PHONY ;
|
||||||
|
|
||||||
|
# shortcuts
|
||||||
|
debug+install: build/debug+install PHONY
|
||||||
|
release+install: build/release+install PHONY
|
||||||
|
all+install build/all+install: build/debug+install build/release+install PHONY
|
||||||
|
|
||||||
|
install: $$(patsubst %+install,%,$$(.DEFAULT_GOAL))+install PHONY
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
# END of Makefile
|
# END of Makefile
|
||||||
#
|
#***********************************************************************
|
||||||
|
|
||||||
# extra pre-defined build configurations and some utility; optional
|
# extra pre-defined build configurations and some utility; optional
|
||||||
ifneq ($(MAKEFILE_LIST),)
|
-include ./Makevars-local.mk
|
||||||
include $(dir $(lastword $(MAKEFILE_LIST)))/misc/make/Makefile-extra.mk
|
-include ./misc/make/Makefile-extra.mk
|
||||||
else
|
|
||||||
include ./misc/make/Makefile-extra.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
# developer convenience
|
# developer convenience
|
||||||
test:: build/all+test PHONY
|
|
||||||
ifneq ($(wildcard /usr/bin/env),) # need Unix utils like bash, perl, sed, xargs, etc.
|
ifneq ($(wildcard /usr/bin/env),) # need Unix utils like bash, perl, sed, xargs, etc.
|
||||||
ifneq ($(wildcard ./misc/scripts/.),)
|
ifneq ($(and $(wildcard ./misc/scripts/.),$(wildcard ./doc/upx.pod)),)
|
||||||
check-whitespace clang-format run-testsuite run-testsuite-debug run-testsuite-release: src/Makefile PHONY
|
check-whitespace clang-format run-testsuite run-testsuite-all run-testsuite-debug run-testsuite-release: src/Makefile PHONY
|
||||||
$(MAKE) -C src $@
|
$(MAKE) -C src $@
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# vim:set ts=8 sw=8 noet:
|
||||||
|
|||||||
@@ -2,6 +2,27 @@
|
|||||||
User visible changes for UPX
|
User visible changes for UPX
|
||||||
==================================================================
|
==================================================================
|
||||||
|
|
||||||
|
Changes in 5.1.0 (XX XXX XXXX):
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/21
|
||||||
|
|
||||||
|
Changes in 5.0.2 (20 Jul 2025):
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/20
|
||||||
|
|
||||||
|
Changes in 5.0.1 (06 May 2025):
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/19
|
||||||
|
|
||||||
|
Changes in 5.0.0 (20 Feb 2025):
|
||||||
|
* ELF: use of memfd_create supports Enforcing mode of SELinux
|
||||||
|
* ELF: two-step de-compression enables future per-PT_LOAD work
|
||||||
|
* ELF: --unmap-all-pages completely avoids /proc/self/exe
|
||||||
|
* ELF: PT_MIPS_ABIFLAGS is now forwarded into the compressed output;
|
||||||
|
qemu-mips can choose the right floating-point emulation
|
||||||
|
* ELF: many minor internal changes fix nits revealed by fuzzing
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/18
|
||||||
|
|
||||||
|
Changes in 4.2.4 (09 May 2024):
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/17
|
||||||
|
|
||||||
Changes in 4.2.3 (27 Mar 2024):
|
Changes in 4.2.3 (27 Mar 2024):
|
||||||
* bug fixes - see https://github.com/upx/upx/milestone/16
|
* bug fixes - see https://github.com/upx/upx/milestone/16
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2024 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2025 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
https://upx.github.io
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
@@ -61,8 +61,9 @@ SHORT DOCUMENTATION
|
|||||||
'upx program.exe' will compress a program or DLL. For best compression
|
'upx program.exe' will compress a program or DLL. For best compression
|
||||||
results try 'upx --best program.exe' or 'upx --brute program.exe'.
|
results try 'upx --best program.exe' or 'upx --brute program.exe'.
|
||||||
|
|
||||||
Please see the file UPX.DOC for the full documentation. The files
|
Please see the file doc/upx-doc.txt for the full documentation. The files
|
||||||
NEWS and BUGS also contain various tidbits of information.
|
NEWS and doc/BUGS.txt also contain various tidbits of information, as
|
||||||
|
does the output of 'upx --help'.
|
||||||
|
|
||||||
|
|
||||||
THE FUTURE
|
THE FUTURE
|
||||||
@@ -85,13 +86,13 @@ THE FUTURE
|
|||||||
COPYRIGHT
|
COPYRIGHT
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
Copyright (C) 2000-2024 John F. Reiser
|
Copyright (C) 2000-2025 John F. Reiser
|
||||||
|
|
||||||
UPX is distributed with full source code under the terms of the
|
UPX is distributed with full source code under the terms of the
|
||||||
GNU General Public License v2+; either under the pure GPLv2+ (see
|
GNU General Public License v2+; either under the pure GPLv2+ (see
|
||||||
the file COPYING), or (at your option) under the GPLv+2 with special
|
the file COPYING), or (at your option) under the GPLv2+ with special
|
||||||
exceptions and restrictions granting the free usage for all binaries
|
exceptions and restrictions granting the free usage for all binaries
|
||||||
including commercial programs (see the file LICENSE).
|
including commercial programs (see the file LICENSE).
|
||||||
|
|
||||||
|
|||||||
+21
-1
@@ -81,6 +81,15 @@ Developer quick start
|
|||||||
4b) $ wget https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz
|
4b) $ wget https://github.com/upx/upx-stubtools/releases/download/v20221212/bin-upx-20221212.tar.xz
|
||||||
# Extract to $HOME/bin/bin-upx or $HOME/local/bin/bin-upx.
|
# Extract to $HOME/bin/bin-upx or $HOME/local/bin/bin-upx.
|
||||||
# See directions in: https://github.com/upx/upx-stubtools
|
# See directions in: https://github.com/upx/upx-stubtools
|
||||||
|
|
||||||
|
# Some of the pre-built tools need i386 libz. On Ubuntu:
|
||||||
|
# # dpkg --add-architecture i386
|
||||||
|
# # apt-get update
|
||||||
|
# # apt-get install zlib1g-dev
|
||||||
|
|
||||||
|
# aarch64-linux-gnu/4.9.2/cc1 needs libmpfr.so.4. Make a symlink:
|
||||||
|
# # ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
|
||||||
|
|
||||||
4c) $ make clean; make # verify that you can re-build stubs
|
4c) $ make clean; make # verify that you can re-build stubs
|
||||||
4d) $ popd # my-upx
|
4d) $ popd # my-upx
|
||||||
5) $ cd upx # my-upx/upx
|
5) $ cd upx # my-upx/upx
|
||||||
@@ -92,7 +101,18 @@ Developer quick start
|
|||||||
# If stuck, then reset via "rm -rf vendor; git submodule update --init".
|
# If stuck, then reset via "rm -rf vendor; git submodule update --init".
|
||||||
7) $ mkdir -p build/debug build/release
|
7) $ mkdir -p build/debug build/release
|
||||||
8) $ pushd build/debug # my-upx/upx/build/debug
|
8) $ pushd build/debug # my-upx/upx/build/debug
|
||||||
9) $ cmake ../.. # configure cmake
|
|
||||||
|
9a) Install GNU g++ so that it is used when invoking "c++" compiler.
|
||||||
|
On Ubuntu 24.04 with
|
||||||
|
cmake: cmake version 3.28.3
|
||||||
|
g++: Ubuntu clang version 18.1.3 (1ubuntu1)
|
||||||
|
/lib/llvm-18/lib/cmake/llvm/HandleLLVMOptions.cmake:
|
||||||
|
add_flag_if_supported("-fno-lifetime-dse" CMAKE_CXX_FLAGS)
|
||||||
|
then cmake invoking c++ uses -fno-lifetime-dse but gets
|
||||||
|
c++: error: unknown argument: '-fno-lifetime-dse'
|
||||||
|
Commenting out the "add_flag_if_supported' line still uses that unknown argument.
|
||||||
|
Installing g++ avoids the problem.
|
||||||
|
9b) $ cmake ../.. # configure cmake
|
||||||
10) $ cmake --build . --verbose # optional "--verbose"
|
10) $ cmake --build . --verbose # optional "--verbose"
|
||||||
# This relies on stub/*.h, which YOU must re-build if necessary.
|
# This relies on stub/*.h, which YOU must re-build if necessary.
|
||||||
# When in doubt, then use "cd src/stub; make clean; make".
|
# When in doubt, then use "cd src/stub; make clean; make".
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2024 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2025 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
https://upx.github.io
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -3,7 +3,7 @@
|
|||||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
#
|
#
|
||||||
|
|
||||||
BUILT_SOURCES = upx.1 upx-doc.html upx-doc.txt
|
BUILT_SOURCES := upx.1 upx-doc.html upx-doc.txt
|
||||||
|
|
||||||
top_srcdir ?= ..
|
top_srcdir ?= ..
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ DETAB2 := sed -e 's/$(tab)/ /g'
|
|||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
.DEFAULT_GOAL = all
|
.DEFAULT_GOAL = all
|
||||||
|
|
||||||
.PHONY: PHONY
|
.PHONY: PHONY
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@@ -43,6 +44,8 @@ mostlyclean clean distclean maintainer-clean: PHONY
|
|||||||
%.1 : %.pod
|
%.1 : %.pod
|
||||||
pod2man --center=" " --release="$(PACKAGE) $(VERSION)" --date="$(VERSION_DATE)" $< | $(RTRIM) > $@
|
pod2man --center=" " --release="$(PACKAGE) $(VERSION)" --date="$(VERSION_DATE)" $< | $(RTRIM) > $@
|
||||||
test -s $@
|
test -s $@
|
||||||
|
# # strip version number from "Pod::Man" comment
|
||||||
|
sed -i -e 's/^\(\.\\" Automatically generated by Pod::Man\).*/\1/' $@
|
||||||
|
|
||||||
%-doc.html : %.pod
|
%-doc.html : %.pod
|
||||||
pod2html --noindex $< | $(RTRIM) | $(DETAB2) > $@
|
pod2html --noindex $< | $(RTRIM) | $(DETAB2) > $@
|
||||||
|
|||||||
+3
-1
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2024 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2025 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
https://upx.github.io
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
@@ -37,6 +37,8 @@ Charles W. Sandmann <sandmann@clio.rice.edu>
|
|||||||
for the idea with the stubless decompressor in djgpp2/coff
|
for the idea with the stubless decompressor in djgpp2/coff
|
||||||
Ice
|
Ice
|
||||||
for debugging the PE headersize problem down
|
for debugging the PE headersize problem down
|
||||||
|
Jens Medoch <jssg@users.sourceforge.net>
|
||||||
|
for the ps1/exe format
|
||||||
Joergen Ibsen <jibz@hotmail.com> and d'b
|
Joergen Ibsen <jibz@hotmail.com> and d'b
|
||||||
for the relocation & address optimization ideas
|
for the relocation & address optimization ideas
|
||||||
John S. Fine <johnfine@erols.com>
|
John S. Fine <johnfine@erols.com>
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
Decompressing ELF Directly to Memory on Linux/x86
|
Decompressing ELF Directly to Memory on Linux/x86
|
||||||
Copyright (C) 2000-2024 John F. Reiser jreiser@BitWagon.com
|
Copyright (C) 2000-2025 John F. Reiser jreiser@BitWagon.com
|
||||||
|
|
||||||
References:
|
References:
|
||||||
<elf.h> definitions for the ELF file format
|
<elf.h> definitions for the ELF file format
|
||||||
|
|||||||
Generated
+5
-9
@@ -22,7 +22,7 @@
|
|||||||
<h1 id="ABSTRACT">ABSTRACT</h1>
|
<h1 id="ABSTRACT">ABSTRACT</h1>
|
||||||
|
|
||||||
<pre><code> The Ultimate Packer for eXecutables
|
<pre><code> The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2024 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2025 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
https://upx.github.io</code></pre>
|
https://upx.github.io</code></pre>
|
||||||
|
|
||||||
<p><b>UPX</b> is a portable, extendable, high-performance executable packer for several different executable formats. It achieves an excellent compression ratio and offers <i>*very*</i> fast decompression. Your executables suffer no memory overhead or other drawbacks for most of the formats supported, because of in-place decompression.</p>
|
<p><b>UPX</b> is a portable, extendable, high-performance executable packer for several different executable formats. It achieves an excellent compression ratio and offers <i>*very*</i> fast decompression. Your executables suffer no memory overhead or other drawbacks for most of the formats supported, because of in-place decompression.</p>
|
||||||
@@ -779,19 +779,15 @@ http://www.oberhumer.com
|
|||||||
|
|
||||||
Laszlo Molnar <ezerotven+github@gmail.com>
|
Laszlo Molnar <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser <jreiser@BitWagon.com>
|
John F. Reiser <jreiser@BitWagon.com></code></pre>
|
||||||
|
|
||||||
Jens Medoch <jssg@users.sourceforge.net></code></pre>
|
|
||||||
|
|
||||||
<h1 id="COPYRIGHT">COPYRIGHT</h1>
|
<h1 id="COPYRIGHT">COPYRIGHT</h1>
|
||||||
|
|
||||||
<p>Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer</p>
|
<p>Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer</p>
|
||||||
|
|
||||||
<p>Copyright (C) 1996-2024 Laszlo Molnar</p>
|
<p>Copyright (C) 1996-2025 Laszlo Molnar</p>
|
||||||
|
|
||||||
<p>Copyright (C) 2000-2024 John F. Reiser</p>
|
<p>Copyright (C) 2000-2025 John F. Reiser</p>
|
||||||
|
|
||||||
<p>Copyright (C) 2002-2024 Jens Medoch</p>
|
|
||||||
|
|
||||||
<p><b>UPX</b> is distributed with full source code under the terms of the GNU General Public License v2+; either under the pure GPLv2+ (see the file COPYING), or (at your option) under the GPLv+2 with special exceptions and restrictions granting the free usage for all binaries including commercial programs (see the file LICENSE).</p>
|
<p><b>UPX</b> is distributed with full source code under the terms of the GNU General Public License v2+; either under the pure GPLv2+ (see the file COPYING), or (at your option) under the GPLv+2 with special exceptions and restrictions granting the free usage for all binaries including commercial programs (see the file LICENSE).</p>
|
||||||
|
|
||||||
|
|||||||
Generated
+4
-8
@@ -6,7 +6,7 @@ SYNOPSIS
|
|||||||
|
|
||||||
ABSTRACT
|
ABSTRACT
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2024 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2025 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
https://upx.github.io
|
https://upx.github.io
|
||||||
|
|
||||||
UPX is a portable, extendable, high-performance executable packer for
|
UPX is a portable, extendable, high-performance executable packer for
|
||||||
@@ -815,16 +815,12 @@ AUTHORS
|
|||||||
|
|
||||||
John F. Reiser <jreiser@BitWagon.com>
|
John F. Reiser <jreiser@BitWagon.com>
|
||||||
|
|
||||||
Jens Medoch <jssg@users.sourceforge.net>
|
|
||||||
|
|
||||||
COPYRIGHT
|
COPYRIGHT
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
|
|
||||||
Copyright (C) 2000-2024 John F. Reiser
|
Copyright (C) 2000-2025 John F. Reiser
|
||||||
|
|
||||||
Copyright (C) 2002-2024 Jens Medoch
|
|
||||||
|
|
||||||
UPX is distributed with full source code under the terms of the GNU
|
UPX is distributed with full source code under the terms of the GNU
|
||||||
General Public License v2+; either under the pure GPLv2+ (see the file
|
General Public License v2+; either under the pure GPLv2+ (see the file
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
|
.\" -*- mode: troff; coding: utf-8 -*-
|
||||||
|
.\" Automatically generated by Pod::Man
|
||||||
.\"
|
.\"
|
||||||
.\" Standard preamble:
|
.\" Standard preamble:
|
||||||
.\" ========================================================================
|
.\" ========================================================================
|
||||||
@@ -15,29 +16,12 @@
|
|||||||
.ft R
|
.ft R
|
||||||
.fi
|
.fi
|
||||||
..
|
..
|
||||||
.\" Set up some character translations and predefined strings. \*(-- will
|
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
|
||||||
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
|
||||||
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
|
|
||||||
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
|
|
||||||
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
|
|
||||||
.\" nothing in troff, for use with C<>.
|
|
||||||
.tr \(*W-
|
|
||||||
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
|
||||||
.ie n \{\
|
.ie n \{\
|
||||||
. ds -- \(*W-
|
|
||||||
. ds PI pi
|
|
||||||
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
|
||||||
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
|
||||||
. ds L" ""
|
|
||||||
. ds R" ""
|
|
||||||
. ds C` ""
|
. ds C` ""
|
||||||
. ds C' ""
|
. ds C' ""
|
||||||
'br\}
|
'br\}
|
||||||
.el\{\
|
.el\{\
|
||||||
. ds -- \|\(em\|
|
|
||||||
. ds PI \(*p
|
|
||||||
. ds L" ``
|
|
||||||
. ds R" ''
|
|
||||||
. ds C`
|
. ds C`
|
||||||
. ds C'
|
. ds C'
|
||||||
'br\}
|
'br\}
|
||||||
@@ -68,110 +52,48 @@
|
|||||||
. \}
|
. \}
|
||||||
.\}
|
.\}
|
||||||
.rr rF
|
.rr rF
|
||||||
.\"
|
|
||||||
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
|
||||||
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
|
||||||
. \" fudge factors for nroff and troff
|
|
||||||
.if n \{\
|
|
||||||
. ds #H 0
|
|
||||||
. ds #V .8m
|
|
||||||
. ds #F .3m
|
|
||||||
. ds #[ \f1
|
|
||||||
. ds #] \fP
|
|
||||||
.\}
|
|
||||||
.if t \{\
|
|
||||||
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
|
||||||
. ds #V .6m
|
|
||||||
. ds #F 0
|
|
||||||
. ds #[ \&
|
|
||||||
. ds #] \&
|
|
||||||
.\}
|
|
||||||
. \" simple accents for nroff and troff
|
|
||||||
.if n \{\
|
|
||||||
. ds ' \&
|
|
||||||
. ds ` \&
|
|
||||||
. ds ^ \&
|
|
||||||
. ds , \&
|
|
||||||
. ds ~ ~
|
|
||||||
. ds /
|
|
||||||
.\}
|
|
||||||
.if t \{\
|
|
||||||
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
|
||||||
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
|
||||||
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
|
||||||
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
|
||||||
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
|
||||||
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
|
||||||
.\}
|
|
||||||
. \" troff and (daisy-wheel) nroff accents
|
|
||||||
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
|
||||||
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
|
||||||
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
|
||||||
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
|
||||||
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
|
||||||
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
|
||||||
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
|
||||||
.ds ae a\h'-(\w'a'u*4/10)'e
|
|
||||||
.ds Ae A\h'-(\w'A'u*4/10)'E
|
|
||||||
. \" corrections for vroff
|
|
||||||
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
|
||||||
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
|
||||||
. \" for low resolution devices (crt and lpr)
|
|
||||||
.if \n(.H>23 .if \n(.V>19 \
|
|
||||||
\{\
|
|
||||||
. ds : e
|
|
||||||
. ds 8 ss
|
|
||||||
. ds o a
|
|
||||||
. ds d- d\h'-1'\(ga
|
|
||||||
. ds D- D\h'-1'\(hy
|
|
||||||
. ds th \o'bp'
|
|
||||||
. ds Th \o'LP'
|
|
||||||
. ds ae ae
|
|
||||||
. ds Ae AE
|
|
||||||
.\}
|
|
||||||
.rm #[ #] #H #V #F C
|
|
||||||
.\" ========================================================================
|
.\" ========================================================================
|
||||||
.\"
|
.\"
|
||||||
.IX Title "UPX 1"
|
.IX Title "UPX 1"
|
||||||
.TH UPX 1 "2024-03-27" "upx 4.2.3" " "
|
.TH UPX 1 2025-10-24 "upx 5.1.0" " "
|
||||||
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||||
.\" way too many mistakes in technical documents.
|
.\" way too many mistakes in technical documents.
|
||||||
.if n .ad l
|
.if n .ad l
|
||||||
.nh
|
.nh
|
||||||
.SH "NAME"
|
.SH NAME
|
||||||
upx \- compress or expand executable files
|
upx \- compress or expand executable files
|
||||||
.SH "SYNOPSIS"
|
.SH SYNOPSIS
|
||||||
.IX Header "SYNOPSIS"
|
.IX Header "SYNOPSIS"
|
||||||
\&\fBupx\fR [\ \fIcommand\fR\ ] [\ \fIoptions\fR\ ] \fIfilename\fR...
|
\&\fBupx\fR [\ \fIcommand\fR\ ] [\ \fIoptions\fR\ ] \fIfilename\fR...
|
||||||
.SH "ABSTRACT"
|
.SH ABSTRACT
|
||||||
.IX Header "ABSTRACT"
|
.IX Header "ABSTRACT"
|
||||||
.Vb 3
|
.Vb 3
|
||||||
\& The Ultimate Packer for eXecutables
|
\& The Ultimate Packer for eXecutables
|
||||||
\& Copyright (c) 1996\-2024 Markus Oberhumer, Laszlo Molnar & John Reiser
|
\& Copyright (c) 1996\-2025 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
\& https://upx.github.io
|
\& https://upx.github.io
|
||||||
.Ve
|
.Ve
|
||||||
.PP
|
.PP
|
||||||
\&\fB\s-1UPX\s0\fR is a portable, extendable, high-performance executable packer for
|
\&\fBUPX\fR is a portable, extendable, high-performance executable packer for
|
||||||
several different executable formats. It achieves an excellent compression
|
several different executable formats. It achieves an excellent compression
|
||||||
ratio and offers \fI*very*\fR fast decompression. Your executables suffer
|
ratio and offers \fI*very*\fR fast decompression. Your executables suffer
|
||||||
no memory overhead or other drawbacks for most of the formats supported,
|
no memory overhead or other drawbacks for most of the formats supported,
|
||||||
because of in-place decompression.
|
because of in-place decompression.
|
||||||
.SH "DISCLAIMER"
|
.SH DISCLAIMER
|
||||||
.IX Header "DISCLAIMER"
|
.IX Header "DISCLAIMER"
|
||||||
\&\fB\s-1UPX\s0\fR comes with \s-1ABSOLUTELY NO WARRANTY\s0; for details see the file \s-1COPYING.\s0
|
\&\fBUPX\fR comes with ABSOLUTELY NO WARRANTY; for details see the file COPYING.
|
||||||
.PP
|
.PP
|
||||||
Please report all problems or suggestions to the authors. Thanks.
|
Please report all problems or suggestions to the authors. Thanks.
|
||||||
.SH "SECURITY CONTEXT"
|
.SH "SECURITY CONTEXT"
|
||||||
.IX Header "SECURITY CONTEXT"
|
.IX Header "SECURITY CONTEXT"
|
||||||
\&\s-1IMPORTANT NOTE:\s0 \fB\s-1UPX\s0\fR inherits the security context of any files it handles.
|
IMPORTANT NOTE: \fBUPX\fR inherits the security context of any files it handles.
|
||||||
.PP
|
.PP
|
||||||
This means that packing, unpacking, or even testing or listing a file requires
|
This means that packing, unpacking, or even testing or listing a file requires
|
||||||
the same security considerations as actually executing the file.
|
the same security considerations as actually executing the file.
|
||||||
.PP
|
.PP
|
||||||
Use \fB\s-1UPX\s0\fR on trusted files only!
|
Use \fBUPX\fR on trusted files only!
|
||||||
.SH "DESCRIPTION"
|
.SH DESCRIPTION
|
||||||
.IX Header "DESCRIPTION"
|
.IX Header "DESCRIPTION"
|
||||||
\&\fB\s-1UPX\s0\fR is a versatile executable packer with the following features:
|
\&\fBUPX\fR is a versatile executable packer with the following features:
|
||||||
.PP
|
.PP
|
||||||
.Vb 3
|
.Vb 3
|
||||||
\& \- secure: as UPX is documented Open Source since many years any relevant
|
\& \- secure: as UPX is documented Open Source since many years any relevant
|
||||||
@@ -204,32 +126,32 @@ Use \fB\s-1UPX\s0\fR on trusted files only!
|
|||||||
\& for commercial programs
|
\& for commercial programs
|
||||||
.Ve
|
.Ve
|
||||||
.PP
|
.PP
|
||||||
You probably understand now why we call \fB\s-1UPX\s0\fR the "\fIultimate\fR"
|
You probably understand now why we call \fBUPX\fR the "\fIultimate\fR"
|
||||||
executable packer.
|
executable packer.
|
||||||
.SH "COMMANDS"
|
.SH COMMANDS
|
||||||
.IX Header "COMMANDS"
|
.IX Header "COMMANDS"
|
||||||
.SS "Compress"
|
.SS Compress
|
||||||
.IX Subsection "Compress"
|
.IX Subsection "Compress"
|
||||||
This is the default operation, eg. \fBupx yourfile.exe\fR will compress the file
|
This is the default operation, eg. \fBupx yourfile.exe\fR will compress the file
|
||||||
specified on the command line.
|
specified on the command line.
|
||||||
.SS "Decompress"
|
.SS Decompress
|
||||||
.IX Subsection "Decompress"
|
.IX Subsection "Decompress"
|
||||||
All \fB\s-1UPX\s0\fR supported file formats can be unpacked using the \fB\-d\fR switch, eg.
|
All \fBUPX\fR supported file formats can be unpacked using the \fB\-d\fR switch, eg.
|
||||||
\&\fBupx \-d yourfile.exe\fR will uncompress the file you've just compressed.
|
\&\fBupx \-d yourfile.exe\fR will uncompress the file you've just compressed.
|
||||||
.SS "Test"
|
.SS Test
|
||||||
.IX Subsection "Test"
|
.IX Subsection "Test"
|
||||||
The \fB\-t\fR command tests the integrity of the compressed and uncompressed
|
The \fB\-t\fR command tests the integrity of the compressed and uncompressed
|
||||||
data, eg. \fBupx \-t yourfile.exe\fR check whether your file can be safely
|
data, eg. \fBupx \-t yourfile.exe\fR check whether your file can be safely
|
||||||
decompressed. Note, that this command doesn't check the whole file, only
|
decompressed. Note, that this command doesn't check the whole file, only
|
||||||
the part that will be uncompressed during program execution. This means
|
the part that will be uncompressed during program execution. This means
|
||||||
that you should not use this command instead of a virus checker.
|
that you should not use this command instead of a virus checker.
|
||||||
.SS "List"
|
.SS List
|
||||||
.IX Subsection "List"
|
.IX Subsection "List"
|
||||||
The \fB\-l\fR command prints out some information about the compressed files
|
The \fB\-l\fR command prints out some information about the compressed files
|
||||||
specified on the command line as parameters, eg \fBupx \-l yourfile.exe\fR
|
specified on the command line as parameters, eg \fBupx \-l yourfile.exe\fR
|
||||||
shows the compressed / uncompressed size and the compression ratio of
|
shows the compressed / uncompressed size and the compression ratio of
|
||||||
\&\fIyourfile.exe\fR.
|
\&\fIyourfile.exe\fR.
|
||||||
.SH "OPTIONS"
|
.SH OPTIONS
|
||||||
.IX Header "OPTIONS"
|
.IX Header "OPTIONS"
|
||||||
\&\fB\-q\fR: be quiet, suppress warnings
|
\&\fB\-q\fR: be quiet, suppress warnings
|
||||||
.PP
|
.PP
|
||||||
@@ -239,10 +161,10 @@ shows the compressed / uncompressed size and the compression ratio of
|
|||||||
.PP
|
.PP
|
||||||
\&\fB\-\-help\fR: prints the help
|
\&\fB\-\-help\fR: prints the help
|
||||||
.PP
|
.PP
|
||||||
\&\fB\-\-version\fR: print the version of \fB\s-1UPX\s0\fR
|
\&\fB\-\-version\fR: print the version of \fBUPX\fR
|
||||||
.PP
|
.PP
|
||||||
\&\fB\-\-exact\fR: when compressing, require to be able to get a byte-identical file
|
\&\fB\-\-exact\fR: when compressing, require to be able to get a byte-identical file
|
||||||
after decompression with option \fB\-d\fR. [\s-1NOTE:\s0 this is work in progress and is
|
after decompression with option \fB\-d\fR. [NOTE: this is work in progress and is
|
||||||
not supported for all formats yet. If you do care, as a workaround you can
|
not supported for all formats yet. If you do care, as a workaround you can
|
||||||
compress and then decompress your program a first time \- any further
|
compress and then decompress your program a first time \- any further
|
||||||
compress-decompress steps should then yield byte-identical results
|
compress-decompress steps should then yield byte-identical results
|
||||||
@@ -255,16 +177,16 @@ as compared to the first decompressed version.]
|
|||||||
[ ...more docs need to be written... \- type `\fBupx \-\-help\fR' for now ]
|
[ ...more docs need to be written... \- type `\fBupx \-\-help\fR' for now ]
|
||||||
.SH "COMPRESSION LEVELS & TUNING"
|
.SH "COMPRESSION LEVELS & TUNING"
|
||||||
.IX Header "COMPRESSION LEVELS & TUNING"
|
.IX Header "COMPRESSION LEVELS & TUNING"
|
||||||
\&\fB\s-1UPX\s0\fR offers ten different compression levels from \fB\-1\fR to \fB\-9\fR,
|
\&\fBUPX\fR offers ten different compression levels from \fB\-1\fR to \fB\-9\fR,
|
||||||
and \fB\-\-best\fR. The default compression level is \fB\-8\fR for files
|
and \fB\-\-best\fR. The default compression level is \fB\-8\fR for files
|
||||||
smaller than 512 KiB, and \fB\-7\fR otherwise.
|
smaller than 512 KiB, and \fB\-7\fR otherwise.
|
||||||
.IP "\(bu" 4
|
.IP \(bu 4
|
||||||
Compression levels 1, 2 and 3 are pretty fast.
|
Compression levels 1, 2 and 3 are pretty fast.
|
||||||
.IP "\(bu" 4
|
.IP \(bu 4
|
||||||
Compression levels 4, 5 and 6 achieve a good time/ratio performance.
|
Compression levels 4, 5 and 6 achieve a good time/ratio performance.
|
||||||
.IP "\(bu" 4
|
.IP \(bu 4
|
||||||
Compression levels 7, 8 and 9 favor compression ratio over speed.
|
Compression levels 7, 8 and 9 favor compression ratio over speed.
|
||||||
.IP "\(bu" 4
|
.IP \(bu 4
|
||||||
Compression level \fB\-\-best\fR may take a long time.
|
Compression level \fB\-\-best\fR may take a long time.
|
||||||
.PP
|
.PP
|
||||||
Note that compression level \fB\-\-best\fR can be somewhat slow for large
|
Note that compression level \fB\-\-best\fR can be somewhat slow for large
|
||||||
@@ -272,28 +194,28 @@ files, but you definitely should use it when releasing a final version
|
|||||||
of your program.
|
of your program.
|
||||||
.PP
|
.PP
|
||||||
Quick info for achieving the best compression ratio:
|
Quick info for achieving the best compression ratio:
|
||||||
.IP "\(bu" 4
|
.IP \(bu 4
|
||||||
Try \fBupx \-\-brute \-\-no\-lzma myfile.exe\fR or even
|
Try \fBupx \-\-brute \-\-no\-lzma myfile.exe\fR or even
|
||||||
\&\fBupx \-\-ultra\-brute \-\-no\-lzma myfile.exe\fR.
|
\&\fBupx \-\-ultra\-brute \-\-no\-lzma myfile.exe\fR.
|
||||||
.IP "\(bu" 4
|
.IP \(bu 4
|
||||||
The option \fB\-\-lzma\fR enables \s-1LZMA\s0 compression, which compresses better but
|
The option \fB\-\-lzma\fR enables LZMA compression, which compresses better but
|
||||||
is *significantly slower* at decompression. You probably do not want
|
is *significantly slower* at decompression. You probably do not want
|
||||||
to use it for large files.
|
to use it for large files.
|
||||||
.Sp
|
.Sp
|
||||||
(Note that \fB\-\-lzma\fR is automatically enabled by \fB\-\-all\-methods\fR and
|
(Note that \fB\-\-lzma\fR is automatically enabled by \fB\-\-all\-methods\fR and
|
||||||
\&\fB\-\-brute\fR, use \fB\-\-no\-lzma\fR to override.)
|
\&\fB\-\-brute\fR, use \fB\-\-no\-lzma\fR to override.)
|
||||||
.IP "\(bu" 4
|
.IP \(bu 4
|
||||||
Try if \fB\-\-overlay=strip\fR works.
|
Try if \fB\-\-overlay=strip\fR works.
|
||||||
.IP "\(bu" 4
|
.IP \(bu 4
|
||||||
For win32/pe programs there's \fB\-\-strip\-relocs=0\fR. See notes below.
|
For win32/pe programs there's \fB\-\-strip\-relocs=0\fR. See notes below.
|
||||||
.SH "OVERLAY HANDLING OPTIONS"
|
.SH "OVERLAY HANDLING OPTIONS"
|
||||||
.IX Header "OVERLAY HANDLING OPTIONS"
|
.IX Header "OVERLAY HANDLING OPTIONS"
|
||||||
Info: An \*(L"overlay\*(R" means auxiliary data attached after the logical end of
|
Info: An "overlay" means auxiliary data attached after the logical end of
|
||||||
an executable, and it often contains application specific data
|
an executable, and it often contains application specific data
|
||||||
(this is a common practice to avoid an extra data file, though
|
(this is a common practice to avoid an extra data file, though
|
||||||
it would be better to use resource sections).
|
it would be better to use resource sections).
|
||||||
.PP
|
.PP
|
||||||
\&\fB\s-1UPX\s0\fR handles overlays like many other executable packers do: it simply
|
\&\fBUPX\fR handles overlays like many other executable packers do: it simply
|
||||||
copies the overlay after the compressed image. This works with some
|
copies the overlay after the compressed image. This works with some
|
||||||
files, but doesn't work with others, depending on how an application
|
files, but doesn't work with others, depending on how an application
|
||||||
actually accesses this overlaid data.
|
actually accesses this overlaid data.
|
||||||
@@ -309,8 +231,8 @@ actually accesses this overlaid data.
|
|||||||
.Ve
|
.Ve
|
||||||
.SH "ENVIRONMENT VARIABLE"
|
.SH "ENVIRONMENT VARIABLE"
|
||||||
.IX Header "ENVIRONMENT VARIABLE"
|
.IX Header "ENVIRONMENT VARIABLE"
|
||||||
The environment variable \fB\s-1UPX\s0\fR can hold a set of default
|
The environment variable \fBUPX\fR can hold a set of default
|
||||||
options for \fB\s-1UPX\s0\fR. These options are interpreted first and
|
options for \fBUPX\fR. These options are interpreted first and
|
||||||
can be overwritten by explicit command line parameters.
|
can be overwritten by explicit command line parameters.
|
||||||
For example:
|
For example:
|
||||||
.PP
|
.PP
|
||||||
@@ -321,18 +243,18 @@ For example:
|
|||||||
.Ve
|
.Ve
|
||||||
.PP
|
.PP
|
||||||
Under DOS/Windows you must use '#' instead of '=' when setting the
|
Under DOS/Windows you must use '#' instead of '=' when setting the
|
||||||
environment variable because of a \s-1COMMAND.COM\s0 limitation.
|
environment variable because of a COMMAND.COM limitation.
|
||||||
.PP
|
.PP
|
||||||
Not all of the options are valid in the environment variable \-
|
Not all of the options are valid in the environment variable \-
|
||||||
\&\fB\s-1UPX\s0\fR will tell you.
|
\&\fBUPX\fR will tell you.
|
||||||
.PP
|
.PP
|
||||||
You can explicitly use the \fB\-\-no\-env\fR option to ignore the
|
You can explicitly use the \fB\-\-no\-env\fR option to ignore the
|
||||||
environment variable.
|
environment variable.
|
||||||
.SH "NOTES FOR THE SUPPORTED EXECUTABLE FORMATS"
|
.SH "NOTES FOR THE SUPPORTED EXECUTABLE FORMATS"
|
||||||
.IX Header "NOTES FOR THE SUPPORTED EXECUTABLE FORMATS"
|
.IX Header "NOTES FOR THE SUPPORTED EXECUTABLE FORMATS"
|
||||||
.SS "\s-1NOTES FOR ATARI/TOS\s0"
|
.SS "NOTES FOR ATARI/TOS"
|
||||||
.IX Subsection "NOTES FOR ATARI/TOS"
|
.IX Subsection "NOTES FOR ATARI/TOS"
|
||||||
This is the executable format used by the Atari \s-1ST/TT,\s0 a Motorola 68000
|
This is the executable format used by the Atari ST/TT, a Motorola 68000
|
||||||
based personal computer which was popular in the late '80s. Support
|
based personal computer which was popular in the late '80s. Support
|
||||||
of this format is only because of nostalgic feelings of one of
|
of this format is only because of nostalgic feelings of one of
|
||||||
the authors and serves no practical purpose :\-).
|
the authors and serves no practical purpose :\-).
|
||||||
@@ -349,12 +271,12 @@ Extra options available for this executable format:
|
|||||||
\& the compression ratio in some cases, but usually
|
\& the compression ratio in some cases, but usually
|
||||||
\& the default method gives the best results anyway.
|
\& the default method gives the best results anyway.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR BVMLINUZ/I386\s0"
|
.SS "NOTES FOR BVMLINUZ/I386"
|
||||||
.IX Subsection "NOTES FOR BVMLINUZ/I386"
|
.IX Subsection "NOTES FOR BVMLINUZ/I386"
|
||||||
Same as vmlinuz/i386.
|
Same as vmlinuz/i386.
|
||||||
.SS "\s-1NOTES FOR DOS/COM\s0"
|
.SS "NOTES FOR DOS/COM"
|
||||||
.IX Subsection "NOTES FOR DOS/COM"
|
.IX Subsection "NOTES FOR DOS/COM"
|
||||||
Obviously \fB\s-1UPX\s0\fR won't work with executables that want to read data from
|
Obviously \fBUPX\fR won't work with executables that want to read data from
|
||||||
themselves (like some commandline utilities that ship with Win95/98/ME).
|
themselves (like some commandline utilities that ship with Win95/98/ME).
|
||||||
.PP
|
.PP
|
||||||
Compressed programs only work on a 286+.
|
Compressed programs only work on a 286+.
|
||||||
@@ -378,11 +300,11 @@ Extra options available for this executable format:
|
|||||||
\& the compression ratio in some cases, but usually
|
\& the compression ratio in some cases, but usually
|
||||||
\& the default filter gives the best results anyway.
|
\& the default filter gives the best results anyway.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR DOS/EXE\s0"
|
.SS "NOTES FOR DOS/EXE"
|
||||||
.IX Subsection "NOTES FOR DOS/EXE"
|
.IX Subsection "NOTES FOR DOS/EXE"
|
||||||
dos/exe stands for all \*(L"normal\*(R" 16\-bit \s-1DOS\s0 executables.
|
dos/exe stands for all "normal" 16\-bit DOS executables.
|
||||||
.PP
|
.PP
|
||||||
Obviously \fB\s-1UPX\s0\fR won't work with executables that want to read data from
|
Obviously \fBUPX\fR won't work with executables that want to read data from
|
||||||
themselves (like some command line utilities that ship with Win95/98/ME).
|
themselves (like some command line utilities that ship with Win95/98/ME).
|
||||||
.PP
|
.PP
|
||||||
Compressed programs only work on a 286+.
|
Compressed programs only work on a 286+.
|
||||||
@@ -399,7 +321,7 @@ Extra options available for this executable format:
|
|||||||
\& the compression ratio in some cases, but usually
|
\& the compression ratio in some cases, but usually
|
||||||
\& the default method gives the best results anyway.
|
\& the default method gives the best results anyway.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR DOS/SYS\s0"
|
.SS "NOTES FOR DOS/SYS"
|
||||||
.IX Subsection "NOTES FOR DOS/SYS"
|
.IX Subsection "NOTES FOR DOS/SYS"
|
||||||
Compressed programs only work on a 286+.
|
Compressed programs only work on a 286+.
|
||||||
.PP
|
.PP
|
||||||
@@ -422,20 +344,20 @@ Extra options available for this executable format:
|
|||||||
\& the compression ratio in some cases, but usually
|
\& the compression ratio in some cases, but usually
|
||||||
\& the default filter gives the best results anyway.
|
\& the default filter gives the best results anyway.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR DJGPP2/COFF\s0"
|
.SS "NOTES FOR DJGPP2/COFF"
|
||||||
.IX Subsection "NOTES FOR DJGPP2/COFF"
|
.IX Subsection "NOTES FOR DJGPP2/COFF"
|
||||||
First of all, it is recommended to use \fB\s-1UPX\s0\fR *instead* of \fBstrip\fR. strip has
|
First of all, it is recommended to use \fBUPX\fR *instead* of \fBstrip\fR. strip has
|
||||||
the very bad habit of replacing your stub with its own (outdated) version.
|
the very bad habit of replacing your stub with its own (outdated) version.
|
||||||
Additionally \fB\s-1UPX\s0\fR corrects a bug/feature in strip v2.8.x: it
|
Additionally \fBUPX\fR corrects a bug/feature in strip v2.8.x: it
|
||||||
will fix the 4 KiB alignment of the stub.
|
will fix the 4 KiB alignment of the stub.
|
||||||
.PP
|
.PP
|
||||||
\&\fB\s-1UPX\s0\fR includes the full functionality of stubify. This means it will
|
\&\fBUPX\fR includes the full functionality of stubify. This means it will
|
||||||
automatically stubify your \s-1COFF\s0 files. Use the option \fB\-\-coff\fR to
|
automatically stubify your COFF files. Use the option \fB\-\-coff\fR to
|
||||||
disable this functionality (see below).
|
disable this functionality (see below).
|
||||||
.PP
|
.PP
|
||||||
\&\fB\s-1UPX\s0\fR automatically handles Allegro packfiles.
|
\&\fBUPX\fR automatically handles Allegro packfiles.
|
||||||
.PP
|
.PP
|
||||||
The \s-1DLM\s0 format (a rather exotic shared library extension) is not supported.
|
The DLM format (a rather exotic shared library extension) is not supported.
|
||||||
.PP
|
.PP
|
||||||
Packed programs will be byte-identical to the original after uncompression.
|
Packed programs will be byte-identical to the original after uncompression.
|
||||||
All debug information and trailing garbage will be stripped, though.
|
All debug information and trailing garbage will be stripped, though.
|
||||||
@@ -456,7 +378,7 @@ Extra options available for this executable format:
|
|||||||
\& the compression ratio in some cases, but usually
|
\& the compression ratio in some cases, but usually
|
||||||
\& the default filter gives the best results anyway.
|
\& the default filter gives the best results anyway.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR LINUX\s0 [general]"
|
.SS "NOTES FOR LINUX [general]"
|
||||||
.IX Subsection "NOTES FOR LINUX [general]"
|
.IX Subsection "NOTES FOR LINUX [general]"
|
||||||
Introduction
|
Introduction
|
||||||
.PP
|
.PP
|
||||||
@@ -593,15 +515,15 @@ General notes:
|
|||||||
\& been modified after compression.
|
\& been modified after compression.
|
||||||
\& Running \`strace \-o strace.log compressed_file\*(Aq will tell you more.
|
\& Running \`strace \-o strace.log compressed_file\*(Aq will tell you more.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR LINUX/ELF386\s0"
|
.SS "NOTES FOR LINUX/ELF386"
|
||||||
.IX Subsection "NOTES FOR LINUX/ELF386"
|
.IX Subsection "NOTES FOR LINUX/ELF386"
|
||||||
Please read the general Linux description first.
|
Please read the general Linux description first.
|
||||||
.PP
|
.PP
|
||||||
The linux/elf386 format decompresses directly into \s-1RAM,\s0
|
The linux/elf386 format decompresses directly into RAM,
|
||||||
uses only one exec, does not use space in /tmp,
|
uses only one exec, does not use space in /tmp,
|
||||||
and does not use /proc.
|
and does not use /proc.
|
||||||
.PP
|
.PP
|
||||||
Linux/elf386 is automatically selected for Linux \s-1ELF\s0 executables.
|
Linux/elf386 is automatically selected for Linux ELF executables.
|
||||||
.PP
|
.PP
|
||||||
Packed programs will be byte-identical to the original after uncompression.
|
Packed programs will be byte-identical to the original after uncompression.
|
||||||
.PP
|
.PP
|
||||||
@@ -641,12 +563,12 @@ Extra options available for this executable format:
|
|||||||
.Vb 1
|
.Vb 1
|
||||||
\& (none)
|
\& (none)
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR LINUX/SH386\s0"
|
.SS "NOTES FOR LINUX/SH386"
|
||||||
.IX Subsection "NOTES FOR LINUX/SH386"
|
.IX Subsection "NOTES FOR LINUX/SH386"
|
||||||
Please read the general Linux description first.
|
Please read the general Linux description first.
|
||||||
.PP
|
.PP
|
||||||
Shell scripts where the underling shell accepts a ``\-c'' argument
|
Shell scripts where the underling shell accepts a ``\-c'' argument
|
||||||
can use the Linux/sh386 format. \fB\s-1UPX\s0\fR decompresses the shell script
|
can use the Linux/sh386 format. \fBUPX\fR decompresses the shell script
|
||||||
into low memory, then maps the shell and passes the entire text of the
|
into low memory, then maps the shell and passes the entire text of the
|
||||||
script as an argument with a leading ``\-c''.
|
script as an argument with a leading ``\-c''.
|
||||||
It does not use space in /tmp, and does not use /proc.
|
It does not use space in /tmp, and does not use /proc.
|
||||||
@@ -691,7 +613,7 @@ Extra options available for this executable format:
|
|||||||
.Vb 1
|
.Vb 1
|
||||||
\& (none)
|
\& (none)
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR LINUX/386\s0"
|
.SS "NOTES FOR LINUX/386"
|
||||||
.IX Subsection "NOTES FOR LINUX/386"
|
.IX Subsection "NOTES FOR LINUX/386"
|
||||||
Please read the general Linux description first.
|
Please read the general Linux description first.
|
||||||
.PP
|
.PP
|
||||||
@@ -764,10 +686,10 @@ Extra options available for this executable format:
|
|||||||
\& format, i.e. do not try the linux/elf386 and
|
\& format, i.e. do not try the linux/elf386 and
|
||||||
\& linux/sh386 formats.
|
\& linux/sh386 formats.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR PS1/EXE\s0"
|
.SS "NOTES FOR PS1/EXE"
|
||||||
.IX Subsection "NOTES FOR PS1/EXE"
|
.IX Subsection "NOTES FOR PS1/EXE"
|
||||||
This is the executable format used by the Sony PlayStation (PSone),
|
This is the executable format used by the Sony PlayStation (PSone),
|
||||||
a \s-1MIPS R3000\s0 based gaming console which is popular since the late '90s.
|
a MIPS R3000 based gaming console which is popular since the late '90s.
|
||||||
Support of this format is very similar to the Atari one, because of
|
Support of this format is very similar to the Atari one, because of
|
||||||
nostalgic feelings of one of the authors.
|
nostalgic feelings of one of the authors.
|
||||||
.PP
|
.PP
|
||||||
@@ -816,12 +738,12 @@ Extra options available for this executable format:
|
|||||||
\& but the compressed executable will not boot from a CD.
|
\& but the compressed executable will not boot from a CD.
|
||||||
\& Use it for console transfer only !
|
\& Use it for console transfer only !
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR RTM32/PE\s0 and \s-1ARM/PE\s0"
|
.SS "NOTES FOR RTM32/PE and ARM/PE"
|
||||||
.IX Subsection "NOTES FOR RTM32/PE and ARM/PE"
|
.IX Subsection "NOTES FOR RTM32/PE and ARM/PE"
|
||||||
Same as win32/pe.
|
Same as win32/pe.
|
||||||
.SS "\s-1NOTES FOR TMT/ADAM\s0"
|
.SS "NOTES FOR TMT/ADAM"
|
||||||
.IX Subsection "NOTES FOR TMT/ADAM"
|
.IX Subsection "NOTES FOR TMT/ADAM"
|
||||||
This format is used by the \s-1TMT\s0 Pascal compiler \- see http://www.tmt.com/ .
|
This format is used by the TMT Pascal compiler \- see http://www.tmt.com/ .
|
||||||
.PP
|
.PP
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
.PP
|
.PP
|
||||||
@@ -836,11 +758,11 @@ Extra options available for this executable format:
|
|||||||
\& the compression ratio in some cases, but usually
|
\& the compression ratio in some cases, but usually
|
||||||
\& the default filter gives the best results anyway.
|
\& the default filter gives the best results anyway.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR VMLINUZ/386\s0"
|
.SS "NOTES FOR VMLINUZ/386"
|
||||||
.IX Subsection "NOTES FOR VMLINUZ/386"
|
.IX Subsection "NOTES FOR VMLINUZ/386"
|
||||||
The vmlinuz/386 and bvmlinuz/386 formats take a gzip-compressed
|
The vmlinuz/386 and bvmlinuz/386 formats take a gzip-compressed
|
||||||
bootable Linux kernel image (\*(L"vmlinuz\*(R", \*(L"zImage\*(R", \*(L"bzImage\*(R"),
|
bootable Linux kernel image ("vmlinuz", "zImage", "bzImage"),
|
||||||
gzip-decompress it and re-compress it with the \fB\s-1UPX\s0\fR compression method.
|
gzip-decompress it and re-compress it with the \fBUPX\fR compression method.
|
||||||
.PP
|
.PP
|
||||||
vmlinuz/386 is completely unrelated to the other Linux executable
|
vmlinuz/386 is completely unrelated to the other Linux executable
|
||||||
formats, and it does not share any of their drawbacks.
|
formats, and it does not share any of their drawbacks.
|
||||||
@@ -889,14 +811,14 @@ Extra options available for this executable format:
|
|||||||
\& the compression ratio in some cases, but usually
|
\& the compression ratio in some cases, but usually
|
||||||
\& the default filter gives the best results anyway.
|
\& the default filter gives the best results anyway.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR WATCOM/LE\s0"
|
.SS "NOTES FOR WATCOM/LE"
|
||||||
.IX Subsection "NOTES FOR WATCOM/LE"
|
.IX Subsection "NOTES FOR WATCOM/LE"
|
||||||
\&\fB\s-1UPX\s0\fR has been successfully tested with the following extenders:
|
\&\fBUPX\fR has been successfully tested with the following extenders:
|
||||||
\s-1DOS4G, DOS4GW, PMODE/W,\s0 DOS32a, CauseWay.
|
DOS4G, DOS4GW, PMODE/W, DOS32a, CauseWay.
|
||||||
The \s-1WDOS/X\s0 extender is partly supported (for details
|
The WDOS/X extender is partly supported (for details
|
||||||
see the file bugs \s-1BUGS\s0).
|
see the file bugs BUGS).
|
||||||
.PP
|
.PP
|
||||||
DLLs and the \s-1LX\s0 format are not supported.
|
DLLs and the LX format are not supported.
|
||||||
.PP
|
.PP
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
.PP
|
.PP
|
||||||
@@ -904,12 +826,12 @@ Extra options available for this executable format:
|
|||||||
\& \-\-le Produce an unbound LE output instead of
|
\& \-\-le Produce an unbound LE output instead of
|
||||||
\& keeping the current stub.
|
\& keeping the current stub.
|
||||||
.Ve
|
.Ve
|
||||||
.SS "\s-1NOTES FOR WIN32/PE\s0"
|
.SS "NOTES FOR WIN32/PE"
|
||||||
.IX Subsection "NOTES FOR WIN32/PE"
|
.IX Subsection "NOTES FOR WIN32/PE"
|
||||||
The \s-1PE\s0 support in \fB\s-1UPX\s0\fR is quite stable now, but probably there are
|
The PE support in \fBUPX\fR is quite stable now, but probably there are
|
||||||
still some incompatibilities with some files.
|
still some incompatibilities with some files.
|
||||||
.PP
|
.PP
|
||||||
Because of the way \fB\s-1UPX\s0\fR (and other packers for this format) works, you
|
Because of the way \fBUPX\fR (and other packers for this format) works, you
|
||||||
can see increased memory usage of your compressed files because the whole
|
can see increased memory usage of your compressed files because the whole
|
||||||
program is loaded into memory at startup.
|
program is loaded into memory at startup.
|
||||||
If you start several instances of huge compressed programs you're
|
If you start several instances of huge compressed programs you're
|
||||||
@@ -922,17 +844,17 @@ smaller, but it's still there.
|
|||||||
If you're running executables from network, then compressed programs
|
If you're running executables from network, then compressed programs
|
||||||
will load faster, and require less bandwidth during execution.
|
will load faster, and require less bandwidth during execution.
|
||||||
.PP
|
.PP
|
||||||
DLLs are supported. But \s-1UPX\s0 compressed DLLs can not share common data and
|
DLLs are supported. But UPX compressed DLLs can not share common data and
|
||||||
code when they got used by multiple applications. So compressing msvcrt.dll
|
code when they got used by multiple applications. So compressing msvcrt.dll
|
||||||
is a waste of memory, but compressing the dll plugins of a particular
|
is a waste of memory, but compressing the dll plugins of a particular
|
||||||
application may be a better idea.
|
application may be a better idea.
|
||||||
.PP
|
.PP
|
||||||
Screensavers are supported, with the restriction that the filename
|
Screensavers are supported, with the restriction that the filename
|
||||||
must end with \*(L".scr\*(R" (as screensavers are handled slightly different
|
must end with ".scr" (as screensavers are handled slightly different
|
||||||
than normal exe files).
|
than normal exe files).
|
||||||
.PP
|
.PP
|
||||||
\&\s-1UPX\s0 compressed \s-1PE\s0 files have some minor memory overhead (usually in the
|
UPX compressed PE files have some minor memory overhead (usually in the
|
||||||
10 \- 30 KiB range) which can be seen by specifying the \*(L"\-i\*(R" command
|
10 \- 30 KiB range) which can be seen by specifying the "\-i" command
|
||||||
line switch during compression.
|
line switch during compression.
|
||||||
.PP
|
.PP
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
@@ -996,16 +918,16 @@ Extra options available for this executable format:
|
|||||||
\& the compression ratio in some cases, but usually
|
\& the compression ratio in some cases, but usually
|
||||||
\& the default filter gives the best results anyway.
|
\& the default filter gives the best results anyway.
|
||||||
.Ve
|
.Ve
|
||||||
.SH "DIAGNOSTICS"
|
.SH DIAGNOSTICS
|
||||||
.IX Header "DIAGNOSTICS"
|
.IX Header "DIAGNOSTICS"
|
||||||
Exit status is normally 0; if an error occurs, exit status
|
Exit status is normally 0; if an error occurs, exit status
|
||||||
is 1. If a warning occurs, exit status is 2.
|
is 1. If a warning occurs, exit status is 2.
|
||||||
.PP
|
.PP
|
||||||
\&\fB\s-1UPX\s0\fR's diagnostics are intended to be self-explanatory.
|
\&\fBUPX\fR's diagnostics are intended to be self-explanatory.
|
||||||
.SH "BUGS"
|
.SH BUGS
|
||||||
.IX Header "BUGS"
|
.IX Header "BUGS"
|
||||||
Please report all bugs immediately to the authors.
|
Please report all bugs immediately to the authors.
|
||||||
.SH "AUTHORS"
|
.SH AUTHORS
|
||||||
.IX Header "AUTHORS"
|
.IX Header "AUTHORS"
|
||||||
.Vb 2
|
.Vb 2
|
||||||
\& Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
\& Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||||
@@ -1014,29 +936,25 @@ Please report all bugs immediately to the authors.
|
|||||||
\& Laszlo Molnar <ezerotven+github@gmail.com>
|
\& Laszlo Molnar <ezerotven+github@gmail.com>
|
||||||
\&
|
\&
|
||||||
\& John F. Reiser <jreiser@BitWagon.com>
|
\& John F. Reiser <jreiser@BitWagon.com>
|
||||||
\&
|
|
||||||
\& Jens Medoch <jssg@users.sourceforge.net>
|
|
||||||
.Ve
|
.Ve
|
||||||
.SH "COPYRIGHT"
|
.SH COPYRIGHT
|
||||||
.IX Header "COPYRIGHT"
|
.IX Header "COPYRIGHT"
|
||||||
Copyright (C) 1996\-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996\-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
.PP
|
.PP
|
||||||
Copyright (C) 1996\-2024 Laszlo Molnar
|
Copyright (C) 1996\-2025 Laszlo Molnar
|
||||||
.PP
|
.PP
|
||||||
Copyright (C) 2000\-2024 John F. Reiser
|
Copyright (C) 2000\-2025 John F. Reiser
|
||||||
.PP
|
.PP
|
||||||
Copyright (C) 2002\-2024 Jens Medoch
|
\&\fBUPX\fR is distributed with full source code under the terms of the
|
||||||
.PP
|
GNU General Public License v2+; either under the pure GPLv2+ (see
|
||||||
\&\fB\s-1UPX\s0\fR is distributed with full source code under the terms of the
|
the file COPYING), or (at your option) under the GPLv+2 with special
|
||||||
\&\s-1GNU\s0 General Public License v2+; either under the pure GPLv2+ (see
|
|
||||||
the file \s-1COPYING\s0), or (at your option) under the GPLv+2 with special
|
|
||||||
exceptions and restrictions granting the free usage for all binaries
|
exceptions and restrictions granting the free usage for all binaries
|
||||||
including commercial programs (see the file \s-1LICENSE\s0).
|
including commercial programs (see the file LICENSE).
|
||||||
.PP
|
.PP
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
.PP
|
.PP
|
||||||
You should have received a copy of the \s-1UPX\s0 License Agreements along
|
You should have received a copy of the UPX License Agreements along
|
||||||
with this program; see the files \s-1COPYING\s0 and \s-1LICENSE.\s0 If not,
|
with this program; see the files COPYING and LICENSE. If not,
|
||||||
visit the \s-1UPX\s0 home page.
|
visit the UPX home page.
|
||||||
|
|||||||
+4
-8
@@ -13,7 +13,7 @@ B<upx> S<[ I<command> ]> S<[ I<options> ]> I<filename>...
|
|||||||
=head1 ABSTRACT
|
=head1 ABSTRACT
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2024 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2025 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
https://upx.github.io
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
@@ -926,19 +926,15 @@ Please report all bugs immediately to the authors.
|
|||||||
|
|
||||||
John F. Reiser <jreiser@BitWagon.com>
|
John F. Reiser <jreiser@BitWagon.com>
|
||||||
|
|
||||||
Jens Medoch <jssg@users.sourceforge.net>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=head1 COPYRIGHT
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
|
|
||||||
Copyright (C) 2000-2024 John F. Reiser
|
Copyright (C) 2000-2025 John F. Reiser
|
||||||
|
|
||||||
Copyright (C) 2002-2024 Jens Medoch
|
|
||||||
|
|
||||||
B<UPX> is distributed with full source code under the terms of the
|
B<UPX> is distributed with full source code under the terms of the
|
||||||
GNU General Public License v2+; either under the pure GPLv2+ (see
|
GNU General Public License v2+; either under the pure GPLv2+ (see
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# vim:set ft=yaml ts=2 sw=2 et:
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
# for clang-tidy from https://clang.llvm.org/extra/clang-tidy/
|
# for clang-tidy from https://clang.llvm.org/extra/clang-tidy/
|
||||||
---
|
---
|
||||||
Checks: >
|
Checks: >
|
||||||
@@ -14,7 +16,7 @@ Checks: >
|
|||||||
-clang-analyzer-core.UndefinedBinaryOperatorResult,
|
-clang-analyzer-core.UndefinedBinaryOperatorResult,
|
||||||
-clang-analyzer-core.uninitialized.Assign,
|
-clang-analyzer-core.uninitialized.Assign,
|
||||||
-clang-analyzer-security.insecureAPI.strcpy,
|
-clang-analyzer-security.insecureAPI.strcpy,
|
||||||
clang-diagnostics-*',
|
clang-diagnostic-*,
|
||||||
performance-*,
|
performance-*,
|
||||||
FormatStyle: file
|
FormatStyle: file
|
||||||
HeaderFilterRegex: '.*'
|
HeaderFilterRegex: '.*'
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
|
# vim:set ft=yaml ts=2 sw=2 et:
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
# for clang-tidy from https://clang.llvm.org/extra/clang-tidy/
|
# for clang-tidy from https://clang.llvm.org/extra/clang-tidy/
|
||||||
---
|
---
|
||||||
Checks: >
|
Checks: >
|
||||||
-*,
|
-*,
|
||||||
bugprone-*,
|
bugprone-*,
|
||||||
-bugprone-assignment-in-if-condition,
|
-bugprone-assignment-in-if-condition,
|
||||||
|
-bugprone-casting-through-void,
|
||||||
-bugprone-easily-swappable-parameters,
|
-bugprone-easily-swappable-parameters,
|
||||||
-bugprone-implicit-widening-of-multiplication-result,
|
-bugprone-implicit-widening-of-multiplication-result,
|
||||||
|
-bugprone-inc-dec-in-conditions,
|
||||||
-bugprone-macro-parentheses,
|
-bugprone-macro-parentheses,
|
||||||
-bugprone-reserved-identifier,
|
-bugprone-reserved-identifier,
|
||||||
-bugprone-sizeof-expression,
|
-bugprone-sizeof-expression,
|
||||||
-bugprone-suspicious-include,
|
-bugprone-suspicious-include,
|
||||||
clang-analyzer-*,
|
clang-analyzer-*,
|
||||||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
||||||
clang-diagnostics-*',
|
clang-diagnostic-*,
|
||||||
performance-*,
|
performance-*,
|
||||||
FormatStyle: file
|
FormatStyle: file
|
||||||
HeaderFilterRegex: '.*'
|
HeaderFilterRegex: '.*'
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# vim:set ft=yaml ts=2 sw=2 et:
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
# for clang-tidy from https://clang.llvm.org/extra/clang-tidy/
|
# for clang-tidy from https://clang.llvm.org/extra/clang-tidy/
|
||||||
---
|
---
|
||||||
Checks: >
|
Checks: >
|
||||||
@@ -6,6 +8,7 @@ Checks: >
|
|||||||
-bugprone-assignment-in-if-condition,
|
-bugprone-assignment-in-if-condition,
|
||||||
-bugprone-easily-swappable-parameters,
|
-bugprone-easily-swappable-parameters,
|
||||||
-bugprone-implicit-widening-of-multiplication-result,
|
-bugprone-implicit-widening-of-multiplication-result,
|
||||||
|
-bugprone-inc-dec-in-conditions,
|
||||||
-bugprone-macro-parentheses,
|
-bugprone-macro-parentheses,
|
||||||
-bugprone-narrowing-conversions,
|
-bugprone-narrowing-conversions,
|
||||||
-bugprone-reserved-identifier,
|
-bugprone-reserved-identifier,
|
||||||
@@ -13,7 +16,7 @@ Checks: >
|
|||||||
clang-analyzer-*,
|
clang-analyzer-*,
|
||||||
-clang-analyzer-optin.performance.Padding,
|
-clang-analyzer-optin.performance.Padding,
|
||||||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
||||||
clang-diagnostics-*',
|
clang-diagnostic-*,
|
||||||
performance-*,
|
performance-*,
|
||||||
FormatStyle: file
|
FormatStyle: file
|
||||||
HeaderFilterRegex: '.*'
|
HeaderFilterRegex: '.*'
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# vim:set ft=yaml ts=2 sw=2 et:
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
# for clang-tidy from https://clang.llvm.org/extra/clang-tidy/
|
# for clang-tidy from https://clang.llvm.org/extra/clang-tidy/
|
||||||
---
|
---
|
||||||
Checks: >
|
Checks: >
|
||||||
@@ -5,6 +7,7 @@ Checks: >
|
|||||||
bugprone-*,
|
bugprone-*,
|
||||||
-bugprone-assignment-in-if-condition,
|
-bugprone-assignment-in-if-condition,
|
||||||
-bugprone-branch-clone,
|
-bugprone-branch-clone,
|
||||||
|
-bugprone-casting-through-void,
|
||||||
-bugprone-easily-swappable-parameters,
|
-bugprone-easily-swappable-parameters,
|
||||||
-bugprone-implicit-widening-of-multiplication-result,
|
-bugprone-implicit-widening-of-multiplication-result,
|
||||||
-bugprone-macro-parentheses,
|
-bugprone-macro-parentheses,
|
||||||
@@ -16,7 +19,7 @@ Checks: >
|
|||||||
-clang-analyzer-core.UndefinedBinaryOperatorResult,
|
-clang-analyzer-core.UndefinedBinaryOperatorResult,
|
||||||
-clang-analyzer-deadcode.DeadStores,
|
-clang-analyzer-deadcode.DeadStores,
|
||||||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
||||||
clang-diagnostics-*',
|
clang-diagnostic-*,
|
||||||
performance-*,
|
performance-*,
|
||||||
-performance-no-int-to-ptr,
|
-performance-no-int-to-ptr,
|
||||||
FormatStyle: file
|
FormatStyle: file
|
||||||
|
|||||||
+158
-19
@@ -3,6 +3,15 @@
|
|||||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# set USE_STRICT_DEFAULTS
|
||||||
|
if(NOT DEFINED USE_STRICT_DEFAULTS AND IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||||
|
include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/use_strict_defaults.cmake" OPTIONAL)
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED USE_STRICT_DEFAULTS)
|
||||||
|
# use permissive config defaults when building from source code tarball
|
||||||
|
set(USE_STRICT_DEFAULTS FALSE CACHE INTERNAL "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# macros
|
# macros
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
@@ -26,16 +35,35 @@ macro(upx_disallow_in_source_build)
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# set the default build type; must be called before project() cmake init
|
# ternary conditional operator
|
||||||
|
macro(upx_ternary result_var_name condition true_value false_value)
|
||||||
|
if(${condition})
|
||||||
|
set(${result_var_name} "${true_value}")
|
||||||
|
else()
|
||||||
|
set(${result_var_name} "${false_value}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# set the default build type; must be called BEFORE project() cmake init
|
||||||
macro(upx_set_default_build_type type)
|
macro(upx_set_default_build_type type)
|
||||||
set(upx_global_default_build_type "${type}")
|
set(upx_global_default_build_type "${type}")
|
||||||
get_property(upx_global_is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
get_property(upx_global_is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
if(NOT upx_global_is_multi_config AND NOT CMAKE_BUILD_TYPE)
|
if(NOT upx_global_is_multi_config AND NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE "${upx_global_default_build_type}" CACHE STRING "Choose the type of build." FORCE)
|
set(CMAKE_BUILD_TYPE "${upx_global_default_build_type}" CACHE STRING "Choose the type of build." FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
# also enable some global settings by default
|
||||||
|
if(NOT DEFINED CMAKE_C_STANDARD_REQUIRED)
|
||||||
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# set the default multi-config build type; must be called after project() cmake init
|
# set the default multi-config build type; must be called AFTER project() cmake init
|
||||||
macro(upx_apply_build_type)
|
macro(upx_apply_build_type)
|
||||||
if(upx_global_is_multi_config)
|
if(upx_global_is_multi_config)
|
||||||
set(c "${CMAKE_CONFIGURATION_TYPES}")
|
set(c "${CMAKE_CONFIGURATION_TYPES}")
|
||||||
@@ -56,10 +84,68 @@ macro(upx_apply_build_type)
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# set MINGW, MSVC_FRONTEND, GNU_FRONTEND and MSVC_SIMULATE
|
||||||
|
macro(upx_set_global_vars)
|
||||||
|
if(NOT DEFINED MINGW AND CMAKE_C_PLATFORM_ID MATCHES "^MinGW")
|
||||||
|
set(MINGW 1)
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED MSVC_FRONTEND AND (MSVC OR CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC"))
|
||||||
|
set(MSVC_FRONTEND 1)
|
||||||
|
elseif(NOT DEFINED GNU_FRONTEND AND (CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "^GNU" OR CMAKE_C_COMPILER_ID MATCHES "(Clang|GNU|LLVM)"))
|
||||||
|
set(GNU_FRONTEND 1)
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED MSVC_SIMULATE AND (CMAKE_C_SIMULATE_ID MATCHES "^MSVC"))
|
||||||
|
set(MSVC_SIMULATE 1)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# useful for CI jobs: check for working BUILD_RPATH
|
||||||
|
macro(upx_check_working_build_rpath var_name)
|
||||||
|
if(WIN32 OR MINGW OR CYGWIN)
|
||||||
|
# always works; DLLs reside next to the executables
|
||||||
|
set(${var_name} ON)
|
||||||
|
upx_cache_bool_vars(ON ${var_name})
|
||||||
|
elseif(CMAKE_BUILD_WITH_INSTALL_RPATH OR CMAKE_SKIP_RPATH OR CMAKE_SKIP_BUILD_RPATH)
|
||||||
|
# cannot work; BUILD_RPATH is disabled by global CMake settings
|
||||||
|
set(${var_name} OFF)
|
||||||
|
upx_cache_bool_vars(OFF ${var_name})
|
||||||
|
else()
|
||||||
|
# we do not know if/how the BUILD_RPATH is set; be cautious by default
|
||||||
|
upx_cache_bool_vars(OFF ${var_name})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# util
|
# util
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
|
# convert to CMake bool
|
||||||
|
function(upx_make_bool_var result_var_name var_name default_value)
|
||||||
|
set(result "${default_value}")
|
||||||
|
# only query $var_name if it is defined and not empty
|
||||||
|
if(NOT ",${var_name}," STREQUAL ",,")
|
||||||
|
if(DEFINED ${var_name})
|
||||||
|
if(NOT ",${${var_name}}," STREQUAL ",,")
|
||||||
|
set(result "${${var_name}}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(${result})
|
||||||
|
set(result ON)
|
||||||
|
else()
|
||||||
|
set(result OFF)
|
||||||
|
endif()
|
||||||
|
set(${result_var_name} "${result}" PARENT_SCOPE) # return value
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(upx_maybe_unused_var) # ARGV
|
||||||
|
foreach(var_name ${ARGV})
|
||||||
|
if(DEFINED ${var_name})
|
||||||
|
set(dummy "${${var_name}}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
function(upx_print_var) # ARGV
|
function(upx_print_var) # ARGV
|
||||||
foreach(var_name ${ARGV})
|
foreach(var_name ${ARGV})
|
||||||
if(DEFINED ${var_name})
|
if(DEFINED ${var_name})
|
||||||
@@ -76,20 +162,29 @@ function(upx_print_env_var) # ARGV
|
|||||||
foreach(var_name ${ARGV})
|
foreach(var_name ${ARGV})
|
||||||
if(DEFINED ENV{${var_name}})
|
if(DEFINED ENV{${var_name}})
|
||||||
if(NOT ",$ENV{${var_name}}," STREQUAL ",,")
|
if(NOT ",$ENV{${var_name}}," STREQUAL ",,")
|
||||||
message(STATUS "ENV{${var_name}} = $ENV{${var_name}}")
|
message(STATUS "ENV{${var_name}} = '$ENV{${var_name}}'")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(upx_print_have_symbol) # ARGV; needs include(CheckSymbolExists)
|
function(upx_print_have_symbol) # ARGV; needs include(CheckSymbolExists)
|
||||||
|
set(rq "${CMAKE_REQUIRED_QUIET}")
|
||||||
|
set(CMAKE_REQUIRED_QUIET ON)
|
||||||
foreach(symbol ${ARGV})
|
foreach(symbol ${ARGV})
|
||||||
set(cache_var_name "HAVE_symbol_${symbol}")
|
set(cache_var_name "HAVE_symbol_${symbol}")
|
||||||
check_symbol_exists(${symbol} "limits.h;stddef.h;stdint.h" ${cache_var_name})
|
check_symbol_exists("${symbol}" "limits.h;stddef.h;stdint.h" "${cache_var_name}")
|
||||||
if(${cache_var_name})
|
if(${cache_var_name})
|
||||||
message(STATUS "HAVE ${symbol}")
|
message(STATUS "HAVE_symbol ${symbol}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
set(CMAKE_REQUIRED_QUIET "${rq}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# examine compiler configuration
|
||||||
|
function(upx_print_common_symbols)
|
||||||
|
upx_print_have_symbol(__FAST_MATH__)
|
||||||
|
upx_print_have_symbol(__PIC__ __pic__ __PIE__ __pie__)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# examine MinGW/Cygwin compiler configuration
|
# examine MinGW/Cygwin compiler configuration
|
||||||
@@ -97,7 +192,7 @@ function(upx_print_mingw_symbols)
|
|||||||
if(WIN32 OR MINGW OR CYGWIN)
|
if(WIN32 OR MINGW OR CYGWIN)
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "(Clang|GNU)")
|
if(CMAKE_C_COMPILER_ID MATCHES "(Clang|GNU)")
|
||||||
# runtime library: msvcrt vs ucrt vs cygwin
|
# runtime library: msvcrt vs ucrt vs cygwin
|
||||||
upx_print_have_symbol(__CRTDLL__ __CYGWIN__ __CYGWIN32__ __CYGWIN64__ __MINGW32__ __MINGW64__ __MINGW64_VERSION_MAJOR __MSVCRT__ __MSVCRT_VERSION__ _UCRT _WIN32 _WIN64)
|
upx_print_have_symbol(__CRTDLL__ __CYGWIN__ __CYGWIN32__ __CYGWIN64__ __MINGW32__ __MINGW64__ __MINGW64_VERSION_MAJOR __MSVCRT__ __MSVCRT_VERSION__ _UCRT _WIN32 _WIN32_WINNT _WIN64)
|
||||||
# exception handing: SJLJ (setjmp/longjmp) vs DWARF vs SEH
|
# exception handing: SJLJ (setjmp/longjmp) vs DWARF vs SEH
|
||||||
upx_print_have_symbol(__GCC_HAVE_DWARF2_CFI_ASM __SEH__ __USING_SJLJ_EXCEPTIONS__)
|
upx_print_have_symbol(__GCC_HAVE_DWARF2_CFI_ASM __SEH__ __USING_SJLJ_EXCEPTIONS__)
|
||||||
# threads: win32 vs posix/pthread/winpthreads vs mcfgthread
|
# threads: win32 vs posix/pthread/winpthreads vs mcfgthread
|
||||||
@@ -110,7 +205,11 @@ endfunction()
|
|||||||
function(upx_add_glob_files) # ARGV
|
function(upx_add_glob_files) # ARGV
|
||||||
set(var_name ${ARGV0})
|
set(var_name ${ARGV0})
|
||||||
list(REMOVE_AT ARGV 0)
|
list(REMOVE_AT ARGV 0)
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS "3.3")
|
||||||
file(GLOB files ${ARGV})
|
file(GLOB files ${ARGV})
|
||||||
|
else()
|
||||||
|
file(GLOB files LIST_DIRECTORIES false ${ARGV})
|
||||||
|
endif()
|
||||||
set(result "")
|
set(result "")
|
||||||
if(DEFINED ${var_name})
|
if(DEFINED ${var_name})
|
||||||
set(result "${${var_name}}")
|
set(result "${${var_name}}")
|
||||||
@@ -151,7 +250,7 @@ function(upx_cache_bool_vars) # ARGV
|
|||||||
elseif(DEFINED ${var_name}) # defined via "cmake -DXXX=YYY"
|
elseif(DEFINED ${var_name}) # defined via "cmake -DXXX=YYY"
|
||||||
set(value "${${var_name}}")
|
set(value "${${var_name}}")
|
||||||
elseif(DEFINED ENV{${var_name}}) # check environment
|
elseif(DEFINED ENV{${var_name}}) # check environment
|
||||||
if("$ENV{${var_name}}" MATCHES "^(0|1|OFF|ON|FALSE|TRUE)$")
|
if("$ENV{${var_name}}" MATCHES "^(0|1|OFF|ON|FALSE|TRUE|off|on|false|true)$")
|
||||||
set(value "$ENV{${var_name}}")
|
set(value "$ENV{${var_name}}")
|
||||||
set(UPX_CACHE_ORIGIN_FROM_ENV_${var_name} TRUE CACHE INTERNAL "" FORCE) # for status message below
|
set(UPX_CACHE_ORIGIN_FROM_ENV_${var_name} TRUE CACHE INTERNAL "" FORCE) # for status message below
|
||||||
endif()
|
endif()
|
||||||
@@ -183,13 +282,21 @@ function(upx_platform_check_mismatch var_name_1 var_name_2)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# check for incompatible C vs CXX settings
|
||||||
|
function(upx_platform_check_c_cxx_mismatch)
|
||||||
|
upx_platform_check_mismatch(CMAKE_C_PLATFORM_ID CMAKE_CXX_PLATFORM_ID)
|
||||||
|
upx_platform_check_mismatch(CMAKE_C_SIMULATE_ID CMAKE_CXX_SIMULATE_ID)
|
||||||
|
upx_platform_check_mismatch(CMAKE_C_COMPILER_ABI CMAKE_CXX_COMPILER_ABI)
|
||||||
|
upx_platform_check_mismatch(CMAKE_C_COMPILER_FRONTEND_VARIANT CMAKE_CXX_COMPILER_FRONTEND_VARIANT)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# compilation flags
|
# compilation flags
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
function(upx_internal_add_definitions_with_prefix) # ARGV; needs include(CheckCCompilerFlag)
|
function(upx_internal_add_definitions_with_prefix) # ARGV; needs include(CheckCCompilerFlag)
|
||||||
set(flag_prefix "${ARGV0}")
|
set(flag_prefix "${ARGV0}")
|
||||||
if(flag_prefix MATCHES "^empty$") # need "empty" to work around bug in old CMake versions
|
if("${flag_prefix}" MATCHES "^empty$") # need "empty" to work around bug in old CMake versions
|
||||||
set(flag_prefix "")
|
set(flag_prefix "")
|
||||||
endif()
|
endif()
|
||||||
list(REMOVE_AT ARGV 0)
|
list(REMOVE_AT ARGV 0)
|
||||||
@@ -270,7 +377,7 @@ function(upx_compile_source_debug_with_O2) # ARGV
|
|||||||
# MSVC uses some Debug compilation options like -RTC1 that are incompatible with -O2
|
# MSVC uses some Debug compilation options like -RTC1 that are incompatible with -O2
|
||||||
else()
|
else()
|
||||||
get_source_file_property(prop "${source}" COMPILE_FLAGS)
|
get_source_file_property(prop "${source}" COMPILE_FLAGS)
|
||||||
if(prop MATCHES "^(NOTFOUND)?$")
|
if("${prop}" MATCHES "^(NOTFOUND)?$")
|
||||||
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
|
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
|
||||||
else()
|
else()
|
||||||
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${prop} ${flags}")
|
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${prop} ${flags}")
|
||||||
@@ -281,23 +388,44 @@ endfunction()
|
|||||||
|
|
||||||
# sanitize a target; note that this may require special run-time support libs from your toolchain
|
# sanitize a target; note that this may require special run-time support libs from your toolchain
|
||||||
function(upx_sanitize_target) # ARGV
|
function(upx_sanitize_target) # ARGV
|
||||||
|
if(NOT DEFINED UPX_CONFIG_SANITIZE_FLAGS_DEBUG)
|
||||||
|
# default sanitizer for Debug builds
|
||||||
|
set(UPX_CONFIG_SANITIZE_FLAGS_DEBUG -fsanitize=undefined -fsanitize-undefined-trap-on-error -fstack-protector-all)
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED UPX_CONFIG_SANITIZE_FLAGS_RELEASE)
|
||||||
|
# default sanitizer for Release builds
|
||||||
|
set(UPX_CONFIG_SANITIZE_FLAGS_RELEASE -fstack-protector)
|
||||||
|
endif()
|
||||||
foreach(t ${ARGV})
|
foreach(t ${ARGV})
|
||||||
if(UPX_CONFIG_DISABLE_SANITIZE)
|
if(UPX_CONFIG_DISABLE_SANITIZE)
|
||||||
# no-op
|
# no-op
|
||||||
elseif(MSVC_FRONTEND)
|
elseif(MSVC_FRONTEND)
|
||||||
# MSVC uses -GS (similar to -fstack-protector) by default
|
# MSVC uses -GS (similar to -fstack-protector) by default
|
||||||
|
elseif(NOT GNU_FRONTEND)
|
||||||
|
# unknown compiler
|
||||||
elseif(MINGW OR CYGWIN)
|
elseif(MINGW OR CYGWIN)
|
||||||
# avoid link errors with current MinGW-w64 versions
|
# avoid link errors with current MinGW-w64 versions
|
||||||
# see https://www.mingw-w64.org/contribute/#sanitizers-asan-tsan-usan
|
# see https://www.mingw-w64.org/contribute/#sanitizers-asan-tsan-usan
|
||||||
|
elseif(CMAKE_C_COMPILER_ID MATCHES "^Clang$" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "9.0")
|
||||||
|
# unreliable/broken sanitize implementation before clang-9 (Sep 2019)
|
||||||
|
message(WARNING "WARNING: ignoring SANITIZE for target '${t}'")
|
||||||
elseif(CMAKE_C_COMPILER_ID MATCHES "^GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "8.0")
|
elseif(CMAKE_C_COMPILER_ID MATCHES "^GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "8.0")
|
||||||
# unsupported compiler; unreliable/broken sanitize implementation
|
# unsupported compiler; unreliable/broken sanitize implementation before gcc-8 (May 2018)
|
||||||
|
message(WARNING "WARNING: ignoring SANITIZE for target '${t}'")
|
||||||
else()
|
else()
|
||||||
# default sanitizer for Debug builds
|
target_compile_options(${t} PRIVATE $<$<CONFIG:Debug>:${UPX_CONFIG_SANITIZE_FLAGS_DEBUG}>)
|
||||||
target_compile_options(${t} PRIVATE $<$<CONFIG:Debug>:-fsanitize=undefined -fsanitize-undefined-trap-on-error -fstack-protector-all>)
|
target_compile_options(${t} PRIVATE $<$<CONFIG:MinSizeRel>:${UPX_CONFIG_SANITIZE_FLAGS_RELEASE}>)
|
||||||
# default sanitizer for Release builds
|
target_compile_options(${t} PRIVATE $<$<CONFIG:Release>:${UPX_CONFIG_SANITIZE_FLAGS_RELEASE}>)
|
||||||
target_compile_options(${t} PRIVATE $<$<CONFIG:MinSizeRel>:-fstack-protector>)
|
target_compile_options(${t} PRIVATE $<$<CONFIG:RelWithDebInfo>:${UPX_CONFIG_SANITIZE_FLAGS_RELEASE}>)
|
||||||
target_compile_options(${t} PRIVATE $<$<CONFIG:Release>:-fstack-protector>)
|
get_target_property(target_type ${t} TYPE)
|
||||||
target_compile_options(${t} PRIVATE $<$<CONFIG:RelWithDebInfo>:-fstack-protector>)
|
if(NOT ",${target_type}," STREQUAL ",STATIC_LIBRARY,")
|
||||||
|
if(${CMAKE_VERSION} VERSION_GREATER "3.12.99")
|
||||||
|
target_link_options(${t} PRIVATE $<$<CONFIG:Debug>:${UPX_CONFIG_SANITIZE_FLAGS_DEBUG}>)
|
||||||
|
target_link_options(${t} PRIVATE $<$<CONFIG:MinSizeRel>:${UPX_CONFIG_SANITIZE_FLAGS_RELEASE}>)
|
||||||
|
target_link_options(${t} PRIVATE $<$<CONFIG:Release>:${UPX_CONFIG_SANITIZE_FLAGS_RELEASE}>)
|
||||||
|
target_link_options(${t} PRIVATE $<$<CONFIG:RelWithDebInfo>:${UPX_CONFIG_SANITIZE_FLAGS_RELEASE}>)
|
||||||
|
endif() # CMAKE_VERSION
|
||||||
|
endif() # target_type
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
@@ -306,11 +434,22 @@ endfunction()
|
|||||||
# test
|
# test
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
function(upx_add_serial_test) # ARGV
|
function(upx_add_test) # ARGV
|
||||||
set(name "${ARGV0}")
|
set(name "${ARGV0}")
|
||||||
list(REMOVE_AT ARGV 0)
|
list(REMOVE_AT ARGV 0)
|
||||||
add_test(NAME "${name}" COMMAND ${ARGV})
|
set(wd "${CMAKE_CURRENT_BINARY_DIR}/XTesting/$<CONFIG>")
|
||||||
set_tests_properties("${name}" PROPERTIES RUN_SERIAL TRUE) # run these tests sequentially
|
add_test(NAME "${name}" WORKING_DIRECTORY "${wd}" COMMAND ${ARGV})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(upx_test_depends) # ARGV
|
||||||
|
set(name "${ARGV0}")
|
||||||
|
list(REMOVE_AT ARGV 0)
|
||||||
|
get_property(prop TEST "${name}" PROPERTY DEPENDS)
|
||||||
|
if("${prop}" MATCHES "^(NOTFOUND)?$")
|
||||||
|
set_tests_properties("${name}" PROPERTIES DEPENDS "${ARGV}")
|
||||||
|
else()
|
||||||
|
set_tests_properties("${name}" PROPERTIES DEPENDS "${prop};${ARGV}")
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# vim:set ft=cmake ts=4 sw=4 tw=0 et:
|
# vim:set ft=cmake ts=4 sw=4 tw=0 et:
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#
|
||||||
|
# UPX "CMake" build file; see https://cmake.org/
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
#
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# summary section
|
||||||
|
# print some info about the build configuration
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
function(upx_print_info)
|
||||||
|
get_property(PROPERTY_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
get_property(PROPERTY_TARGET_SUPPORTS_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
|
||||||
|
|
||||||
|
# generator
|
||||||
|
upx_print_var(CMAKE_GENERATOR_TOOLSET CMAKE_GENERATOR_PLATFORM)
|
||||||
|
upx_print_var(PROPERTY_GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
|
||||||
|
# directories
|
||||||
|
if(NOT ",${CMAKE_BINARY_DIR}," STREQUAL ",${CMAKE_CURRENT_BINARY_DIR}," OR NOT ",${CMAKE_SOURCE_DIR}," STREQUAL ",${CMAKE_CURRENT_SOURCE_DIR},")
|
||||||
|
upx_print_var(CMAKE_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_SOURCE_DIR)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# system
|
||||||
|
upx_print_var(CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_SYSTEM_PROCESSOR)
|
||||||
|
upx_print_var(CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION CMAKE_SYSTEM_PROCESSOR)
|
||||||
|
upx_print_var(CMAKE_ANDROID_NDK CMAKE_ANDROID_NDK_VERSION CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
|
||||||
|
upx_print_var(CMAKE_APPLE_SILICON_PROCESSOR CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT)
|
||||||
|
upx_print_var(CMAKE_VS_PLATFORM_TOOLSET CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE CMAKE_VS_PLATFORM_TOOLSET_VERSION)
|
||||||
|
upx_print_var(CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR)
|
||||||
|
upx_print_var(CMAKE_SIZEOF_VOID_P)
|
||||||
|
|
||||||
|
# binutils
|
||||||
|
upx_print_var(CMAKE_EXECUTABLE_FORMAT CMAKE_EXECUTABLE_SUFFIX UPX_CONFIG_CMAKE_EXECUTABLE_SUFFIX)
|
||||||
|
upx_print_var(CMAKE_AR CMAKE_RANLIB)
|
||||||
|
|
||||||
|
# compilers
|
||||||
|
foreach(lang IN ITEMS ASM C CXX)
|
||||||
|
upx_print_var(CMAKE_${lang}_COMPILER_LAUNCHER)
|
||||||
|
upx_print_var(CMAKE_${lang}_COMPILER)
|
||||||
|
upx_print_var(CMAKE_${lang}_COMPILER_ARG1)
|
||||||
|
upx_print_var(CMAKE_${lang}_COMPILER_ID)
|
||||||
|
upx_print_var(CMAKE_${lang}_SIMULATE_ID)
|
||||||
|
upx_print_var(CMAKE_${lang}_COMPILER_VERSION)
|
||||||
|
upx_print_var(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT)
|
||||||
|
upx_print_var(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID)
|
||||||
|
upx_print_var(CMAKE_${lang}_PLATFORM_ID)
|
||||||
|
upx_print_var(CMAKE_${lang}_COMPILER_ABI)
|
||||||
|
upx_print_var(CMAKE_${lang}_COMPILER_TARGET)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# misc
|
||||||
|
upx_print_var(CMAKE_BUILD_WITH_INSTALL_RPATH CMAKE_SKIP_RPATH CMAKE_SKIP_BUILD_RPATH CMAKE_SKIP_INSTALL_RPATH)
|
||||||
|
upx_print_var(CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_POSITION_INDEPENDENT_CODE)
|
||||||
|
upx_print_var(PROPERTY_TARGET_SUPPORTS_SHARED_LIBS)
|
||||||
|
upx_print_var(UPX_CONFIG_SANITIZE_FLAGS_DEBUG UPX_CONFIG_SANITIZE_FLAGS_RELEASE)
|
||||||
|
|
||||||
|
# shortcuts
|
||||||
|
upx_print_var(AIX APPLE CLANG CYGWIN GNU_FRONTEND GNUC MINGW MSVC MSVC_FRONTEND MSVC_IDE MSVC_SIMULATE MSVC_TOOLSET_VERSION MSVC_VERSION MSYS UNIX WIN32 WIN64)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# vim:set ft=cmake ts=4 sw=4 tw=0 et:
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
#
|
||||||
|
# UPX "CMake" build file; see https://cmake.org/
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
#
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# test section: self-pack tests
|
||||||
|
#
|
||||||
|
# IMPORTANT NOTE: these tests can only work if the host executable format
|
||||||
|
# is supported by UPX!
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
function(upx_self_pack_test)
|
||||||
|
|
||||||
|
set(emu "")
|
||||||
|
if(DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
|
||||||
|
set(emu "${CMAKE_CROSSCOMPILING_EMULATOR}")
|
||||||
|
endif()
|
||||||
|
set(exe "${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
|
set(upx_self_exe "$<TARGET_FILE:upx>")
|
||||||
|
set(fo "--force-overwrite")
|
||||||
|
|
||||||
|
#
|
||||||
|
# basic tests
|
||||||
|
#
|
||||||
|
|
||||||
|
upx_add_test(upx-self-pack upx -3 "${upx_self_exe}" ${fo} -o upx-packed${exe})
|
||||||
|
upx_add_test(upx-self-pack-fa upx -3 --all-filters "${upx_self_exe}" ${fo} -o upx-packed-fa${exe})
|
||||||
|
upx_add_test(upx-self-pack-fn upx -3 --no-filter "${upx_self_exe}" ${fo} -o upx-packed-fn${exe})
|
||||||
|
upx_add_test(upx-self-pack-fr upx -3 --all-filters --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-fr${exe})
|
||||||
|
upx_add_test(upx-self-pack-nrv2b upx -3 --nrv2b "${upx_self_exe}" ${fo} -o upx-packed-nrv2b${exe})
|
||||||
|
upx_add_test(upx-self-pack-nrv2d upx -3 --nrv2d "${upx_self_exe}" ${fo} -o upx-packed-nrv2d${exe})
|
||||||
|
upx_add_test(upx-self-pack-nrv2e upx -3 --nrv2e "${upx_self_exe}" ${fo} -o upx-packed-nrv2e${exe})
|
||||||
|
upx_add_test(upx-self-pack-lzma upx -1 --lzma "${upx_self_exe}" ${fo} -o upx-packed-lzma${exe})
|
||||||
|
|
||||||
|
upx_add_test(upx-list upx -l upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-fr${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe})
|
||||||
|
upx_add_test(upx-fileinfo upx --fileinfo upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-fr${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe})
|
||||||
|
upx_add_test(upx-test upx -t upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-fr${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe})
|
||||||
|
|
||||||
|
upx_add_test(upx-unpack upx -d upx-packed${exe} ${fo} -o upx-unpacked${exe})
|
||||||
|
upx_add_test(upx-unpack-fa upx -d upx-packed-fa${exe} ${fo} -o upx-unpacked-fa${exe})
|
||||||
|
upx_add_test(upx-unpack-fn upx -d upx-packed-fn${exe} ${fo} -o upx-unpacked-fn${exe})
|
||||||
|
upx_add_test(upx-unpack-fr upx -d upx-packed-fr${exe} ${fo} -o upx-unpacked-fr${exe})
|
||||||
|
upx_add_test(upx-unpack-nrv2b upx -d upx-packed-nrv2b${exe} ${fo} -o upx-unpacked-nrv2b${exe})
|
||||||
|
upx_add_test(upx-unpack-nrv2d upx -d upx-packed-nrv2d${exe} ${fo} -o upx-unpacked-nrv2d${exe})
|
||||||
|
upx_add_test(upx-unpack-nrv2e upx -d upx-packed-nrv2e${exe} ${fo} -o upx-unpacked-nrv2e${exe})
|
||||||
|
upx_add_test(upx-unpack-lzma upx -d upx-packed-lzma${exe} ${fo} -o upx-unpacked-lzma${exe})
|
||||||
|
|
||||||
|
# all unpacked files must be identical
|
||||||
|
upx_add_test(upx-compare-fa "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-fa${exe})
|
||||||
|
upx_add_test(upx-compare-fn "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-fn${exe})
|
||||||
|
upx_add_test(upx-compare-fr "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-fr${exe})
|
||||||
|
upx_add_test(upx-compare-nrv2b "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-nrv2b${exe})
|
||||||
|
upx_add_test(upx-compare-nrv2d "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-nrv2d${exe})
|
||||||
|
upx_add_test(upx-compare-nrv2e "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-nrv2e${exe})
|
||||||
|
upx_add_test(upx-compare-lzma "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-lzma${exe})
|
||||||
|
|
||||||
|
# test dependencies
|
||||||
|
upx_test_depends(upx-list "upx-self-pack;upx-self-pack-fa;upx-self-pack-fn;upx-self-pack-fr;upx-self-pack-nrv2b;upx-self-pack-nrv2d;upx-self-pack-nrv2e;upx-self-pack-lzma")
|
||||||
|
upx_test_depends(upx-fileinfo "upx-self-pack;upx-self-pack-fa;upx-self-pack-fn;upx-self-pack-fr;upx-self-pack-nrv2b;upx-self-pack-nrv2d;upx-self-pack-nrv2e;upx-self-pack-lzma")
|
||||||
|
upx_test_depends(upx-test "upx-self-pack;upx-self-pack-fa;upx-self-pack-fn;upx-self-pack-fr;upx-self-pack-nrv2b;upx-self-pack-nrv2d;upx-self-pack-nrv2e;upx-self-pack-lzma")
|
||||||
|
upx_test_depends(upx-unpack upx-self-pack)
|
||||||
|
upx_test_depends(upx-unpack-fa upx-self-pack-fa)
|
||||||
|
upx_test_depends(upx-unpack-fn upx-self-pack-fn)
|
||||||
|
upx_test_depends(upx-unpack-fr upx-self-pack-fr)
|
||||||
|
upx_test_depends(upx-unpack-nrv2b upx-self-pack-nrv2b)
|
||||||
|
upx_test_depends(upx-unpack-nrv2d upx-self-pack-nrv2d)
|
||||||
|
upx_test_depends(upx-unpack-nrv2e upx-self-pack-nrv2e)
|
||||||
|
upx_test_depends(upx-unpack-lzma upx-self-pack-lzma)
|
||||||
|
upx_test_depends(upx-compare-fa "upx-unpack;upx-unpack-fa")
|
||||||
|
upx_test_depends(upx-compare-fn "upx-unpack;upx-unpack-fn")
|
||||||
|
upx_test_depends(upx-compare-fr "upx-unpack;upx-unpack-fr")
|
||||||
|
upx_test_depends(upx-compare-nrv2b "upx-unpack;upx-unpack-nrv2b")
|
||||||
|
upx_test_depends(upx-compare-nrv2d "upx-unpack;upx-unpack-nrv2d")
|
||||||
|
upx_test_depends(upx-compare-nrv2e "upx-unpack;upx-unpack-nrv2e")
|
||||||
|
upx_test_depends(upx-compare-lzma "upx-unpack;upx-unpack-lzma")
|
||||||
|
# tests with higher COST values will run first
|
||||||
|
set_tests_properties(upx-self-pack PROPERTIES COST 90)
|
||||||
|
set_tests_properties(upx-self-pack-fa PROPERTIES COST 20)
|
||||||
|
set_tests_properties(upx-self-pack-fn PROPERTIES COST 20)
|
||||||
|
set_tests_properties(upx-self-pack-fr PROPERTIES COST 20)
|
||||||
|
set_tests_properties(upx-self-pack-nrv2b PROPERTIES COST 20)
|
||||||
|
set_tests_properties(upx-self-pack-nrv2d PROPERTIES COST 20)
|
||||||
|
set_tests_properties(upx-self-pack-nrv2e PROPERTIES COST 20)
|
||||||
|
set_tests_properties(upx-self-pack-lzma PROPERTIES COST 30)
|
||||||
|
set_tests_properties(upx-unpack PROPERTIES COST 10)
|
||||||
|
|
||||||
|
if(NOT UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST)
|
||||||
|
upx_add_test(upx-run-unpacked ${emu} ./upx-unpacked${exe} --version-short)
|
||||||
|
upx_test_depends(upx-run-unpacked upx-unpack)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT UPX_CONFIG_DISABLE_RUN_PACKED_TEST)
|
||||||
|
upx_add_test(upx-run-packed ${emu} ./upx-packed${exe} --version-short)
|
||||||
|
upx_add_test(upx-run-packed-fa ${emu} ./upx-packed-fa${exe} --version-short)
|
||||||
|
upx_add_test(upx-run-packed-fn ${emu} ./upx-packed-fn${exe} --version-short)
|
||||||
|
upx_add_test(upx-run-packed-fr ${emu} ./upx-packed-fr${exe} --version-short)
|
||||||
|
upx_add_test(upx-run-packed-nrv2b ${emu} ./upx-packed-nrv2b${exe} --version-short)
|
||||||
|
upx_add_test(upx-run-packed-nrv2d ${emu} ./upx-packed-nrv2d${exe} --version-short)
|
||||||
|
upx_add_test(upx-run-packed-nrv2e ${emu} ./upx-packed-nrv2e${exe} --version-short)
|
||||||
|
upx_add_test(upx-run-packed-lzma ${emu} ./upx-packed-lzma${exe} --version-short)
|
||||||
|
upx_test_depends(upx-run-packed upx-self-pack)
|
||||||
|
upx_test_depends(upx-run-packed-fa upx-self-pack-fa)
|
||||||
|
upx_test_depends(upx-run-packed-fn upx-self-pack-fn)
|
||||||
|
upx_test_depends(upx-run-packed-fr upx-self-pack-fr)
|
||||||
|
upx_test_depends(upx-run-packed-nrv2b upx-self-pack-nrv2b)
|
||||||
|
upx_test_depends(upx-run-packed-nrv2d upx-self-pack-nrv2d)
|
||||||
|
upx_test_depends(upx-run-packed-nrv2e upx-self-pack-nrv2e)
|
||||||
|
upx_test_depends(upx-run-packed-lzma upx-self-pack-lzma)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# exhaustive tests
|
||||||
|
#
|
||||||
|
|
||||||
|
if(NOT UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS)
|
||||||
|
foreach(method IN ITEMS nrv2b nrv2d nrv2e lzma)
|
||||||
|
foreach(level IN ITEMS 1 2 3 4 5 6 7)
|
||||||
|
foreach(small IN ITEMS normal small)
|
||||||
|
set(s "${method}-${level}")
|
||||||
|
set(ss "")
|
||||||
|
if(small MATCHES "small")
|
||||||
|
set(s "${method}-${level}-${small}")
|
||||||
|
set(ss "--small")
|
||||||
|
endif()
|
||||||
|
upx_add_test(upx-self-pack-${s} upx --${method} -${level} ${ss} --all-filters --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-${s}${exe})
|
||||||
|
upx_add_test(upx-list-${s} upx -l upx-packed-${s}${exe})
|
||||||
|
upx_add_test(upx-fileinfo-${s} upx --fileinfo upx-packed-${s}${exe})
|
||||||
|
upx_add_test(upx-test-${s} upx -t upx-packed-${s}${exe})
|
||||||
|
upx_add_test(upx-unpack-${s} upx -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe})
|
||||||
|
upx_add_test(upx-compare-${s} "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-${s}${exe})
|
||||||
|
upx_test_depends(upx-list-${s} upx-self-pack-${s})
|
||||||
|
upx_test_depends(upx-fileinfo-${s} upx-self-pack-${s})
|
||||||
|
upx_test_depends(upx-test-${s} upx-self-pack-${s})
|
||||||
|
upx_test_depends(upx-unpack-${s} upx-self-pack-${s})
|
||||||
|
upx_test_depends(upx-compare-${s} "upx-unpack;upx-unpack-${s}")
|
||||||
|
if(method MATCHES "lzma")
|
||||||
|
set_tests_properties(upx-self-pack-${s} PROPERTIES COST "3${level}")
|
||||||
|
else()
|
||||||
|
set_tests_properties(upx-self-pack-${s} PROPERTIES COST "2${level}")
|
||||||
|
endif()
|
||||||
|
if(NOT UPX_CONFIG_DISABLE_RUN_PACKED_TEST)
|
||||||
|
set(i 0)
|
||||||
|
while(${i} LESS 20)
|
||||||
|
math(EXPR i "${i} + 1")
|
||||||
|
upx_add_test(upx-run-packed-${s}-${i} ${emu} ./upx-packed-${s}${exe} --version-short)
|
||||||
|
upx_test_depends(upx-run-packed-${s}-${i} upx-self-pack-${s})
|
||||||
|
endwhile()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
endif() # UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# vim:set ft=cmake ts=4 sw=4 tw=0 et:
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// check ABI - require proper alignment of fundamental types for use in atomics
|
||||||
|
static_assert(alignof(char) == sizeof(char), "");
|
||||||
|
static_assert(alignof(signed char) == sizeof(signed char), "");
|
||||||
|
static_assert(alignof(unsigned char) == sizeof(unsigned char), "");
|
||||||
|
static_assert(alignof(short) == sizeof(short), "");
|
||||||
|
static_assert(alignof(unsigned short) == sizeof(unsigned short), "");
|
||||||
|
static_assert(alignof(int) == sizeof(int), "");
|
||||||
|
static_assert(alignof(unsigned int) == sizeof(unsigned int), "");
|
||||||
|
static_assert(alignof(long) == sizeof(long), "");
|
||||||
|
static_assert(alignof(unsigned long) == sizeof(unsigned long), "");
|
||||||
|
static_assert(alignof(ptrdiff_t) == sizeof(ptrdiff_t), "");
|
||||||
|
static_assert(alignof(size_t) == sizeof(size_t), "");
|
||||||
|
static_assert(alignof(intptr_t) == sizeof(intptr_t), "");
|
||||||
|
static_assert(alignof(uintptr_t) == sizeof(uintptr_t), "");
|
||||||
|
static_assert(alignof(void *) == sizeof(void *), "");
|
||||||
|
|
||||||
|
int main() { return 0; }
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#
|
||||||
|
# UPX "CMake" build file; see https://cmake.org/
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
#
|
||||||
|
|
||||||
|
if(NOT DEFINED USE_STRICT_DEFAULTS)
|
||||||
|
# use strict config defaults for Git developer builds
|
||||||
|
set(USE_STRICT_DEFAULTS TRUE CACHE INTERNAL "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# vim:set ft=cmake ts=4 sw=4 tw=0 et:
|
||||||
+125
-73
@@ -6,32 +6,30 @@
|
|||||||
ifeq ($(UPX_MAKEFILE_EXTRA_MK_INCLUDED),)
|
ifeq ($(UPX_MAKEFILE_EXTRA_MK_INCLUDED),)
|
||||||
override UPX_MAKEFILE_EXTRA_MK_INCLUDED := 1
|
override UPX_MAKEFILE_EXTRA_MK_INCLUDED := 1
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# support functions
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
override check_defined = $(foreach 1,$1,$(if $(filter undefined,$(origin $1)),$(error ERROR: variable '$1' is not defined),))
|
override check_defined = $(foreach 1,$1,$(if $(filter undefined,$(origin $1)),$(error ERROR: variable '$1' is not defined),))
|
||||||
override check_undefined = $(foreach 1,$1,$(if $(filter undefined,$(origin $1)),,$(error ERROR: variable '$1' is already defined)))
|
override check_undefined = $(foreach 1,$1,$(if $(filter undefined,$(origin $1)),,$(error ERROR: variable '$1' is already defined)))
|
||||||
$(call check_defined,run_config run_build)
|
|
||||||
$(call check_undefined,run_config_and_build)
|
|
||||||
|
|
||||||
#***********************************************************************
|
# return "1" or empty-string
|
||||||
# build and test
|
override eq = $(if $(subst x$1,,x$2)$(subst x$2,,x$1),,1)
|
||||||
#***********************************************************************
|
override ne = $(if $(subst x$1,,x$2)$(subst x$2,,x$1),1,)
|
||||||
|
|
||||||
CTEST = ctest
|
override tolower = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
|
||||||
|
override toupper = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
|
||||||
|
|
||||||
build/debug+test: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CTEST)
|
# canonicalize the case of CMAKE_BUILD_TYPE to "Debug" and "Release"
|
||||||
build/%/debug+test: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CTEST)
|
override cm_build_type = $(if $(call eq,$1,),$(error EMPTY-build-type),$(if $(call eq,$(call tolower,$1),debug),Debug,$(if $(call eq,$(call tolower,$1),release),Release,$(if $(call eq,$(call tolower,$1),none),None,$1))))
|
||||||
build/release+test: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CTEST)
|
|
||||||
build/%/release+test: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CTEST)
|
|
||||||
build/%/all+test: $$(dir $$@)debug+test $$(dir $$@)release+test PHONY ;
|
|
||||||
|
|
||||||
# shortcuts
|
|
||||||
debug+test: build/debug+test PHONY
|
|
||||||
release+test: build/release+test PHONY
|
|
||||||
all+test build/all+test: build/debug+test build/release+test PHONY
|
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# extra builds: some pre-defined build configurations
|
# extra builds: some pre-defined build configurations
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
|
$(call check_defined,run_config run_build)
|
||||||
|
$(call check_undefined,run_config_and_build)
|
||||||
|
|
||||||
define run_config_and_build
|
define run_config_and_build
|
||||||
$(call run_config,$1,$2)
|
$(call run_config,$1,$2)
|
||||||
$(call run_build,$1,$2)
|
$(call run_build,$1,$2)
|
||||||
@@ -61,25 +59,41 @@ build/extra/clang-m64/release: PHONY; $(call run_config_and_build,$@,Release)
|
|||||||
build/extra/clang-m64/%: export CC = clang -m64
|
build/extra/clang-m64/%: export CC = clang -m64
|
||||||
build/extra/clang-m64/%: export CXX = clang++ -m64
|
build/extra/clang-m64/%: export CXX = clang++ -m64
|
||||||
|
|
||||||
|
# force building with clang/clang++ -flto=auto
|
||||||
|
build/extra/clang-lto-auto/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
|
build/extra/clang-lto-auto/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
|
build/extra/clang-lto-auto/%: export CC = clang -flto=auto
|
||||||
|
build/extra/clang-lto-auto/%: export CXX = clang++ -flto=auto
|
||||||
|
|
||||||
|
# force building with clang/clang++ -pie
|
||||||
|
build/extra/clang-pie/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
|
build/extra/clang-pie/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
|
build/extra/clang-pie/%: export CC = clang -pie -fPIE -Wno-unused-command-line-argument
|
||||||
|
build/extra/clang-pie/%: export CXX = clang++ -pie -fPIE -Wno-unused-command-line-argument
|
||||||
|
build/extra/clang-pie/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
|
||||||
|
|
||||||
# force building with clang/clang++ -static
|
# force building with clang/clang++ -static
|
||||||
build/extra/clang-static/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/clang-static/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/clang-static/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/clang-static/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/clang-static/%: export CC = clang -static
|
build/extra/clang-static/%: export CC = clang -static
|
||||||
build/extra/clang-static/%: export CXX = clang++ -static
|
build/extra/clang-static/%: export CXX = clang++ -static
|
||||||
|
build/extra/clang-static/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
|
||||||
|
|
||||||
# force building with clang/clang++ -static-pie
|
# force building with clang/clang++ -static-pie
|
||||||
build/extra/clang-static-pie/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/clang-static-pie/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/clang-static-pie/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/clang-static-pie/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/clang-static-pie/%: export CC = clang -static-pie -fPIE -Wno-unused-command-line-argument
|
build/extra/clang-static-pie/%: export CC = clang -static-pie -fPIE -Wno-unused-command-line-argument
|
||||||
build/extra/clang-static-pie/%: export CXX = clang++ -static-pie -fPIE -Wno-unused-command-line-argument
|
build/extra/clang-static-pie/%: export CXX = clang++ -static-pie -fPIE -Wno-unused-command-line-argument
|
||||||
|
build/extra/clang-static-pie/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
|
||||||
|
|
||||||
# force building with clang/clang++ -static -flto
|
# force building with clang/clang++ -static -flto
|
||||||
build/extra/clang-static-lto/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/clang-static-lto/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/clang-static-lto/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/clang-static-lto/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/clang-static-lto/%: export CC = clang -static -flto
|
build/extra/clang-static-lto/%: export CC = clang -static -flto
|
||||||
build/extra/clang-static-lto/%: export CXX = clang++ -static -flto
|
build/extra/clang-static-lto/%: export CXX = clang++ -static -flto
|
||||||
|
build/extra/clang-static-lto/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
|
||||||
|
|
||||||
# force building with clang/clang++ C17/C++20
|
# force building with clang/clang++ C++20 (and C17)
|
||||||
build/extra/clang-std-cxx20/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/clang-std-cxx20/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/clang-std-cxx20/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/clang-std-cxx20/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/clang-std-cxx20/%: export CC = clang -std=gnu17
|
build/extra/clang-std-cxx20/%: export CC = clang -std=gnu17
|
||||||
@@ -87,14 +101,22 @@ build/extra/clang-std-cxx20/%: export CXX = clang++ -std=gnu++20
|
|||||||
build/extra/clang-std-cxx20/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
build/extra/clang-std-cxx20/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
||||||
build/extra/clang-std-cxx20/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
build/extra/clang-std-cxx20/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
||||||
|
|
||||||
# force building with clang/clang++ C23/C++23
|
# force building with clang/clang++ C++23 (and C23)
|
||||||
build/extra/clang-std-cxx23/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/clang-std-cxx23/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/clang-std-cxx23/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/clang-std-cxx23/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/clang-std-cxx23/%: export CC = clang -std=gnu2x
|
build/extra/clang-std-cxx23/%: export CC = clang -std=gnu2x -Wno-constant-logical-operand
|
||||||
build/extra/clang-std-cxx23/%: export CXX = clang++ -std=gnu++2b
|
build/extra/clang-std-cxx23/%: export CXX = clang++ -std=gnu++2b
|
||||||
build/extra/clang-std-cxx23/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
build/extra/clang-std-cxx23/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
||||||
build/extra/clang-std-cxx23/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
build/extra/clang-std-cxx23/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
||||||
|
|
||||||
|
# force building with clang/clang++ C++26 (and C23)
|
||||||
|
build/extra/clang-std-cxx26/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
|
build/extra/clang-std-cxx26/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
|
build/extra/clang-std-cxx26/%: export CC = clang -std=gnu2x -Wno-constant-logical-operand
|
||||||
|
build/extra/clang-std-cxx26/%: export CXX = clang++ -std=gnu++2c
|
||||||
|
build/extra/clang-std-cxx26/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
||||||
|
build/extra/clang-std-cxx26/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
||||||
|
|
||||||
# force building with gcc/g++
|
# force building with gcc/g++
|
||||||
build/extra/gcc/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/gcc/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/gcc/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/gcc/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
@@ -119,25 +141,41 @@ build/extra/gcc-m64/release: PHONY; $(call run_config_and_build,$@,Release)
|
|||||||
build/extra/gcc-m64/%: export CC = gcc -m64
|
build/extra/gcc-m64/%: export CC = gcc -m64
|
||||||
build/extra/gcc-m64/%: export CXX = g++ -m64
|
build/extra/gcc-m64/%: export CXX = g++ -m64
|
||||||
|
|
||||||
|
# force building with gcc/g++ -flto=auto
|
||||||
|
build/extra/gcc-lto-auto/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
|
build/extra/gcc-lto-auto/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
|
build/extra/gcc-lto-auto/%: export CC = gcc -flto=auto
|
||||||
|
build/extra/gcc-lto-auto/%: export CXX = g++ -flto=auto
|
||||||
|
|
||||||
|
# force building with gcc/g++ -pie
|
||||||
|
build/extra/gcc-pie/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
|
build/extra/gcc-pie/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
|
build/extra/gcc-pie/%: export CC = gcc -pie -fPIE
|
||||||
|
build/extra/gcc-pie/%: export CXX = g++ -pie -fPIE
|
||||||
|
build/extra/gcc-pie/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
|
||||||
|
|
||||||
# force building with gcc/g++ -static
|
# force building with gcc/g++ -static
|
||||||
build/extra/gcc-static/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/gcc-static/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/gcc-static/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/gcc-static/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/gcc-static/%: export CC = gcc -static
|
build/extra/gcc-static/%: export CC = gcc -static
|
||||||
build/extra/gcc-static/%: export CXX = g++ -static
|
build/extra/gcc-static/%: export CXX = g++ -static
|
||||||
|
build/extra/gcc-static/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
|
||||||
|
|
||||||
# force building with gcc/g++ -static-pie
|
# force building with gcc/g++ -static-pie
|
||||||
build/extra/gcc-static-pie/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/gcc-static-pie/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/gcc-static-pie/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/gcc-static-pie/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/gcc-static-pie/%: export CC = gcc -static-pie -fPIE
|
build/extra/gcc-static-pie/%: export CC = gcc -static-pie -fPIE
|
||||||
build/extra/gcc-static-pie/%: export CXX = g++ -static-pie -fPIE
|
build/extra/gcc-static-pie/%: export CXX = g++ -static-pie -fPIE
|
||||||
|
build/extra/gcc-static-pie/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
|
||||||
|
|
||||||
# force building with gcc/g++ -static -flto
|
# force building with gcc/g++ -static -flto
|
||||||
build/extra/gcc-static-lto/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/gcc-static-lto/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/gcc-static-lto/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/gcc-static-lto/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/gcc-static-lto/%: export CC = gcc -static -flto
|
build/extra/gcc-static-lto/%: export CC = gcc -static -flto
|
||||||
build/extra/gcc-static-lto/%: export CXX = g++ -static -flto
|
build/extra/gcc-static-lto/%: export CXX = g++ -static -flto
|
||||||
|
build/extra/gcc-static-lto/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
|
||||||
|
|
||||||
# force building with gcc/g++ C17/C++20
|
# force building with gcc/g++ C++20 (and C17)
|
||||||
build/extra/gcc-std-cxx20/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/gcc-std-cxx20/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/gcc-std-cxx20/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/gcc-std-cxx20/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/gcc-std-cxx20/%: export CC = gcc -std=gnu17
|
build/extra/gcc-std-cxx20/%: export CC = gcc -std=gnu17
|
||||||
@@ -145,7 +183,7 @@ build/extra/gcc-std-cxx20/%: export CXX = g++ -std=gnu++20
|
|||||||
build/extra/gcc-std-cxx20/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
build/extra/gcc-std-cxx20/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
||||||
build/extra/gcc-std-cxx20/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
build/extra/gcc-std-cxx20/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
||||||
|
|
||||||
# force building with gcc/g++ C23/C++23
|
# force building with gcc/g++ C++23 (and C23)
|
||||||
build/extra/gcc-std-cxx23/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/gcc-std-cxx23/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/gcc-std-cxx23/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/gcc-std-cxx23/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
build/extra/gcc-std-cxx23/%: export CC = gcc -std=gnu2x
|
build/extra/gcc-std-cxx23/%: export CC = gcc -std=gnu2x
|
||||||
@@ -153,6 +191,14 @@ build/extra/gcc-std-cxx23/%: export CXX = g++ -std=gnu++2b
|
|||||||
build/extra/gcc-std-cxx23/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
build/extra/gcc-std-cxx23/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
||||||
build/extra/gcc-std-cxx23/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
build/extra/gcc-std-cxx23/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
||||||
|
|
||||||
|
# force building with gcc/g++ C++26 (and C23)
|
||||||
|
build/extra/gcc-std-cxx26/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
|
build/extra/gcc-std-cxx26/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
|
build/extra/gcc-std-cxx26/%: export CC = gcc -std=gnu23
|
||||||
|
build/extra/gcc-std-cxx26/%: export CXX = g++ -std=gnu++26
|
||||||
|
build/extra/gcc-std-cxx26/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
|
||||||
|
build/extra/gcc-std-cxx26/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
|
||||||
|
|
||||||
# cross compiler: Linux glibc aarch64-linux-gnu (arm64)
|
# cross compiler: Linux glibc aarch64-linux-gnu (arm64)
|
||||||
build/extra/cross-linux-gnu-aarch64/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/cross-linux-gnu-aarch64/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
build/extra/cross-linux-gnu-aarch64/release: PHONY; $(call run_config_and_build,$@,Release)
|
build/extra/cross-linux-gnu-aarch64/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||||
@@ -185,7 +231,7 @@ build/extra/cross-windows-mingw64/%: export CC = x86_64-w64-mingw32-gcc -static
|
|||||||
build/extra/cross-windows-mingw64/%: export CXX = x86_64-w64-mingw32-g++ -static -D_WIN32_WINNT=0x0501
|
build/extra/cross-windows-mingw64/%: export CXX = x86_64-w64-mingw32-g++ -static -D_WIN32_WINNT=0x0501
|
||||||
build/extra/cross-windows-mingw64/%: CMAKE_SYSTEM_NAME ?= Windows
|
build/extra/cross-windows-mingw64/%: CMAKE_SYSTEM_NAME ?= Windows
|
||||||
build/extra/cross-windows-mingw64/%: CMAKE_SYSTEM_PROCESSOR ?= AMD64
|
build/extra/cross-windows-mingw64/%: CMAKE_SYSTEM_PROCESSOR ?= AMD64
|
||||||
build/extra/cross-windows-mingw64/%: CMAKE_CROSSCOMPILING_EMULATOR ?= wine64
|
build/extra/cross-windows-mingw64/%: CMAKE_CROSSCOMPILING_EMULATOR ?= wine
|
||||||
|
|
||||||
# cross compiler: macOS arm64 (aarch64)
|
# cross compiler: macOS arm64 (aarch64)
|
||||||
build/extra/cross-darwin-arm64/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
build/extra/cross-darwin-arm64/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||||
@@ -215,29 +261,31 @@ build/analyze/clang-analyzer/%: override CMAKE := $(SCAN_BUILD) $(CMAKE)
|
|||||||
build/analyze/clang-analyzer/%: export CCC_CC ?= clang
|
build/analyze/clang-analyzer/%: export CCC_CC ?= clang
|
||||||
build/analyze/clang-analyzer/%: export CCC_CXX ?= clang++
|
build/analyze/clang-analyzer/%: export CCC_CXX ?= clang++
|
||||||
|
|
||||||
# run clang-tidy: uses file compile_commands.json from an existing clang build
|
# run clang-tidy: uses file compile_commands.json from an existing clang build;
|
||||||
# does not create any actual files, so purely PHONY
|
# does not create any actual files, so purely PHONY
|
||||||
RUN_CLANG_TIDY = time python3 ./misc/analyze/clang-tidy/run-clang-tidy.py -p $<
|
CLANG_TIDY_BUILD_BASE = build/extra/clang
|
||||||
|
RUN_CLANG_TIDY = time python3 ./misc/analyze/clang-tidy/run-clang-tidy.py -p "$<"
|
||||||
RUN_CLANG_TIDY_WERROR = $(RUN_CLANG_TIDY) '-warnings-as-errors=*'
|
RUN_CLANG_TIDY_WERROR = $(RUN_CLANG_TIDY) '-warnings-as-errors=*'
|
||||||
build/analyze/clang-tidy-upx/debug build/analyze/clang-tidy-upx/release: build/extra/clang/$$(notdir $$@) PHONY
|
build/analyze/clang-tidy-upx/debug build/analyze/clang-tidy-upx/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY
|
||||||
$(RUN_CLANG_TIDY_WERROR) -config-file ./.clang-tidy '/src/.*\.cpp'
|
$(RUN_CLANG_TIDY_WERROR) -config-file ./.clang-tidy '/src/.*\.cpp'
|
||||||
build/analyze/clang-tidy-bzip2/debug build/analyze/clang-tidy-bzip2/release: build/extra/clang/$$(notdir $$@) PHONY
|
build/analyze/clang-tidy-bzip2/debug build/analyze/clang-tidy-bzip2/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY
|
||||||
$(RUN_CLANG_TIDY) -config-file ./misc/analyze/clang-tidy/clang-tidy-bzip2.yml /vendor/bzip2/
|
$(RUN_CLANG_TIDY) -config-file ./misc/analyze/clang-tidy/clang-tidy-bzip2.yml /vendor/bzip2/
|
||||||
build/analyze/clang-tidy-ucl/debug build/analyze/clang-tidy-ucl/release: build/extra/clang/$$(notdir $$@) PHONY
|
build/analyze/clang-tidy-ucl/debug build/analyze/clang-tidy-ucl/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY
|
||||||
$(RUN_CLANG_TIDY_WERROR) -config-file ./misc/analyze/clang-tidy/clang-tidy-ucl.yml /vendor/ucl/
|
$(RUN_CLANG_TIDY_WERROR) -config-file ./misc/analyze/clang-tidy/clang-tidy-ucl.yml /vendor/ucl/
|
||||||
build/analyze/clang-tidy-zlib/debug build/analyze/clang-tidy-zlib/release: build/extra/clang/$$(notdir $$@) PHONY
|
build/analyze/clang-tidy-zlib/debug build/analyze/clang-tidy-zlib/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY
|
||||||
$(RUN_CLANG_TIDY_WERROR) -config-file ./misc/analyze/clang-tidy/clang-tidy-zlib.yml /vendor/zlib/
|
$(RUN_CLANG_TIDY) -config-file ./misc/analyze/clang-tidy/clang-tidy-zlib.yml /vendor/zlib/
|
||||||
build/analyze/clang-tidy-zstd/debug build/analyze/clang-tidy-zstd/release: build/extra/clang/$$(notdir $$@) PHONY
|
build/analyze/clang-tidy-zstd/debug build/analyze/clang-tidy-zstd/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY
|
||||||
$(RUN_CLANG_TIDY) -config-file ./misc/analyze/clang-tidy/clang-tidy-zstd.yml /vendor/zstd/
|
$(RUN_CLANG_TIDY) -config-file ./misc/analyze/clang-tidy/clang-tidy-zstd.yml /vendor/zstd/
|
||||||
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-upx/$$(notdir $$@)
|
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-upx/$$(notdir $$@)
|
||||||
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-bzip2/$$(notdir $$@)
|
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-bzip2/$$(notdir $$@)
|
||||||
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-ucl/$$(notdir $$@)
|
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-ucl/$$(notdir $$@)
|
||||||
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zlib/$$(notdir $$@)
|
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zlib/$$(notdir $$@)
|
||||||
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zstd/$$(notdir $$@)
|
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: build/analyze/clang-tidy-zstd/$$(notdir $$@)
|
||||||
|
build/analyze/clang-tidy/debug build/analyze/clang-tidy/release: PHONY
|
||||||
|
|
||||||
# OLD names [deprecated]
|
# OLD names [deprecated]
|
||||||
build/extra/scan-build/debug: build/analyze/clang-analyzer/debug
|
build/extra/scan-build/debug: build/analyze/clang-analyzer/debug PHONY
|
||||||
build/extra/scan-build/release: build/analyze/clang-analyzer/release
|
build/extra/scan-build/release: build/analyze/clang-analyzer/release PHONY
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# advanced: generic eXtra target
|
# advanced: generic eXtra target
|
||||||
@@ -257,12 +305,12 @@ build/$(UPX_XTARGET)/release: PHONY; $(call run_config_and_build,$@,Release)
|
|||||||
build/$(UPX_XTARGET)/%: export CC := $(CC)
|
build/$(UPX_XTARGET)/%: export CC := $(CC)
|
||||||
build/$(UPX_XTARGET)/%: export CXX := $(CXX)
|
build/$(UPX_XTARGET)/%: export CXX := $(CXX)
|
||||||
# shortcuts
|
# shortcuts
|
||||||
xtarget/all: xtarget/debug xtarget/release PHONY
|
|
||||||
xtarget/debug: build/$(UPX_XTARGET)/debug PHONY
|
xtarget/debug: build/$(UPX_XTARGET)/debug PHONY
|
||||||
xtarget/release: build/$(UPX_XTARGET)/release PHONY
|
xtarget/release: build/$(UPX_XTARGET)/release PHONY
|
||||||
xtarget/all+test: xtarget/debug+test xtarget/release+test PHONY
|
xtarget/all: xtarget/debug xtarget/release PHONY
|
||||||
xtarget/debug+test: build/$(UPX_XTARGET)/debug+test PHONY
|
xtarget/debug+test: build/$(UPX_XTARGET)/debug+test PHONY
|
||||||
xtarget/release+test: build/$(UPX_XTARGET)/release+test PHONY
|
xtarget/release+test: build/$(UPX_XTARGET)/release+test PHONY
|
||||||
|
xtarget/all+test: xtarget/debug+test xtarget/release+test PHONY
|
||||||
# set new default
|
# set new default
|
||||||
.DEFAULT_GOAL := build/$(UPX_XTARGET)/release
|
.DEFAULT_GOAL := build/$(UPX_XTARGET)/release
|
||||||
|
|
||||||
@@ -277,49 +325,51 @@ endif
|
|||||||
# it easy to set other variables like CMAKE_AR or CMAKE_RANLIB
|
# it easy to set other variables like CMAKE_AR or CMAKE_RANLIB
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
ifneq ($(origin UPX_CMAKE_CONFIG_FLAGS),command line) # GNU make bug work-around
|
UPX_CMAKE_CONFIG_FLAGS += $(UPX_CMAKE_CONFIG_FLAGS_GENERATOR)
|
||||||
# GNU make bug, see https://savannah.gnu.org/bugs/index.php?64822
|
UPX_CMAKE_CONFIG_FLAGS += $(UPX_CMAKE_CONFIG_FLAGS_TOOLSET)
|
||||||
# and commit https://git.savannah.gnu.org/cgit/make.git/commit/?id=07187db947ba25e6c59b55f10660a04f8e9c5229
|
UPX_CMAKE_CONFIG_FLAGS += $(UPX_CMAKE_CONFIG_FLAGS_PLATFORM)
|
||||||
|
|
||||||
$(call check_undefined,__add_cmake_config)
|
$(call check_undefined,__add_cmake_config)
|
||||||
|
# promote an environment or Make variable to a CMake cache entry:
|
||||||
__add_cmake_config = $(and $($1),-D$1="$($1)")
|
__add_cmake_config = $(and $($1),-D$1="$($1)")
|
||||||
# pass common CMake settings from environment/make to cmake
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_VERBOSE_MAKEFILE)
|
|
||||||
# pass common CMake toolchain settings from environment/make to cmake
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_ADDR2LINE)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_AR)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_DLLTOOL)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_LINKER)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_NM)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_OBJCOPY)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_OBJDUMP)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_RANLIB)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_READELF)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_STRIP)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_TAPI)
|
|
||||||
# pass common CMake LTO toolchain settings from environment/make to cmake (for use with "-flto")
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_C_COMPILER_AR)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_C_COMPILER_RANLIB)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_CXX_COMPILER_AR)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_CXX_COMPILER_RANLIB)
|
|
||||||
# pass common CMake cross compilation settings from environment/make to cmake
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_SYSTEM_NAME)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_SYSTEM_PROCESSOR)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_CROSSCOMPILING_EMULATOR)
|
|
||||||
# pass UPX config options from environment/make to cmake; see CMakeLists.txt
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_GITREV)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SANITIZE)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WSTRICT)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WERROR)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SELF_PACK_TEST)
|
|
||||||
# pass UPX extra compile options from environment/make to cmake; see CMakeLists.txt
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB)
|
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD)
|
|
||||||
|
|
||||||
endif # GNU make bug work-around
|
# pass common CMake settings
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_INSTALL_PREFIX)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_VERBOSE_MAKEFILE)
|
||||||
|
# pass common CMake toolchain settings
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_ADDR2LINE)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_AR)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_DLLTOOL)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_LINKER)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_NM)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_OBJCOPY)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_OBJDUMP)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_RANLIB)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_READELF)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_STRIP)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_TAPI)
|
||||||
|
# pass common CMake LTO toolchain settings
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_C_COMPILER_AR)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_C_COMPILER_RANLIB)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_CXX_COMPILER_AR)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_CXX_COMPILER_RANLIB)
|
||||||
|
# pass common CMake cross compilation settings
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_SYSTEM_NAME)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_SYSTEM_PROCESSOR)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_CROSSCOMPILING_EMULATOR)
|
||||||
|
# pass UPX config options; see CMakeLists.txt
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_GITREV)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SANITIZE)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WERROR)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WSTRICT)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SELF_PACK_TEST)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS)
|
||||||
|
# pass UPX extra compile options; see CMakeLists.txt
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB)
|
||||||
|
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD)
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# check git submodules
|
# check git submodules
|
||||||
@@ -331,3 +381,5 @@ $(foreach 1,$(SUBMODULES),$(if $(wildcard vendor/$1/[CL]*),,\
|
|||||||
$(error ERROR: missing git submodule '$1'; run 'git submodule update --init')))
|
$(error ERROR: missing git submodule '$1'; run 'git submodule update --init')))
|
||||||
|
|
||||||
endif # UPX_MAKEFILE_EXTRA_MK_INCLUDED
|
endif # UPX_MAKEFILE_EXTRA_MK_INCLUDED
|
||||||
|
|
||||||
|
# vim:set ts=8 sw=8 noet:
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
From 741b9d2f24b5796fc499a411f632820ab4f889e5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Markus F.X.J. Oberhumer" <markus@oberhumer.com>
|
||||||
|
Date: Wed, 9 Apr 2025 20:00:24 +0200
|
||||||
|
Subject: [PATCH] x
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/libcxx/include/__config | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/libcxx/include/__config b/lib/libcxx/include/__config
|
||||||
|
index fec323f..a16d145 100644
|
||||||
|
--- a/lib/libcxx/include/__config
|
||||||
|
+++ b/lib/libcxx/include/__config
|
||||||
|
@@ -637,9 +637,12 @@ typedef __char32_t char32_t;
|
||||||
|
# define _DECLARE_C99_LDBL_MATH 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
+# if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
|
||||||
|
+# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
|
||||||
|
+# elif defined(_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION)
|
||||||
|
// If we are getting operator new from the MSVC CRT, then allocation overloads
|
||||||
|
// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
|
||||||
|
-# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
|
||||||
|
+# elif defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
|
||||||
|
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
|
||||||
|
# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
|
||||||
|
// We're deferring to Microsoft's STL to provide aligned new et al. We don't
|
||||||
|
--
|
||||||
|
2.49.0
|
||||||
|
|
||||||
@@ -5,8 +5,9 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
|
|||||||
|
|
||||||
# create the image from Dockerfile
|
# create the image from Dockerfile
|
||||||
# using a rootless Podman container
|
# using a rootless Podman container
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
image=upx-stubtools-20221212-v7
|
image=upx-stubtools-20240405-v1
|
||||||
[[ $1 == --print-image ]] && echo "$image" && exit 0
|
[[ $1 == --print-image ]] && echo "$image" && exit 0
|
||||||
|
|
||||||
podman build -t "$image" -f "$argv0dir/Dockerfile" "$argv0dir"
|
podman build -t "$image" -f "$argv0dir/Dockerfile" "$argv0dir"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
|
|||||||
|
|
||||||
# list all system packages that are installed in the image
|
# list all system packages that are installed in the image
|
||||||
# using a rootless Podman container
|
# using a rootless Podman container
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
image="$("$argv0dir/10-create-image.sh" --print-image)"
|
image="$("$argv0dir/10-create-image.sh" --print-image)"
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
|
|||||||
|
|
||||||
# run an interactive shell in the image
|
# run an interactive shell in the image
|
||||||
# using a rootless Podman container
|
# using a rootless Podman container
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
image="$("$argv0dir/10-create-image.sh" --print-image)"
|
image="$("$argv0dir/10-create-image.sh" --print-image)"
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ if [[ 1 == 1 ]]; then
|
|||||||
flags+=( -v "${argv0dir}/../../..:/home/upx/src/upx" )
|
flags+=( -v "${argv0dir}/../../..:/home/upx/src/upx" )
|
||||||
flags+=( -w /home/upx/src/upx ) # set working directory
|
flags+=( -w /home/upx/src/upx ) # set working directory
|
||||||
flags+=( --tmpfs /home/upx/.cache:rw,exec ) # mount a writeable tmpfs
|
flags+=( --tmpfs /home/upx/.cache:rw,exec ) # mount a writeable tmpfs
|
||||||
|
flags+=( --tmpfs /home/upx/.config:rw,exec ) # mount a writeable tmpfs
|
||||||
flags+=( --tmpfs /home/upx/.local:rw,exec ) # mount a writeable tmpfs
|
flags+=( --tmpfs /home/upx/.local:rw,exec ) # mount a writeable tmpfs
|
||||||
else
|
else
|
||||||
# run as user root 0:0
|
# run as user root 0:0
|
||||||
|
|||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
|
||||||
|
|
||||||
|
# rebuild stubs from source code
|
||||||
|
# (also see 20-image-run-shell.sh for more container usage examples)
|
||||||
|
# using a rootless Podman container
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
image="$("$argv0dir/10-create-image.sh" --print-image)"
|
||||||
|
|
||||||
|
flags=( --read-only --rm --pull=never )
|
||||||
|
flags+=( --cap-drop=all ) # drop all capabilities
|
||||||
|
flags+=( --network=none ) # no network needed
|
||||||
|
if [[ 1 == 1 ]]; then
|
||||||
|
# run as user upx 2000:2000
|
||||||
|
flags+=( --user 2000 )
|
||||||
|
# map container users 0..999 to subuid-users 1..1000, and map container user 2000 to current host user
|
||||||
|
flags+=( --uidmap=0:1:1000 --uidmap=2000:0:1 )
|
||||||
|
# map container groups 0..999 to subgid-groups 1..1000, and map container group 2000 to current host group
|
||||||
|
flags+=( --gidmap=0:1:1000 --gidmap=2000:0:1 )
|
||||||
|
# NOTE: we mount the upx top-level directory read-write under /home/upx/src/upx
|
||||||
|
# INFO: SELinux users *may* have to add ":z" to the volume mount flags; check the docs!
|
||||||
|
flags+=( -v "${argv0dir}/../../..:/home/upx/src/upx" )
|
||||||
|
fi
|
||||||
|
|
||||||
|
podman run "${flags[@]}" "$image" bash -c $'
|
||||||
|
set -ex; set -o pipefail
|
||||||
|
cd /home/upx/src/upx
|
||||||
|
# check whitespace
|
||||||
|
[[ -d .git ]] && bash ./misc/scripts/check_whitespace_git.sh
|
||||||
|
# rebuild docs
|
||||||
|
make -C doc clean all
|
||||||
|
# rebuild stubs
|
||||||
|
cd /home/upx/src/upx/src/stub
|
||||||
|
make maintainer-clean extra-clean
|
||||||
|
git status . || true # make sure the stub files got deleted
|
||||||
|
make extra-all all
|
||||||
|
echo "===== Rebuilt stubs. All done. ====="
|
||||||
|
exit 0
|
||||||
|
'
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
FROM docker.io/library/ubuntu:22.04
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
ENV UPX_CONTAINER_IMAGE_NAME=upx-stubtools-20221212-v6
|
FROM docker.io/library/ubuntu:24.04
|
||||||
|
ENV UPX_CONTAINER_IMAGE_NAME=upx-stubtools-20240405-v1
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
ENV LANG=C.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
|
|
||||||
@@ -7,19 +8,37 @@ ENV LANG=C.UTF-8
|
|||||||
RUN dpkg --add-architecture i386 \
|
RUN dpkg --add-architecture i386 \
|
||||||
&& apt-get update && apt-get upgrade -y \
|
&& apt-get update && apt-get upgrade -y \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
aria2 bash bash-completion ca-certificates dash git less libmpc3 libncurses5 \
|
aria2 bash bash-completion ca-certificates coreutils curl diffutils findutils git grep gzip \
|
||||||
make ncurses-term perl-base python2-minimal time wget xz-utils \
|
less libmpc3 make ncurses-term perl-base python3 sed sudo tar time util-linux wget xz-utils \
|
||||||
libc6:i386 zlib1g:i386 \
|
libc6:i386 zlib1g:i386 \
|
||||||
# the following packages are not required for rebuilding the stubs, but
|
# the following packages are not required for rebuilding the stubs, but
|
||||||
# they do make the image *much* more convenient and also allow building
|
# they do make the image *much* more convenient and also allow building
|
||||||
# the full UPX binary inside the container via CMake:
|
# the full UPX binary inside the container via CMake:
|
||||||
7zip bfs busybox bzip2 cabextract ccache chrpath cmake cpio curl elfutils fd-find file fzf \
|
7zip bat bfs btop bubblewrap busybox bzip2 bzip3 cabextract ccache chrpath cmake cpio \
|
||||||
g++ gawk gdb gojq ht htop hyperfine jq libzstd-dev lsb-release lz4 lzip lzop \
|
dash diffstat direnv dmidecode elfutils execstack eza fd-find file fish fzf \
|
||||||
mksh moreutils ninja-build p7zip parallel patch patchelf patchutils pax-utils paxctl \
|
g++ gawk gdb gh gojq ht htop hyperfine jq just ksh \
|
||||||
python3 python3-pyasn1 python3-pycryptodome python3-zstd \
|
lftp libzstd-dev lsb-release lsd lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \
|
||||||
re2c ripgrep rsync screen universal-ctags unzip vim yash zip zlib1g-dev zsh zstd \
|
p7zip parallel patch patchelf patchutils pax-utils proot \
|
||||||
|
python3-pyasn1 python3-pycryptodome python3-pycurl python3-tomli python3-tomli-w \
|
||||||
|
python3-yaml python3-zstd \
|
||||||
|
re2c ripgrep rsync screen socat strace universal-ctags unzip valgrind yash yq \
|
||||||
|
zip zlib1g-dev zoxide zsh zstd \
|
||||||
# extra packages for compiling with "gcc -m32" and "gcc -mx32":
|
# extra packages for compiling with "gcc -m32" and "gcc -mx32":
|
||||||
g++-multilib gcc-multilib \
|
g++-multilib gcc-multilib \
|
||||||
|
&& apt-get install -y \
|
||||||
|
gcc-riscv64-linux-gnu \
|
||||||
|
&& true
|
||||||
|
|
||||||
|
# install python2-minimal packages from Debian-11; REQUIRED
|
||||||
|
RUN cd /root \
|
||||||
|
&& aria2c --checksum=sha-256=85833c92314011b89bbead6f9a5a7a360b5ee4f9b95e001225afead4ebf9f7d3 \
|
||||||
|
'https://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8+deb11u1_amd64.deb' \
|
||||||
|
&& aria2c --checksum=sha-256=44f0cdc1a343303d31c55fcb3a6402cfe326adf749ec30e375e6e0c0c5f7c1f7 \
|
||||||
|
'https://ftp.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.18-8+deb11u1_amd64.deb' \
|
||||||
|
&& dpkg -i ./*.deb \
|
||||||
|
&& rm ./*.deb \
|
||||||
|
&& if ! test -f /usr/bin/python2; then ln -s -v python2.7 /usr/bin/python2; fi \
|
||||||
|
&& ldconfig \
|
||||||
&& true
|
&& true
|
||||||
|
|
||||||
# manually unpack and install compat libs from Ubuntu-16.04; REQUIRED
|
# manually unpack and install compat libs from Ubuntu-16.04; REQUIRED
|
||||||
@@ -44,23 +63,42 @@ 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 \
|
||||||
&& xzlist="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" \
|
&& 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 5.0.0 5.0.1 5.0.2" \
|
||||||
&& for v in $xzlist; 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 $xzlist; 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 \
|
||||||
&& true
|
&& true
|
||||||
|
|
||||||
# create default user upx:upx 2000:2000
|
# create default container user upx:upx 2000:2000
|
||||||
RUN useradd upx -U --uid 2000 --shell /bin/bash -m \
|
RUN useradd upx -U --uid 2000 --shell /bin/bash -m \
|
||||||
&& cd /home/upx && chmod 00700 . \
|
&& cd /home/upx && chmod 00700 . \
|
||||||
# prepare ~/.cache and ~/.local for possible tmpfs mounts
|
# prepare ~/.cache, ~/.config and ~/.local for possible tmpfs mounts
|
||||||
&& mkdir -p .cache/tmp .local/bin src/upx \
|
&& mkdir -p .cache/tmp .local/bin src/upx \
|
||||||
&& for d in ccache fontconfig go-build mesa_shader_cache tmp wine zig; do mkdir -p .cache/$d; done \
|
&& for d in ccache fontconfig go-build mesa_shader_cache parallel tmp wine zig; do mkdir -p .cache/$d; done \
|
||||||
|
&& for d in fish git helix kak nvim; do mkdir -p .config/$d; done \
|
||||||
&& for d in bin include lib share state; do mkdir -p .local/$d; done \
|
&& for d in bin include lib share state; do mkdir -p .local/$d; done \
|
||||||
&& ln -s .cache/wine .wine && ln -s .cache/tmp tmp \
|
&& ln -s .cache/wine .wine && ln -s .cache/tmp tmp \
|
||||||
|
# symlink upx-stubtools
|
||||||
&& ln -s /usr/local/bin/bin-upx-20221212 .local/bin/bin-upx \
|
&& ln -s /usr/local/bin/bin-upx-20221212 .local/bin/bin-upx \
|
||||||
|
# some convenience settings according to upx developer preferences
|
||||||
|
&& echo "alias path='echo PATH=\"\$PATH\"'" >> .bashrc \
|
||||||
|
&& echo "alias md=mkdir" >> .bashrc \
|
||||||
|
&& echo "alias rd=rmdir" >> .bashrc \
|
||||||
|
&& echo 'mdd() { mkdir "$1" && cd "$1"; }' >> .bashrc \
|
||||||
|
&& echo 'm() { make "$@"; }' >> .bashrc \
|
||||||
|
&& echo 'mm() { make -j8 "$@"; }' >> .bashrc \
|
||||||
|
&& echo 'tn() { time nice "$@"; }' >> .bashrc \
|
||||||
|
&& echo 'tnm() { time nice make "$@"; }' >> .bashrc \
|
||||||
|
&& echo 'tnmm() { time nice make -j8 "$@"; }' >> .bashrc \
|
||||||
|
&& echo 'source /usr/share/bash-completion/completions/make' >> .bashrc \
|
||||||
|
&& echo 'complete -F _make m mm tnm tnmm' >> .bashrc \
|
||||||
|
&& echo 'eval "$(zoxide init bash)"' >> .bashrc \
|
||||||
|
&& echo "alias zz=zi\nalias y=z\nalias yy=zi" >> .bashrc \
|
||||||
|
&& echo "alias cd..='cd ..'" >> .bashrc \
|
||||||
|
&& echo "alias ..='cd ..'" >> .bashrc \
|
||||||
|
&& echo "alias .='cd ..'" >> .bashrc \
|
||||||
&& chown -R upx:upx . \
|
&& chown -R upx:upx . \
|
||||||
&& true
|
&& true
|
||||||
USER upx
|
USER upx
|
||||||
|
|||||||
Generated
+783
-638
File diff suppressed because it is too large
Load Diff
@@ -25,13 +25,12 @@ LC_ALL=C sort -z | xargs -0r perl -n -e '
|
|||||||
if (m,[\x00\x01\x02\x7f\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
|
if (m,[\x00\x01\x02\x7f\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
|
||||||
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
|
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
|
||||||
if (m,([ \t]+)$,) {
|
if (m,([ \t]+)$,) {
|
||||||
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
|
if ($ARGV =~ m,\.patch$,) { }
|
||||||
if ($1 ne " " || $ARGV !~ m,\.md$,) {
|
else { print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1); }
|
||||||
print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (m,\t,) {
|
if (m,\t,) {
|
||||||
if ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { }
|
if ($ARGV =~ m,\.patch$,) { }
|
||||||
|
elsif ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { }
|
||||||
elsif ($ARGV =~ m,\.mk$,) { }
|
elsif ($ARGV =~ m,\.mk$,) { }
|
||||||
elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { }
|
elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { }
|
||||||
elsif ($ARGV =~ m,/src/stub/src/arch/.*/lzma\w+\.S$,) { }
|
elsif ($ARGV =~ m,/src/stub/src/arch/.*/lzma\w+\.S$,) { }
|
||||||
|
|||||||
@@ -19,13 +19,12 @@ git ls-files --full-name -z | perl -0 -n -e '
|
|||||||
if (m,[\x00\x01\x02\x7f\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
|
if (m,[\x00\x01\x02\x7f\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
|
||||||
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
|
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
|
||||||
if (m,([ \t]+)$,) {
|
if (m,([ \t]+)$,) {
|
||||||
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
|
if ($ARGV =~ m,\.patch$,) { }
|
||||||
if ($1 ne " " || $ARGV !~ m,\.md$,) {
|
else { print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1); }
|
||||||
print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (m,\t,) {
|
if (m,\t,) {
|
||||||
if ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { }
|
if ($ARGV =~ m,\.patch$,) { }
|
||||||
|
elsif ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { }
|
||||||
elsif ($ARGV =~ m,\.mk$,) { }
|
elsif ($ARGV =~ m,\.mk$,) { }
|
||||||
elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { }
|
elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { }
|
||||||
elsif ($ARGV =~ m,/src/stub/src/arch/.*/lzma\w+\.S$,) { }
|
elsif ($ARGV =~ m,/src/stub/src/arch/.*/lzma\w+\.S$,) { }
|
||||||
|
|||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
|
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# simulate "readlink -en FILE"
|
||||||
|
# - result may differ from actual readlink(1) for edge cases
|
||||||
|
# - works with Python2 and Python3
|
||||||
|
#
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
import os, sys
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
sys.exit(1)
|
||||||
|
real_path = os.path.realpath(sys.argv[1])
|
||||||
|
if not os.path.exists(real_path):
|
||||||
|
sys.exit(1)
|
||||||
|
sys.stdout.write(real_path)
|
||||||
|
sys.stdout.flush()
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
|
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# simulate "readlink -fn FILE" for systems that lack it (e.g. macOS-11)
|
||||||
|
# - result may differ from actual readlink(1) for edge cases
|
||||||
|
# - works with Python2 and Python3
|
||||||
|
#
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
import os, sys
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
sys.exit(1)
|
||||||
|
real_path = os.path.realpath(sys.argv[1])
|
||||||
|
sys.stdout.write(real_path)
|
||||||
|
sys.stdout.flush()
|
||||||
@@ -8,31 +8,32 @@ set -e; set -o pipefail
|
|||||||
|
|
||||||
cmake_config_flags=()
|
cmake_config_flags=()
|
||||||
|
|
||||||
|
# promote an environment variable to a CMake cache entry:
|
||||||
__add_cmake_config() {
|
__add_cmake_config() {
|
||||||
[[ -z "${!1}" ]] || cmake_config_flags+=( -D$1="${!1}" )
|
[[ -z "${!1}" ]] || cmake_config_flags+=( -D$1="${!1}" )
|
||||||
}
|
}
|
||||||
|
|
||||||
# pass common CMake settings from environment to cmake
|
# pass common CMake settings
|
||||||
for v in CMAKE_VERBOSE_MAKEFILE; do
|
for v in CMAKE_INSTALL_PREFIX CMAKE_VERBOSE_MAKEFILE; do
|
||||||
__add_cmake_config $v
|
__add_cmake_config $v
|
||||||
done
|
done
|
||||||
# pass common CMake toolchain settings from environment to cmake
|
# pass common CMake toolchain settings
|
||||||
for v in CMAKE_ADDR2LINE CMAKE_AR CMAKE_DLLTOOL CMAKE_LINKER CMAKE_NM CMAKE_OBJCOPY CMAKE_OBJDUMP CMAKE_RANLIB CMAKE_READELF CMAKE_STRIP CMAKE_TAPI; do
|
for v in CMAKE_ADDR2LINE CMAKE_AR CMAKE_DLLTOOL CMAKE_LINKER CMAKE_NM CMAKE_OBJCOPY CMAKE_OBJDUMP CMAKE_RANLIB CMAKE_READELF CMAKE_STRIP CMAKE_TAPI; do
|
||||||
__add_cmake_config $v
|
__add_cmake_config $v
|
||||||
done
|
done
|
||||||
# pass common CMake LTO toolchain settings from environment to cmake (for use with "-flto")
|
# pass common CMake LTO toolchain settings
|
||||||
for v in CMAKE_C_COMPILER_AR CMAKE_C_COMPILER_RANLIB CMAKE_CXX_COMPILER_AR CMAKE_CXX_COMPILER_RANLIB; do
|
for v in CMAKE_C_COMPILER_AR CMAKE_C_COMPILER_RANLIB CMAKE_CXX_COMPILER_AR CMAKE_CXX_COMPILER_RANLIB; do
|
||||||
__add_cmake_config $v
|
__add_cmake_config $v
|
||||||
done
|
done
|
||||||
# pass common CMake cross compilation settings from environment to cmake
|
# pass common CMake cross compilation settings
|
||||||
for v in CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PROCESSOR CMAKE_CROSSCOMPILING_EMULATOR; do
|
for v in CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PROCESSOR CMAKE_CROSSCOMPILING_EMULATOR; do
|
||||||
__add_cmake_config $v
|
__add_cmake_config $v
|
||||||
done
|
done
|
||||||
# pass UPX config options from environment to cmake; see CMakeLists.txt
|
# pass UPX config options; see CMakeLists.txt
|
||||||
for v in UPX_CONFIG_DISABLE_GITREV UPX_CONFIG_DISABLE_SANITIZE UPX_CONFIG_DISABLE_WSTRICT UPX_CONFIG_DISABLE_WERROR UPX_CONFIG_DISABLE_SELF_PACK_TEST; do
|
for v in UPX_CONFIG_DISABLE_GITREV UPX_CONFIG_DISABLE_SANITIZE UPX_CONFIG_DISABLE_WERROR UPX_CONFIG_DISABLE_WSTRICT UPX_CONFIG_DISABLE_SELF_PACK_TEST UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS; do
|
||||||
__add_cmake_config $v
|
__add_cmake_config $v
|
||||||
done
|
done
|
||||||
# pass UPX extra compile options from environment to cmake; see CMakeLists.txt
|
# pass UPX extra compile options; see CMakeLists.txt
|
||||||
for v in UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2 UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD; do
|
for v in UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2 UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD; do
|
||||||
__add_cmake_config $v
|
__add_cmake_config $v
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -29,6 +29,6 @@ fi
|
|||||||
# limit memory usage to 1 GiB (in case of clang-format problems with invalid files)
|
# limit memory usage to 1 GiB (in case of clang-format problems with invalid files)
|
||||||
ulimit -v 1048576 || true
|
ulimit -v 1048576 || true
|
||||||
|
|
||||||
#echo $UPX_CLANG_FORMAT
|
#echo "$UPX_CLANG_FORMAT"
|
||||||
exec "$UPX_CLANG_FORMAT" -style=file "$@"
|
exec "$UPX_CLANG_FORMAT" -style=file "$@"
|
||||||
exit 99
|
exit 99
|
||||||
|
|||||||
+136
-32
@@ -6,7 +6,9 @@ argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
|
|||||||
#
|
#
|
||||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
#
|
#
|
||||||
# mimic running "ctest", i.e. the "test" section of CMakeLists.txt; does not redirect stdout
|
# mimic running "ctest", i.e. the "test" section of CMakeLists.txt
|
||||||
|
# - does not redirect stdout
|
||||||
|
# - allows freely setting $upx_exe_runner, while CMake is restricted to configure-time settings
|
||||||
#
|
#
|
||||||
# requires:
|
# requires:
|
||||||
# $upx_exe (required, but with convenience fallback "./upx")
|
# $upx_exe (required, but with convenience fallback "./upx")
|
||||||
@@ -14,6 +16,12 @@ argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
|
|||||||
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
|
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Debugging aid for locating failing commands. Depends on 'bash' shell.
|
||||||
|
# (BASH_LINENO is relative to current FUNCTION only; non-function ==> 0)
|
||||||
|
# Notice single-quoting of entire first argument.
|
||||||
|
trap 'echo ERROR: pwd=\"$PWD\" file=\"$BASH_SOURCE\" line=${BASH_LINENO[0]} cmd=\"$BASH_COMMAND\"' ERR
|
||||||
|
# Example: "false a b c" ==> ERROR: pwd="path/misc/testsuite" file="./mimic_ctest.sh" line=0 cmd="false a b c"
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# init & checks
|
# init & checks
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
@@ -24,57 +32,153 @@ if [[ -z $upx_exe ]]; then echo "UPX-ERROR: please set \$upx_exe"; exit 1; fi
|
|||||||
if [[ ! -f $upx_exe ]]; then echo "UPX-ERROR: file '$upx_exe' does not exist"; exit 1; fi
|
if [[ ! -f $upx_exe ]]; then echo "UPX-ERROR: file '$upx_exe' does not exist"; exit 1; fi
|
||||||
upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
||||||
[[ -f $upx_exe ]] || exit 1
|
[[ -f $upx_exe ]] || exit 1
|
||||||
upx_run=()
|
|
||||||
|
# set emu and run_upx
|
||||||
|
emu=()
|
||||||
if [[ -n $upx_exe_runner ]]; then
|
if [[ -n $upx_exe_runner ]]; then
|
||||||
# usage examples:
|
# usage examples:
|
||||||
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
||||||
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
||||||
# export upx_exe_runner="wine"
|
# export upx_exe_runner="wine"
|
||||||
IFS=' ' read -r -a upx_run <<< "$upx_exe_runner" # split at spaces into array
|
IFS=' ' read -r -a emu <<< "$upx_exe_runner" # split at spaces into array
|
||||||
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
||||||
IFS=';' read -r -a upx_run <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
IFS=';' read -r -a emu <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
||||||
fi
|
fi
|
||||||
upx_runner=( "${upx_run[@]}" )
|
run_upx=( "${emu[@]}" "$upx_exe" )
|
||||||
upx_run+=( "$upx_exe" )
|
echo "run_upx='${run_upx[*]}'"
|
||||||
echo "upx_run='${upx_run[*]}'"
|
|
||||||
|
|
||||||
# upx_run sanity check
|
# run_upx sanity check
|
||||||
if ! "${upx_run[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
"${run_upx[@]}" --version-short || true
|
||||||
if ! "${upx_run[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
if ! "${run_upx[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||||
if ! "${upx_run[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||||
|
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# see CMakeLists.txt
|
# see CMakeLists.txt
|
||||||
|
#
|
||||||
|
# IDEA: create a Makefile and use "make -j8" so that these tests can
|
||||||
|
# run in parallel much like "ctest --parallel 8"
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
export UPX="--no-color --no-progress"
|
# similar to cmake function upx_cache_bool_vars()
|
||||||
|
set_cmake_bool_vars() {
|
||||||
"${upx_run[@]}" --version
|
local default_value="$1"; shift
|
||||||
"${upx_run[@]}" --help
|
local var_name
|
||||||
"${upx_run[@]}" --sysinfo -v
|
for var_name do
|
||||||
|
case "${!var_name}" in
|
||||||
case "$UPX_CONFIG_DISABLE_SELF_PACK_TEST" in
|
0 | FALSE | OFF | false | off) eval "export $var_name=OFF" ;;
|
||||||
"" | "0" | "FALSE" | "OFF") ;;
|
1 | TRUE | ON | true | on) eval "export $var_name=ON" ;;
|
||||||
*) echo "Self-pack test disabled. All done."; exit 0 ;;
|
*) eval "export $var_name=$default_value" ;;
|
||||||
esac
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
set -x
|
||||||
|
set_cmake_bool_vars OFF UPX_CONFIG_DISABLE_SELF_PACK_TEST
|
||||||
|
set_cmake_bool_vars OFF UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST
|
||||||
|
set_cmake_bool_vars OFF UPX_CONFIG_DISABLE_RUN_PACKED_TEST
|
||||||
|
if [[ "${emu[0]}" == *valgrind* ]]; then # valgrind is SLOW
|
||||||
|
set_cmake_bool_vars ON UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS
|
||||||
|
else
|
||||||
|
set_cmake_bool_vars OFF UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS
|
||||||
|
fi
|
||||||
|
|
||||||
|
export UPX="--prefer-ucl --no-color --no-progress"
|
||||||
|
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
||||||
|
export UPX_DEBUG_DOCTEST_DISABLE=1 # already checked above
|
||||||
|
|
||||||
|
"${run_upx[@]}" --version
|
||||||
|
"${run_upx[@]}" --version-short
|
||||||
|
"${run_upx[@]}" --license
|
||||||
|
"${run_upx[@]}" --help
|
||||||
|
"${run_upx[@]}" --help-short
|
||||||
|
"${run_upx[@]}" --help-verbose
|
||||||
|
"${run_upx[@]}" --sysinfo
|
||||||
|
"${run_upx[@]}" --sysinfo -v
|
||||||
|
"${run_upx[@]}" --sysinfo -vv
|
||||||
|
|
||||||
|
if [[ $UPX_CONFIG_DISABLE_SELF_PACK_TEST == ON ]]; then
|
||||||
|
echo "Self-pack test disabled. All done."; exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
exe=".out"
|
exe=".out"
|
||||||
upx_self_exe=$upx_exe
|
upx_self_exe=$upx_exe
|
||||||
fo="--force-overwrite"
|
fo="--force-overwrite"
|
||||||
|
|
||||||
"${upx_run[@]}" -3 "${upx_self_exe}" ${fo} -o upx-packed${exe}
|
"${run_upx[@]}" -3 "${upx_self_exe}" ${fo} -o upx-packed${exe}
|
||||||
"${upx_run[@]}" -3 --nrv2b "${upx_self_exe}" ${fo} -o upx-packed-n2b${exe}
|
"${run_upx[@]}" -3 --all-filters "${upx_self_exe}" ${fo} -o upx-packed-fa${exe}
|
||||||
"${upx_run[@]}" -3 --nrv2d "${upx_self_exe}" ${fo} -o upx-packed-n2d${exe}
|
"${run_upx[@]}" -3 --no-filter "${upx_self_exe}" ${fo} -o upx-packed-fn${exe}
|
||||||
"${upx_run[@]}" -3 --nrv2e "${upx_self_exe}" ${fo} -o upx-packed-n2e${exe}
|
"${run_upx[@]}" -3 --all-filters --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-fr${exe}
|
||||||
"${upx_run[@]}" -1 --lzma "${upx_self_exe}" ${fo} -o upx-packed-lzma${exe}
|
"${run_upx[@]}" -3 --nrv2b "${upx_self_exe}" ${fo} -o upx-packed-nrv2b${exe}
|
||||||
|
"${run_upx[@]}" -3 --nrv2d "${upx_self_exe}" ${fo} -o upx-packed-nrv2d${exe}
|
||||||
|
"${run_upx[@]}" -3 --nrv2e "${upx_self_exe}" ${fo} -o upx-packed-nrv2e${exe}
|
||||||
|
"${run_upx[@]}" -1 --lzma "${upx_self_exe}" ${fo} -o upx-packed-lzma${exe}
|
||||||
|
|
||||||
"${upx_run[@]}" -l upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe}
|
"${run_upx[@]}" -l upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-fr${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe}
|
||||||
"${upx_run[@]}" --fileinfo upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe}
|
"${run_upx[@]}" --fileinfo upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-fr${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe}
|
||||||
"${upx_run[@]}" -t upx-packed${exe} upx-packed-n2b${exe} upx-packed-n2d${exe} upx-packed-n2e${exe} upx-packed-lzma${exe}
|
"${run_upx[@]}" -t upx-packed${exe} upx-packed-fa${exe} upx-packed-fn${exe} upx-packed-fr${exe} upx-packed-nrv2b${exe} upx-packed-nrv2d${exe} upx-packed-nrv2e${exe} upx-packed-lzma${exe}
|
||||||
"${upx_run[@]}" -d upx-packed${exe} ${fo} -o upx-unpacked${exe}
|
|
||||||
|
|
||||||
set -x
|
"${run_upx[@]}" -d upx-packed${exe} ${fo} -o upx-unpacked${exe}
|
||||||
"${upx_runner[@]}" ./upx-unpacked${exe} --version-short
|
"${run_upx[@]}" -d upx-packed-fa${exe} ${fo} -o upx-unpacked-fa${exe}
|
||||||
"${upx_runner[@]}" ./upx-packed${exe} --version-short
|
"${run_upx[@]}" -d upx-packed-fn${exe} ${fo} -o upx-unpacked-fn${exe}
|
||||||
|
"${run_upx[@]}" -d upx-packed-fr${exe} ${fo} -o upx-unpacked-fr${exe}
|
||||||
|
"${run_upx[@]}" -d upx-packed-nrv2b${exe} ${fo} -o upx-unpacked-nrv2b${exe}
|
||||||
|
"${run_upx[@]}" -d upx-packed-nrv2d${exe} ${fo} -o upx-unpacked-nrv2d${exe}
|
||||||
|
"${run_upx[@]}" -d upx-packed-nrv2e${exe} ${fo} -o upx-unpacked-nrv2e${exe}
|
||||||
|
"${run_upx[@]}" -d upx-packed-lzma${exe} ${fo} -o upx-unpacked-lzma${exe}
|
||||||
|
|
||||||
|
# all unpacked files must be identical
|
||||||
|
cmp -s upx-unpacked${exe} upx-unpacked-fa${exe}
|
||||||
|
cmp -s upx-unpacked${exe} upx-unpacked-fn${exe}
|
||||||
|
cmp -s upx-unpacked${exe} upx-unpacked-fr${exe}
|
||||||
|
cmp -s upx-unpacked${exe} upx-unpacked-nrv2b${exe}
|
||||||
|
cmp -s upx-unpacked${exe} upx-unpacked-nrv2d${exe}
|
||||||
|
cmp -s upx-unpacked${exe} upx-unpacked-nrv2e${exe}
|
||||||
|
cmp -s upx-unpacked${exe} upx-unpacked-lzma${exe}
|
||||||
|
|
||||||
|
if [[ $UPX_CONFIG_DISABLE_RUN_UNPACKED_TEST != ON ]]; then
|
||||||
|
"${emu[@]}" ./upx-unpacked${exe} --version-short
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST != ON ]]; then
|
||||||
|
"${emu[@]}" ./upx-packed${exe} --version-short
|
||||||
|
"${emu[@]}" ./upx-packed-fa${exe} --version-short
|
||||||
|
"${emu[@]}" ./upx-packed-fn${exe} --version-short
|
||||||
|
"${emu[@]}" ./upx-packed-fr${exe} --version-short
|
||||||
|
"${emu[@]}" ./upx-packed-nrv2b${exe} --version-short
|
||||||
|
"${emu[@]}" ./upx-packed-nrv2d${exe} --version-short
|
||||||
|
"${emu[@]}" ./upx-packed-nrv2e${exe} --version-short
|
||||||
|
"${emu[@]}" ./upx-packed-lzma${exe} --version-short
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS != ON ]]; then
|
||||||
|
set +x
|
||||||
|
for method in nrv2b nrv2d nrv2e lzma; do
|
||||||
|
for level in 1 2 3 4 5 6 7; do
|
||||||
|
for small in normal small; do
|
||||||
|
s="${method}-${level}"
|
||||||
|
ss=
|
||||||
|
if [[ $small == "small" ]]; then
|
||||||
|
s="${method}-${level}-${small}"
|
||||||
|
ss="--small"
|
||||||
|
fi
|
||||||
|
echo "========== $s =========="
|
||||||
|
"${run_upx[@]}" -qq --${method} -${level} ${ss} --all-filters --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-${s}${exe}
|
||||||
|
"${run_upx[@]}" -qq -l upx-packed-${s}${exe}
|
||||||
|
"${run_upx[@]}" -qq --fileinfo upx-packed-${s}${exe}
|
||||||
|
"${run_upx[@]}" -qq -t upx-packed-${s}${exe}
|
||||||
|
"${run_upx[@]}" -qq -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe}
|
||||||
|
cmp -s upx-unpacked${exe} upx-unpacked-${s}${exe}
|
||||||
|
if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST != ON ]]; then
|
||||||
|
: ${upx_run_packed_test_count:=20}
|
||||||
|
for ((i = 0; i < $upx_run_packed_test_count; i++)); do
|
||||||
|
"${emu[@]}" ./upx-packed-${s}${exe} --version-short
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "run_upx='${run_upx[*]}'"
|
||||||
echo "All done."
|
echo "All done."
|
||||||
|
|||||||
Executable
+46
@@ -0,0 +1,46 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
#
|
||||||
|
# mimic running "ctest", i.e. the "test" section of CMakeLists.txt
|
||||||
|
# - does not redirect stdout
|
||||||
|
# - allows freely setting $upx_exe_runner, while CMake is restricted to configure-time settings
|
||||||
|
#
|
||||||
|
# requires:
|
||||||
|
# $upx_exe (required, but with convenience fallback "./upx")
|
||||||
|
# optional settings:
|
||||||
|
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
|
||||||
|
#
|
||||||
|
|
||||||
|
cat >catch-sigsegv.gdb <<'EOF'
|
||||||
|
catch signal SIGSEGV
|
||||||
|
commands
|
||||||
|
x/i $pc
|
||||||
|
info reg
|
||||||
|
x/32i $pc-0x20
|
||||||
|
quit 77
|
||||||
|
end
|
||||||
|
EOF
|
||||||
|
|
||||||
|
catcher=$(readlink -fn catch-sigsegv.gdb)
|
||||||
|
|
||||||
|
function emu_gdb() {
|
||||||
|
gdb -q -x "$catcher" <<EOF --args "$@"
|
||||||
|
run
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -n $upx_exe_runner ]]; then
|
||||||
|
true
|
||||||
|
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
upx_exe_runner=emu_gdb
|
||||||
|
: ${upx_run_packed_test_count:=20}
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$argv0dir/mimic_ctest.sh"
|
||||||
+170
-146
@@ -10,10 +10,11 @@ argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
|
|||||||
# $upx_exe (required, but with convenience fallback "./upx")
|
# $upx_exe (required, but with convenience fallback "./upx")
|
||||||
# optional settings:
|
# optional settings:
|
||||||
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
|
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
|
||||||
|
# $upx_test_file
|
||||||
#
|
#
|
||||||
|
|
||||||
# IMPORTANT NOTE: do NOT run as user root!!
|
# IMPORTANT NOTE: this script only works on Unix
|
||||||
# IMPORTANT NOTE: this script only works on Unix!!
|
# IMPORTANT NOTE: do NOT run as user root!
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
# disable on macOS for now, see https://github.com/upx/upx/issues/612
|
# disable on macOS for now, see https://github.com/upx/upx/issues/612
|
||||||
@@ -40,26 +41,28 @@ if [[ -z $upx_exe ]]; then echo "UPX-ERROR: please set \$upx_exe"; exit 1; fi
|
|||||||
if [[ ! -f $upx_exe ]]; then echo "UPX-ERROR: file '$upx_exe' does not exist"; exit 1; fi
|
if [[ ! -f $upx_exe ]]; then echo "UPX-ERROR: file '$upx_exe' does not exist"; exit 1; fi
|
||||||
upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
||||||
[[ -f $upx_exe ]] || exit 1
|
[[ -f $upx_exe ]] || exit 1
|
||||||
upx_run=()
|
|
||||||
|
# set emu and run_upx
|
||||||
|
emu=()
|
||||||
if [[ -n $upx_exe_runner ]]; then
|
if [[ -n $upx_exe_runner ]]; then
|
||||||
# usage examples:
|
# usage examples:
|
||||||
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
||||||
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
||||||
# export upx_exe_runner="wine"
|
# export upx_exe_runner="wine"
|
||||||
IFS=' ' read -r -a upx_run <<< "$upx_exe_runner" # split at spaces into array
|
IFS=' ' read -r -a emu <<< "$upx_exe_runner" # split at spaces into array
|
||||||
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
||||||
IFS=';' read -r -a upx_run <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
IFS=';' read -r -a emu <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
||||||
fi
|
fi
|
||||||
upx_run+=( "$upx_exe" )
|
run_upx=( "${emu[@]}" "$upx_exe" )
|
||||||
echo "upx_run='${upx_run[*]}'"
|
echo "run_upx='${run_upx[*]}'"
|
||||||
|
|
||||||
# upx_run sanity check
|
# run_upx sanity check
|
||||||
if ! "${upx_run[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
if ! "${run_upx[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||||
if ! "${upx_run[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||||
if ! "${upx_run[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# util
|
# util functions
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
exit_code=0
|
exit_code=0
|
||||||
@@ -160,18 +163,7 @@ create_files() {
|
|||||||
chmod -R a-w z_dir_4
|
chmod -R a-w z_dir_4
|
||||||
}
|
}
|
||||||
|
|
||||||
#***********************************************************************
|
print_header() {
|
||||||
#
|
|
||||||
#***********************************************************************
|
|
||||||
|
|
||||||
#set -x # debug
|
|
||||||
|
|
||||||
export UPX="--prefer-ucl --no-color --no-progress"
|
|
||||||
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
|
||||||
export UPX_DEBUG_DOCTEST_VERBOSE=0
|
|
||||||
export NO_COLOR=1
|
|
||||||
|
|
||||||
testsuite_header() {
|
|
||||||
local x='==========='; x="$x$x$x$x$x$x$x"
|
local x='==========='; x="$x$x$x$x$x$x$x"
|
||||||
echo -e "\n${x}\n${1}\n${x}\n"
|
echo -e "\n${x}\n${1}\n${x}\n"
|
||||||
}
|
}
|
||||||
@@ -186,206 +178,238 @@ leave_dir() {
|
|||||||
cd ..
|
cd ..
|
||||||
}
|
}
|
||||||
|
|
||||||
# create a tmpdir in current directory
|
#***********************************************************************
|
||||||
|
# setup
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
#set -x # debug
|
||||||
|
|
||||||
|
export UPX="--prefer-ucl --no-color --no-progress"
|
||||||
|
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
||||||
|
export UPX_DEBUG_DOCTEST_DISABLE=1 # already checked above
|
||||||
|
|
||||||
|
# get $test_file
|
||||||
|
if [[ -f $upx_test_file ]]; then
|
||||||
|
test_file="$(readlink -fn "$upx_test_file")"
|
||||||
|
else
|
||||||
|
for test_file in /usr/bin/gmake /usr/bin/make /usr/bin/env /bin/ls; do
|
||||||
|
if [[ -f $test_file ]]; then
|
||||||
|
test_file="$(readlink -fn "$test_file")"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
ls -l "$test_file"
|
||||||
|
file "$test_file" || true
|
||||||
|
|
||||||
|
# create and enter a tmpdir in the current directory
|
||||||
tmpdir="$(mktemp -d tmp-upx-test-XXXXXX)"
|
tmpdir="$(mktemp -d tmp-upx-test-XXXXXX)"
|
||||||
cd "./$tmpdir" || exit 1
|
cd "./$tmpdir" || exit 1
|
||||||
|
|
||||||
if [[ -f /bin/ls ]]; then
|
#***********************************************************************
|
||||||
test_file="$(readlink -fn /bin/ls)"
|
# default
|
||||||
else
|
#***********************************************************************
|
||||||
test_file="$(readlink -fn /usr/bin/env)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
testsuite_header "default"
|
print_header "default"
|
||||||
flags="-qq -1 --no-filter"
|
flags="-qq -2 --no-filter"
|
||||||
mkdir default
|
mkdir default
|
||||||
cd default
|
cd default
|
||||||
create_files
|
create_files
|
||||||
enter_dir z_dir_1
|
enter_dir z_dir_1
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||||
assert_symlink_to_dir z_symlink_dir
|
assert_symlink_to_dir z_symlink_dir
|
||||||
assert_symlink_dangling z_symlink_dangling
|
assert_symlink_dangling z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
enter_dir z_dir_2
|
enter_dir z_dir_2
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||||
assert_symlink_to_dir z_symlink_dir
|
assert_symlink_to_dir z_symlink_dir
|
||||||
assert_symlink_dangling z_symlink_dangling
|
assert_symlink_dangling z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
enter_dir z_dir_3
|
enter_dir z_dir_3
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||||
assert_symlink_to_dir z_symlink_dir
|
assert_symlink_to_dir z_symlink_dir
|
||||||
assert_symlink_dangling z_symlink_dangling
|
assert_symlink_dangling z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
enter_dir z_dir_4
|
enter_dir z_dir_4
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file && failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link && failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||||
assert_symlink_to_dir z_symlink_dir
|
assert_symlink_to_dir z_symlink_dir
|
||||||
assert_symlink_dangling z_symlink_dangling
|
assert_symlink_dangling z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
testsuite_header "force-overwrite"
|
#***********************************************************************
|
||||||
flags="-qq -1 --no-filter --force-overwrite"
|
# force-overwrite
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
print_header "force-overwrite"
|
||||||
|
flags="-qq -2 --no-filter --force-overwrite"
|
||||||
mkdir force-overwrite
|
mkdir force-overwrite
|
||||||
cd force-overwrite
|
cd force-overwrite
|
||||||
create_files
|
create_files
|
||||||
enter_dir z_dir_1
|
enter_dir z_dir_1
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||||
assert_file z_symlink_file z_symlink_file_link
|
assert_file z_symlink_file z_symlink_file_link
|
||||||
assert_file z_symlink_dir
|
assert_file z_symlink_dir
|
||||||
assert_file z_symlink_dangling
|
assert_file z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
enter_dir z_dir_2
|
enter_dir z_dir_2
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||||
assert_file z_symlink_file z_symlink_file_link
|
assert_file z_symlink_file z_symlink_file_link
|
||||||
assert_file z_symlink_dir
|
assert_file z_symlink_dir
|
||||||
assert_file z_symlink_dangling
|
assert_file z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
enter_dir z_dir_3
|
enter_dir z_dir_3
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||||
assert_symlink_to_dir z_symlink_dir
|
assert_symlink_to_dir z_symlink_dir
|
||||||
assert_symlink_dangling z_symlink_dangling
|
assert_symlink_dangling z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
enter_dir z_dir_4
|
enter_dir z_dir_4
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||||
assert_symlink_to_dir z_symlink_dir
|
assert_symlink_to_dir z_symlink_dir
|
||||||
assert_symlink_dangling z_symlink_dangling
|
assert_symlink_dangling z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
if [[ 1 == 1 ]]; then
|
#***********************************************************************
|
||||||
testsuite_header "link"
|
# link
|
||||||
flags="-qq -1 --no-filter --link"
|
#***********************************************************************
|
||||||
|
|
||||||
|
print_header "link"
|
||||||
|
flags="-qq -2 --no-filter --link"
|
||||||
mkdir link
|
mkdir link
|
||||||
cd link
|
cd link
|
||||||
create_files
|
create_files
|
||||||
enter_dir z_dir_1
|
enter_dir z_dir_1
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||||
assert_file z_symlink_file z_symlink_file_link
|
assert_file z_symlink_file z_symlink_file_link
|
||||||
assert_file z_symlink_dir
|
assert_file z_symlink_dir
|
||||||
assert_file z_symlink_dangling
|
assert_file z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
enter_dir z_dir_2
|
enter_dir z_dir_2
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new || failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new || failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir || failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling || failed 18
|
||||||
assert_file z_symlink_file z_symlink_file_link
|
assert_file z_symlink_file z_symlink_file_link
|
||||||
assert_file z_symlink_dir
|
assert_file z_symlink_dir
|
||||||
assert_file z_symlink_dangling
|
assert_file z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
enter_dir z_dir_3
|
enter_dir z_dir_3
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file || failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file || failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 || failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||||
assert_symlink_to_dir z_symlink_dir
|
assert_symlink_to_dir z_symlink_dir
|
||||||
assert_symlink_dangling z_symlink_dangling
|
assert_symlink_dangling z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
enter_dir z_dir_4
|
enter_dir z_dir_4
|
||||||
"${upx_run[@]}" $flags z_symlink_file && failed 10
|
"${run_upx[@]}" $flags z_symlink_file && failed 10
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_new && failed 11
|
"${run_upx[@]}" $flags "$test_file" -o z_file_new && failed 11
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_dir && failed 12
|
"${run_upx[@]}" $flags "$test_file" -o z_dir && failed 12
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file && failed 13
|
"${run_upx[@]}" $flags "$test_file" -o z_file && failed 13
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
"${run_upx[@]}" $flags "$test_file" -o z_file_link_1 && failed 14
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file || failed 15
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_file_link || failed 16
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dir && failed 17
|
||||||
"${upx_run[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
"${run_upx[@]}" $flags "$test_file" -o z_symlink_dangling && failed 18
|
||||||
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
assert_symlink_to_file z_symlink_file z_symlink_file_link
|
||||||
assert_symlink_to_dir z_symlink_dir
|
assert_symlink_to_dir z_symlink_dir
|
||||||
assert_symlink_dangling z_symlink_dangling
|
assert_symlink_dangling z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
|
||||||
|
#***********************************************************************
|
||||||
|
# done
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
+147
-147
@@ -46,164 +46,164 @@ b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.
|
|||||||
a0950546dc17fca9437219431d8ddb0249ce5b08e899e0c799a87ac982adee70 *powerpc64le-linux.elf/upx-3.95
|
a0950546dc17fca9437219431d8ddb0249ce5b08e899e0c799a87ac982adee70 *powerpc64le-linux.elf/upx-3.95
|
||||||
"
|
"
|
||||||
expected_sha256sums__t110_compress_ucl_nrv2b_3_no_filter="\
|
expected_sha256sums__t110_compress_ucl_nrv2b_3_no_filter="\
|
||||||
afd8b4ec4379b013887e2dbb9cb07ed8e19942c6c5b72bd42fa20d2d43e35d52 *amd64-linux.elf/upx-3.91
|
836d9c5d9092421e49aeb573cde449ef740afbfea54d131ccbd88d8c7d87860d *amd64-linux.elf/upx-3.91
|
||||||
320f5819d96f575ea4abad04c5a1bac53274a5d4704ff530ee778acfa261376c *amd64-linux.elf/upx-3.95
|
9776a2d030719f9d74413d17c1bb732aaabb610b341031facd2c1a75348fc661 *amd64-linux.elf/upx-3.95
|
||||||
a8804bce00be8e2f9d3874c8fc884e69c19efc2f0fd07272e7d0749efd36f381 *amd64-win64.pe/upx-3.95.exe
|
822718cc0f6ac5e57bb23eeb65be6f3f7e73df8b062853abddcc924ec8207596 *amd64-win64.pe/upx-3.95.exe
|
||||||
80ff4e72220302cdccbdce753981d9a36596941ffcd9231317c5cb53f988ac72 *arm-linux.elf/upx-3.95
|
40353c37020fd4bb713c5d54273b8dc07666e262b83a4f0652ccb8a236465f9c *arm-linux.elf/upx-3.95
|
||||||
4e3db49fb086c4293b8a5809c166546d3a33f731b6ef5565cc0566d491f91cf2 *arm-wince.pe/upx-3.91.exe
|
1440d6b44968954baf56fbc2a0739a51873455876114d4445ae4b67cb5e7893b *arm-wince.pe/upx-3.91.exe
|
||||||
71a27b41a763fab594ed953f3bf543489554b509bce488e7c5533e312c953e30 *arm64-linux.elf/upx-3.95
|
35c08bf5086fe21ff19e3512359e54ac97c6d4513e6bb9ef4a59294bebf18f6a *arm64-linux.elf/upx-3.95
|
||||||
8a84b2161d83358c824de200ed480e9cb9cb7557138d710808ec44a19165c898 *armeb-linux.elf/upx-3.91
|
0ca2dcd9e8b5c3f16dcb31e30b42ec57a70b8fe90281d412081095a3d7812f01 *armeb-linux.elf/upx-3.91
|
||||||
09b92d07b30b16321301aa2faf46576da2587c1334e7a842742fed36aadef5fa *armeb-linux.elf/upx-3.95
|
462a72efbb580a2e90564412737bb3c1db1d930cde5b4f2c94782df91c8e4f4b *armeb-linux.elf/upx-3.95
|
||||||
a418a4df498f55e86a7f2788c6e0fe0324d60a9032d4841569c7e4e2694410df *i386-dos32.djgpp2.coff/upx-3.91.exe
|
a7ee051c5f9dcf233e2ee248274121b99fb8f098eff95469bc0638a7423723f0 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
0aecdd97242054dcd390317e97a539a2e35f53a28a71d0148b703141d21345b0 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
85cf31be166cb59587a99419cdd0fc5a79825d7508ab2c9a4bc0d700d603354d *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
09a748c65d2a26975a5c829dd3d9f36e96607b1d9728d64068731815d8b82c36 *i386-linux.elf/upx-3.91
|
fc7656d9a877967be7e339bfc98a0c63ea7b5abc30b96fa9e5931c75ecbe9827 *i386-linux.elf/upx-3.91
|
||||||
5189d860ddc1edc7e9b524aa09bd9677548d83efb788627cdbac27941f509262 *i386-linux.elf/upx-3.95
|
d454a7639e96b986ad422b02045ecfefa3b9405901eaa32d92a2c489292b9600 *i386-linux.elf/upx-3.95
|
||||||
0b51fd861dd2b574bfed6ab3998b01333ae173fd76b7fd0d30187e75b09ab316 *i386-win32.pe/upx-3.91.exe
|
934dd17076c0298d35a738533ea668e1fcbf8fc85c6671fcdd3a12e7722502ce *i386-win32.pe/upx-3.91.exe
|
||||||
05568f9b47da0c8949080f66437f7a8d08c3c11f3ee5fb9e5d20a1324f2ab829 *i386-win32.pe/upx-3.95.exe
|
519a9f6b3de56f5f080151074b9d5d81e31c1961cd6e395f73d2d522b7f7f8e0 *i386-win32.pe/upx-3.95.exe
|
||||||
f6fb2f10a4f2b2d327c9868bb06241c3143771b0371ca564b8dfaeb180026298 *m68k-atari.tos/upx-3.91.ttp
|
a7bd9f616231d883f6700b09e3c9a0af2880c6b5e5b0ce1cd8f06de43c48856c *m68k-atari.tos/upx-3.91.ttp
|
||||||
196fb37ba72d7b0e081386a8110cf193678934ae1a0f16cd9d071b18c034a3f2 *mips-linux.elf/upx-3.95
|
7a0479691e51ea4a8a0246a1f0ffa9694ee2f0e0cf3aa43dc0f1324c4d427ba3 *mips-linux.elf/upx-3.95
|
||||||
e528a2c33b2ab882c6e18fab4662d612ffc71c0261c367fa9c0282b23ad53b3c *mipsel-linux.elf/upx-3.91
|
f60bab42fe3914109ab1b9f5d00a5be753cd0a2c1a79a3998d58800efedbfff7 *mipsel-linux.elf/upx-3.91
|
||||||
4b44c1b60f8eea0f40bcd2cdbc1e7217afee6d1cb054856e2791339aa7c31a78 *mipsel-linux.elf/upx-3.95
|
b6d8cc9e2023a3fc415166afc378ccf2eb505487df84c8d959ec74b3fb4f8256 *mipsel-linux.elf/upx-3.95
|
||||||
ae73bba4db8413a7a287b2a61dc9829ee3a66f9d93940ad7f08aa93b09770f4f *powerpc-linux.elf/upx-3.91
|
acd3dc5ed3e4c4eeaa42e7cca71a79d687dd844ce5f384666ed6e78327b5a8e3 *powerpc-linux.elf/upx-3.91
|
||||||
c7a8bba27dbd09c8f73ae2cd11d893187b15b298dd7d857cbd2c676670ff0a80 *powerpc-linux.elf/upx-3.95
|
03600584c97fa466ef58239452baf9ec6ff2f06b79d97d45c8490953080de6e3 *powerpc-linux.elf/upx-3.95
|
||||||
6075bc28ac64f865d0e93cb16629c02331fb4abbea8da931288a60a6350cf635 *powerpc64le-linux.elf/upx-3.95
|
3f02885d1e94e59062eb78c4c910cde042475a6cadb77a85a603de747a50f45c *powerpc64le-linux.elf/upx-3.95
|
||||||
"
|
"
|
||||||
expected_sha256sums__t120_compress_ucl_nrv2d_3_no_filter="\
|
expected_sha256sums__t120_compress_ucl_nrv2d_3_no_filter="\
|
||||||
f23ea1c7cea84e5edf136b2b3a0a8740e9d6bf3552ef1f460aa4508c2f27df6d *amd64-linux.elf/upx-3.91
|
8431343adec632690cec669038c246438c799e7dc1b8bc85586e0d2bcd2eebad *amd64-linux.elf/upx-3.91
|
||||||
e725f00542f605851cfe03aee2042fbccf04e0a01bbf5a4aaecd04ad59c80077 *amd64-linux.elf/upx-3.95
|
1852bded40be6eb5ddb07a491476dcfcca69cadda45a5f128aa8f967d567fa0b *amd64-linux.elf/upx-3.95
|
||||||
57af8f45cef9e5c9f63387a15b8cf1b96426ab8dc73c303bd4caaa95b093bf92 *amd64-win64.pe/upx-3.95.exe
|
5ab022e2c3ecb09931e2181fb5f7699f35e2b453b54c823e42653c84b0df5f2c *amd64-win64.pe/upx-3.95.exe
|
||||||
a01ad023431e05287be77f160ea1a491489416e34de0d5ce194665e99f12e483 *arm-linux.elf/upx-3.95
|
6de0cf1903760710a95cb5330d0ffb406a93f081dbe6806935f51b0c75e23f03 *arm-linux.elf/upx-3.95
|
||||||
a711a73bfd20ccc012507c3f07ed98ee025f55e441156efb5fdbaa1815640c63 *arm-wince.pe/upx-3.91.exe
|
53121baf42c85991900aa3947f3d817fe6e894bc6f325ab1d576de6fba5fbcbf *arm-wince.pe/upx-3.91.exe
|
||||||
4a341330a44845a10521d5acaa91eda3b7602367b1c77f6a5cf0731b528e478f *arm64-linux.elf/upx-3.95
|
3c9e49445280de6a771e77f6a88b3c3957815baa193e92a893d5defe6699f50a *arm64-linux.elf/upx-3.95
|
||||||
d4a8653134f16f91b8fcdb0ed0d71ae3a31199af2ec42bf5dbe97e3344eceb74 *armeb-linux.elf/upx-3.91
|
627a3c77adfcd4ef8c32f1638a6b99e20e79bb914cbcebed6fb9ad5f96936530 *armeb-linux.elf/upx-3.91
|
||||||
a7da82c93f93a842a2876a54bba85cbb380eb7c79fc123ff30f31d99be3eca5c *armeb-linux.elf/upx-3.95
|
7faf9f0adf508cf29bf0ac2a62234df06d6c9153d6d59cf61019361db906daf8 *armeb-linux.elf/upx-3.95
|
||||||
f1caf28b7500b14ca1405b31b8e18a226bf682c619982ea2712b5631cc61d0d8 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
51e4faea51e12c7442b27bb50150f532ac51d8102f77a669cbce82f2675a2ef2 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
2c5ab68a6a23d460fab8def92a4cd32a54f084811584c1472c07dbe9429a503a *i386-dos32.djgpp2.coff/upx-3.95.exe
|
1196f578ab0b862bae8ac6b5166b770f072cf0ac521a2a23a6347c19ea82a0da *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
8f227074f8bc7682fd8e71bf96c60cb42fba7d3038acb8e500c6b075df50b732 *i386-linux.elf/upx-3.91
|
3015651261f28fb43ed43a8c1fa257bcfcdc788e6fd3f436f3de23733736c724 *i386-linux.elf/upx-3.91
|
||||||
3df0f160a7d58a1f1368450c9db2d6911818e00b11ab819edbc56afeb84e3fb8 *i386-linux.elf/upx-3.95
|
8cca96ea354af889f5e9d3074b2c7005f982463a3f22e1cca2bc01aed9232de1 *i386-linux.elf/upx-3.95
|
||||||
31aaff6332ea65bb4c386de0bb75553cae77becd9a587dcbb51e38719c8a3b7a *i386-win32.pe/upx-3.91.exe
|
3edf364443a3cd56efd04e95cc7d7c1846bf76addedd7263cfe8330771f19509 *i386-win32.pe/upx-3.91.exe
|
||||||
221a2c5c07d6c0a0127b3ce27d924fc36ee4b5af52fc4f47bc172e60ef0b244a *i386-win32.pe/upx-3.95.exe
|
48141fd66443f85ea867d7fa0bb3a50debb10f15bdb26c71888026e17c88d3a8 *i386-win32.pe/upx-3.95.exe
|
||||||
9b280a1d2b82185339a4aea0c9338d9ae6c34d1a68da84a4a173d9010d092feb *m68k-atari.tos/upx-3.91.ttp
|
07e1c09a953a9c87afa33d1236f46244280161bf3802273a523d380318886177 *m68k-atari.tos/upx-3.91.ttp
|
||||||
410335b935535fab6852d4b9677a24d016a9fb47d1b71d5a7967e99d1300ac15 *mips-linux.elf/upx-3.95
|
39b3a5c780d9354714d5e2ed69068511422f8faf9ab660706adc8ad5ecdf3598 *mips-linux.elf/upx-3.95
|
||||||
52746060c4c7971a4e786ba618896eebe9592f1b443c0d217d4e2cdb8b34fa8d *mipsel-linux.elf/upx-3.91
|
123ce137e4cd555470fcf9fe67df75179b6f337fee66d075ddc06f9848817a37 *mipsel-linux.elf/upx-3.91
|
||||||
7367c89786c15b2d8305f41980b84addfddff69f2dae0f0572a88ffee6abe884 *mipsel-linux.elf/upx-3.95
|
b78d8cd3a3402fed266c737cc34a32cc21b2b67b573e9e9071d4faf9fca89b89 *mipsel-linux.elf/upx-3.95
|
||||||
4504c03dcc84be9f5ffc2279c4638c47a435a70c4748f1e25a738af33dc20720 *powerpc-linux.elf/upx-3.91
|
ea9cae1d1701db3a0c53e9a651766db5bdc30032f48913a4a9e99f193a800acc *powerpc-linux.elf/upx-3.91
|
||||||
ef410a9cbd01c7c046f888417cb451aad8ebe4288aeb98319f689a030517d181 *powerpc-linux.elf/upx-3.95
|
aea86bf87870a1e48a454ac1ea9a80d90d8abe5113d418a71d8a9c4a74bb2d0a *powerpc-linux.elf/upx-3.95
|
||||||
da073cf9edf9d6efd0495d3f09101972541cdccd9df3c5a07df97e47ce1f77c3 *powerpc64le-linux.elf/upx-3.95
|
62038c87489dc5cd3772e8e4051cf1d416edecf267d37f390a649f4ae657e0f9 *powerpc64le-linux.elf/upx-3.95
|
||||||
"
|
"
|
||||||
expected_sha256sums__t130_compress_ucl_nrv2e_3_no_filter="\
|
expected_sha256sums__t130_compress_ucl_nrv2e_3_no_filter="\
|
||||||
1777841250f6b34fe7b75e2931b5154918abea5e7c47047f523ab15ed59e0658 *amd64-linux.elf/upx-3.91
|
f817034e8b7765d8b422dac9cb6f24f78ce5bfd7169cd3b33e8224e00b131eca *amd64-linux.elf/upx-3.91
|
||||||
9fefd378d92d1e370c450dd8d3f826248594ca7234aa6fccc83d20aa37694cdd *amd64-linux.elf/upx-3.95
|
d21441a05514c085c10e99b00d8cc4d45484297a8e4e8a246364ca4347d0ed56 *amd64-linux.elf/upx-3.95
|
||||||
b5a9eee9a774712899148a339cb8326e51a120355cb0dbb5a59f07ef4a149562 *amd64-win64.pe/upx-3.95.exe
|
7bd7cd37093200fa94d21dd7fdfef4d7fb9c3049fbf5f408f1f242cb8d9c6a55 *amd64-win64.pe/upx-3.95.exe
|
||||||
e56b71096f08c30448f560ccd60e5bffcb1f14d5b84948005d9d707600e50311 *arm-linux.elf/upx-3.95
|
d328a89b333d0b36e96d0c61375bf686e8f3b73a188dd4d0df4d78e30af08632 *arm-linux.elf/upx-3.95
|
||||||
9e1c47059e892f73a4fa118a6b435d455613e4ff4b4ab3fb432dd45adcc06809 *arm-wince.pe/upx-3.91.exe
|
ad0a7a18e87657d28260b7c527d284863becd3c5f92259c570125465f88d4042 *arm-wince.pe/upx-3.91.exe
|
||||||
615437bd5f987fae39502999fc1fd6a8857cdbffa4001cba1b485a8ddd0dbd14 *arm64-linux.elf/upx-3.95
|
0b700f0f7dde3118694155e876e6c2003ef701fe94856d6562936ec081278747 *arm64-linux.elf/upx-3.95
|
||||||
37dec03e64c74da1e194fb129231c5e87fb3398f4a4f1d269de9bc2487068a6a *armeb-linux.elf/upx-3.91
|
53a1d04fa62e25e64e6f792b079e21b4c42676a73503ae6d9e67ae16c98e6d04 *armeb-linux.elf/upx-3.91
|
||||||
e45e09fca25c28cbd458c636ac1d060bc08bab37a6571880b6f32a6e26ecaff8 *armeb-linux.elf/upx-3.95
|
33ed1e3b84836d2af52295ba0b90343ac0b8d524539ce3b8d0aa9f19a51d70dd *armeb-linux.elf/upx-3.95
|
||||||
b941187968c86db8a01f106098996f2c0cd227da66003856c19e8b24438f446a *i386-dos32.djgpp2.coff/upx-3.91.exe
|
6fcdc8e34ce8b3501db2260c8a921c6e963954fdeffedfefca353a27bcc02d56 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
8194a6a0de66019d8aa7f49504ec7303f155a2dbcf29489300428fb1bb5d1b4a *i386-dos32.djgpp2.coff/upx-3.95.exe
|
6f4f901c1838252f9b3104060475a6f13a2ebec830096ff28d870148580e4287 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
4380ef64efadd605bc0908ac2d56ee7597e665850d2291f40f5acd978f4ecbf8 *i386-linux.elf/upx-3.91
|
8127f8380300508e8062e9391e321abd0429a6a31fec41e769cc7fe80af27e27 *i386-linux.elf/upx-3.91
|
||||||
f9bacd9bf3a1f84455f0c647f615827606fba5608996cbae65c07a06b7b9ef42 *i386-linux.elf/upx-3.95
|
b0a7e6b822f038b7940a54ea160b045d2241e3dfa15a5081a23fbc4d42fb6773 *i386-linux.elf/upx-3.95
|
||||||
71b7880ee783da6182fa1dcc5cc8662eb15b82c2e96ea827f2dca3c83d4040c2 *i386-win32.pe/upx-3.91.exe
|
c78db15a8113b806e56812fd842fb467d2a9c9557fcdc0467dae3f4c33316630 *i386-win32.pe/upx-3.91.exe
|
||||||
629624e02dfa11c295e22989a09d5938c415ab2d32b7b4fdb009d3cc50c63933 *i386-win32.pe/upx-3.95.exe
|
89314e8621c4a00e1a65e045686245d3c1e2ba0a858f1dcc8f3cc2d0eedccfb5 *i386-win32.pe/upx-3.95.exe
|
||||||
5215eb51b80d7d0f428da49c3249eb2b5e937f8b3487f2e59eb31e7f1b9155ee *m68k-atari.tos/upx-3.91.ttp
|
710ad88b63cc7e0fa0b413ebdbcebf41140678f551b5dd883ed6220507be3601 *m68k-atari.tos/upx-3.91.ttp
|
||||||
e393bb54cb21d93d1b4ade1048204e4a9ed1bb0ca0517e54f42fddf8dc09a89d *mips-linux.elf/upx-3.95
|
c7e3478872650b7f4f8ccb4a0649944e62f44f5a9249cb9425210333e1f2fdf4 *mips-linux.elf/upx-3.95
|
||||||
7fd4a440ffa128a455b6e4a7864f75953a16fb593b5dc1b890c1ed111e80b021 *mipsel-linux.elf/upx-3.91
|
cd9b3d3780a79cb416b261d622e8e86f2369fa8bb9bc49b529c50cac2980d528 *mipsel-linux.elf/upx-3.91
|
||||||
24357e6c79022919f181286d6ae5a8316078f30c01bbbb83169cd2794c7204ec *mipsel-linux.elf/upx-3.95
|
5baf7db9e4335c0227106262efc9d18ad23b88c6d6bb636656aea67bb063b6ec *mipsel-linux.elf/upx-3.95
|
||||||
e37070c89617e9d155507662ee98d9f97a7c506317fdbe22797769a5738e75c5 *powerpc-linux.elf/upx-3.91
|
aba8bd826ee52d533f9e1c4270d4f4194fe8d8747ea10a1d3ce59b6443f1a9f2 *powerpc-linux.elf/upx-3.91
|
||||||
e2af43ea9cdc9f2e75de4c9a03ace0fabac9dcbfb54ea1b57031f2c860318663 *powerpc-linux.elf/upx-3.95
|
6f737ccbf8c830476bed9c4dd33dd7757ea25bf2f8fb03b44d03e9b77ada0f1b *powerpc-linux.elf/upx-3.95
|
||||||
d7cf1e60f962094ce5b28e3e920ed4ba0b8b84daee896043f915ab036ed774c7 *powerpc64le-linux.elf/upx-3.95
|
d313dd128a54189b9551a529b1ed21b222aa0394a30f9ba552cde96edcd4011e *powerpc64le-linux.elf/upx-3.95
|
||||||
"
|
"
|
||||||
expected_sha256sums__t140_compress_lzma_2_no_filter="\
|
expected_sha256sums__t140_compress_lzma_2_no_filter="\
|
||||||
0744ab571ee5d8ca76d0be11d474611771e417a99598b051f1d8a3a791a91533 *amd64-linux.elf/upx-3.91
|
fefac6fbd1e95479eb4066519f9bd801a30c29966685840b6a011e2911b984ca *amd64-linux.elf/upx-3.91
|
||||||
90660071ddb63165bf77f9175d3f9862d8626c085d932af2c2d66459a73cf409 *amd64-linux.elf/upx-3.95
|
64487a0e0aade092a8ff7e6d8d9528ca550540cac8d432005ba610179782d042 *amd64-linux.elf/upx-3.95
|
||||||
9781094badb6013e8fd29caad2d7f369e79f60d5a5f66b547c2260e98b1c7d92 *amd64-win64.pe/upx-3.95.exe
|
a55ec5a7f2911f6da8b9336daf4f1051e753cfb7a4458c7f7baa6b63340c6daf *amd64-win64.pe/upx-3.95.exe
|
||||||
9224db1973129ab654bfa9154689e2f1e99c7e5118dad9f143fa7b3e49abcb82 *arm-linux.elf/upx-3.95
|
9f405739b904bb85053b75187c9175e4ac7f66a07ac5e320eaa4e9771e1ec79e *arm-linux.elf/upx-3.95
|
||||||
961d61207958be48cccb37e5c0a111d85ff3e5d8fb6d5e0ca92e8681320a6f4b *arm-wince.pe/upx-3.91.exe
|
7a6c603eecf214e5d6742f1fce922223c97c8bd2527678a968640dd6c1bc0d71 *arm-wince.pe/upx-3.91.exe
|
||||||
f044f8755d43dfd753327b6a5d1e69c8b73095fc12b3208be720ca2286a258c0 *arm64-linux.elf/upx-3.95
|
c8435e2f82ba72a0b6abad4146539d40d495461c5e480af705b2bbd21d192128 *arm64-linux.elf/upx-3.95
|
||||||
85e460829c5bc3bad8a7a7c82b2dfcd64594980b443972de1e52d15f644225cb *armeb-linux.elf/upx-3.91
|
21fc48eaaedc73fe9239159fb864c6149f729ef1661a8407b88ad9c9a19f9a54 *armeb-linux.elf/upx-3.91
|
||||||
4829edc4b97d2011e789272a4b8ad254d7df573a476bae5a71832e9aecbf0e7b *armeb-linux.elf/upx-3.95
|
742db587dc53f616c7b276a930c3f586da2b7c3ce6ccd523c041e88a9671b99b *armeb-linux.elf/upx-3.95
|
||||||
902a9f177818e680042911e77d17de3f4bd3846fac210581ccaa7643dd1426f2 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
7a8eaa5139b95cc56591200fce62d3c9af163671467952cab6fcf487318107bb *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
665d3c278bb9a8e0cb28cffdf6a17c3c920052a2bf7d05b74413186b043ede28 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
9b5fc0f54a5f811bda190c36fb2fa5c5b03c6c3de0c62693e4191230b5a419b8 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
5ffc9d683e2e2050a7f4d6e03332de3754bb48efaf800e3dcd96678fcff6d15a *i386-linux.elf/upx-3.91
|
68b4ce63cb0bd7dd5b287e1f9fa5d9bc234ac36359ce3ebff863984c503a698e *i386-linux.elf/upx-3.91
|
||||||
fbc487cf2343a2b277e5a1d469ea34b6b70ce609b2966ce6a372e004ae70a125 *i386-linux.elf/upx-3.95
|
aa75cf22f0b59cc796de678198432a3dc2d40ab871e4989dd97ff1a6c148f294 *i386-linux.elf/upx-3.95
|
||||||
9c35de99b53620cb09617061e7d01c31ff7a60f4bda7c4560b294ef18300c7f6 *i386-win32.pe/upx-3.91.exe
|
0e0780f5fccc52f6c78414f7279263b26e31de7c6ca1ec65a240e37cf0a4f5c9 *i386-win32.pe/upx-3.91.exe
|
||||||
9430239c9d12e7d796fe2fa2de10bef21985841a0adf2357a4ca6b08cf08f989 *i386-win32.pe/upx-3.95.exe
|
3ddd6265d69e374f5f0f8c9f602e0e59c895da2f3fef611ef89f0ee4ae2c592b *i386-win32.pe/upx-3.95.exe
|
||||||
e3d224960f13424eb4083a547eefd907e3384cfd2ebe6e8d6a8bd56181f5339b *m68k-atari.tos/upx-3.91.ttp
|
e268c98fdacfd04268d76644f2bb4746ae04b57801407aaa1867798840eeeea0 *m68k-atari.tos/upx-3.91.ttp
|
||||||
fa9c411562d1d580944274e744d5d63c2268b334ef754fef89a666938c8601ee *mips-linux.elf/upx-3.95
|
499e1d1486810cfa5b6662e30189183979e25f45d35654d8cd60fd793d0c07d8 *mips-linux.elf/upx-3.95
|
||||||
dd71cec3b4c14c462f58f26077193c8ec2a302aa37b4ae59a6c92ce2d493cccc *mipsel-linux.elf/upx-3.91
|
4a30189ad7312eafb2d47e1b526ec22eaf614a895f8dce96f3e1c7385438f44c *mipsel-linux.elf/upx-3.91
|
||||||
29c04c30ee8b3c2b4353d92b3e9ad5327af3d9f4439f2a93a08801bb456b7a2a *mipsel-linux.elf/upx-3.95
|
339d38602413d97d9bba113f39884815af10ebcdccf37e3f5e8d0879f262a048 *mipsel-linux.elf/upx-3.95
|
||||||
2c109762689cf8691dcc6ad952f27863dd0fc79bfa74883702dc3a4601784aa5 *powerpc-linux.elf/upx-3.91
|
6d4f9d4383ebc9d8411d06a7c219dcf3e8513ea8c989f2d31ab382602f873ba5 *powerpc-linux.elf/upx-3.91
|
||||||
2ad4441667860519efbd0cd60744ceadcce73e3019acd80e593917ce76b3cbf1 *powerpc-linux.elf/upx-3.95
|
5dd727d8d5a35cc0ab86d629285d8ff450f52b538118679edaa886ce9c1fed7d *powerpc-linux.elf/upx-3.95
|
||||||
970fe74533bd7b7c3bd7ddb300f982cde77227f2b1a69155a8dfb30366574d76 *powerpc64le-linux.elf/upx-3.95
|
efec1e5bbb9bcf11dbc7081adfc2020de18fae326ad86194551c44fba0d2148d *powerpc64le-linux.elf/upx-3.95
|
||||||
"
|
"
|
||||||
expected_sha256sums__t150_compress_ucl_2_all_filters="\
|
expected_sha256sums__t150_compress_ucl_2_all_filters="\
|
||||||
62e5a3fe8a9e2f7934194904ebfebd445e194b17fe3171c07d22017b3aa09419 *amd64-linux.elf/upx-3.91
|
05b29bde32af1e63e837e2be499567c4b10d7e692c88082f24e3417e0c7b9f40 *amd64-linux.elf/upx-3.91
|
||||||
351c778baa6826faf9661c7c5b8e8c0dd49a8aa5899f0107b2f5f7a4e3a69f3e *amd64-linux.elf/upx-3.95
|
65c142ee01af09fa8741932c1f21d466be971aad059cc5afddbb7ecdf142c1bb *amd64-linux.elf/upx-3.95
|
||||||
3b943c943fe91b948e159c5687db6ff1b22acae0552d1cbf50a181750873f8d4 *amd64-win64.pe/upx-3.95.exe
|
cbb5c90bd9195bd9e3acd931312a70deeccfab5540f398ceda8826f8d6b332bf *amd64-win64.pe/upx-3.95.exe
|
||||||
cda2ba38e20f75623cea46cd75f604cd5466edd63cb9eafca64ea0fe765c69eb *arm-linux.elf/upx-3.95
|
1ea1bb18c0ac85c07450f0a6704b84e58a1322556757e2943340ef381b2ce675 *arm-linux.elf/upx-3.95
|
||||||
dea0d13ec7b3f1208988d25c30e3bcd60bc013186a88cc82c998e86f320cad99 *arm-wince.pe/upx-3.91.exe
|
76a5f0518fc797bd3f132ce6eb61ca187b5d463f191417883a73d4584716c23a *arm-wince.pe/upx-3.91.exe
|
||||||
b748ca51f52811112aeea21aba9d0e59b67512d98b1e01f71c22bf4fe755304d *arm64-linux.elf/upx-3.95
|
4df30002376a4f18029ea9dd8260d395bec3a3fa11fbc5aa19859c2f0efdc2e6 *arm64-linux.elf/upx-3.95
|
||||||
57686ad3f48c7d950f866f534232693ecc3489f322bb8f1eaf78fbcbbc3bba4d *armeb-linux.elf/upx-3.91
|
ba03fd4889210435c9673f2dcbd2269162037090eccc79cf7d2b896e64a57e2e *armeb-linux.elf/upx-3.91
|
||||||
c50c2f015491e40a8b687ae91827cf502e46e47dff21382b19c8e626388e5fe3 *armeb-linux.elf/upx-3.95
|
681f32d01c76ff31776b8d6f1556daa38eee297f675aa40ff1bb2e47e12adf15 *armeb-linux.elf/upx-3.95
|
||||||
d597d829ef4beca9759c51b135f3cfd1e17c17c1d7cda04e9cb453e76742c9dc *i386-dos32.djgpp2.coff/upx-3.91.exe
|
aa05c3a2953f0f2d70842cba45786b707a79ffef22fd084f51e304762cc67765 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
ac0cc4beea08af6a39ec037d0b2a4e77d0951776e0f9ac945e8b0033b227cc30 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
c677241e9a8753ba1332ac3875ab6398fb2d792d2627edd9e58f2535b3131abe *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
9204e3fabb4cca148a0d545f9ae3d7facd199edc570d4ce9b9794c4c7d8f46e3 *i386-linux.elf/upx-3.91
|
7bcd42f58dcc8ddb6cb1a4e33d56b584fe6d49b002b01a0859571d1324dd593a *i386-linux.elf/upx-3.91
|
||||||
7953f12209c9838707898a73a79962764c01d7106c9c743e7437d996042811b5 *i386-linux.elf/upx-3.95
|
b6fe6220c0b3f4df131da3aaae566810f2aa1f13b63d23de3ead9174d08d82e1 *i386-linux.elf/upx-3.95
|
||||||
2e6dbebbae2997ae689c616221f7eecf72117d148783025363b99580df79fdad *i386-win32.pe/upx-3.91.exe
|
8ec02f816f4727b519e8775edc1afb1df32991319a6c6f050ece416011925379 *i386-win32.pe/upx-3.91.exe
|
||||||
8d549e43950072ce5d271ecad25331e29a9886c4f034f150260af20f8a57feb9 *i386-win32.pe/upx-3.95.exe
|
d5aeeedada49c0c2870ea450ed66b2cea31369bccfccf9407378ae0fb0736deb *i386-win32.pe/upx-3.95.exe
|
||||||
d4eabc9adebd7edd40483f34ceb4081157c7542cdcea0f6b4b4dec640084fc6f *m68k-atari.tos/upx-3.91.ttp
|
e414ad0aba43790d0498b26c23055fb051129b6cbe3e070a1406c91ac5b8032b *m68k-atari.tos/upx-3.91.ttp
|
||||||
d03d5702382fd391c61736a3dda350737590c05de07837aa3ac0eb23ff9e6d7a *mips-linux.elf/upx-3.95
|
c5107a84d32de820c81401259a7dd23435ea625588d56c6c75ad6fa14b0dbf8b *mips-linux.elf/upx-3.95
|
||||||
431e8d80da56f51339a914c5bc4cf00242a7a8afbc4a77837888c42fb4888c3b *mipsel-linux.elf/upx-3.91
|
78473f7d7ddf56812b8dee087ca62517ecdbd10fa14972ba6670338fc19061d1 *mipsel-linux.elf/upx-3.91
|
||||||
8a9722f82e89c2d83437503765b9e0798854b960839d3fa57e6ccd2f581ed352 *mipsel-linux.elf/upx-3.95
|
fd9ea397a29b41a2143f9e02217e181d0075d7ad7d87bdbadc7fc94bfb1b0d76 *mipsel-linux.elf/upx-3.95
|
||||||
2bcf9a0b0245e807a4728f84ca134ab30371a91a2d247ed63ea80fbf4f6a44be *powerpc-linux.elf/upx-3.91
|
c47d1299f6ecf86e62528fc54979117b2b2ddbb6c80f553689402399fc7eab28 *powerpc-linux.elf/upx-3.91
|
||||||
37b3f5e0a7973ca5143dea5fc7d116d759f662780ee0b809357554b21fd4bbb0 *powerpc-linux.elf/upx-3.95
|
77c3b4ba6909a4e20180bc13775e280086d67240519c323c2005f3fcee6e0b78 *powerpc-linux.elf/upx-3.95
|
||||||
04c9a8dfb2bc25327894045cc5b5f8325fb7fe90d77473ad08c5491c58b28988 *powerpc64le-linux.elf/upx-3.95
|
e3ce51b863905a4831958c72541b04e9f893f0d9827f32e615822db7aebd56bc *powerpc64le-linux.elf/upx-3.95
|
||||||
"
|
"
|
||||||
expected_sha256sums__t160_compress_all_methods_1_no_filter="\
|
expected_sha256sums__t160_compress_all_methods_1_no_filter="\
|
||||||
0c2dedc98ac535a39c4166db713ed6feb02680869d23cc734c40e4d4ee36c6b4 *amd64-linux.elf/upx-3.91
|
94c91b97fcce7402a4494b22699b2450e8e4e2a9f4ddd66e1133c76ce198c167 *amd64-linux.elf/upx-3.91
|
||||||
dc87386b6afd2a36ab6ca67139399f9de6b3d29edb1741b523236e596c625043 *amd64-linux.elf/upx-3.95
|
5b3e85adb37919d051c6eaff205b8e1d77a2dfde0d8e7dcdee7c22f8fd5dc8c7 *amd64-linux.elf/upx-3.95
|
||||||
b75527ed6cfd8fa9b48a68e021545833790bc2817c2155cc5eeb97cb9d43cd5c *amd64-win64.pe/upx-3.95.exe
|
5a0ecb45658904bcd0b823b77dba039c9814e2eff4ed429784c36b7074b9858c *amd64-win64.pe/upx-3.95.exe
|
||||||
56416fe7d9100ebb3dddee598ce0844d1abfc6f006178b5fa05fc6d1d15e9a8c *arm-linux.elf/upx-3.95
|
de93a219ca3c4ea84bd9c1b5fb37ff4aaa0a08ea6eac18da6d7a5865e4dad19c *arm-linux.elf/upx-3.95
|
||||||
3ea0a4cafa457a1bf86ddf659a57c5737c4fa79b4a0d161df1c55c7ff0fa5ad5 *arm-wince.pe/upx-3.91.exe
|
fdbe0395ac401285edb9c2f9bfbb0fbd3c0eaad5052a88d8369b1a66b35a8a3e *arm-wince.pe/upx-3.91.exe
|
||||||
0fe74c52794dc63e8e92590413eea6aceb73a9cb9f34bed3eae9a8fc34aa5ef2 *arm64-linux.elf/upx-3.95
|
acdb7ff90d7c6f403872ec333e2987ee74e99d6e1390863b321b528d312c1084 *arm64-linux.elf/upx-3.95
|
||||||
5eb71685d564fdc4e99d939e5b2d58d8a8341288bcde5eac06f465c68a61a40a *armeb-linux.elf/upx-3.91
|
54860e61da36414dc105aafcdbb86c79b745913a7d0da911fa58a6941f111e2d *armeb-linux.elf/upx-3.91
|
||||||
08516cb6655f58965c4dea7c9227aac78e3bcffd8113062dd72118e074b3380e *armeb-linux.elf/upx-3.95
|
7c36b75cc8a0712515e12a9e565df4ca43bff6cc0077afb282d367fcc2ee2acd *armeb-linux.elf/upx-3.95
|
||||||
2a98332d1e82db93f7025dcf792d0e8924caf38fa9b4c22963841ab5e86d22ce *i386-dos32.djgpp2.coff/upx-3.91.exe
|
0a0099246096d20ff6035a4df6566954b9d8aff9ed8fdbd35aa5ee4995b02bfe *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
6939a695082de59e8993886c8213aaff1ca2ed1d7687404dd242796e27275a42 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
5df7aa9f0896df87eb8798119ad16a9b89c87a7568a67339e33b5baa99ec361f *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
0a866faf423e2c134f26ec705916b7ded0cdcb4c11fcb4e3b1ff75291d0b9d71 *i386-linux.elf/upx-3.91
|
53e5aae9bc70f58e3dc2aef5a94f66df2517d547670e72ee2b3189b7da809f41 *i386-linux.elf/upx-3.91
|
||||||
523d569a0682728fa84312db03930d290b7f6ef71eb2222fd81ebeb4bcc16ffa *i386-linux.elf/upx-3.95
|
adaa1e2f46f7a235ab838b15aa7e820057e5ed7011d9d07c67dc770a88e3dd62 *i386-linux.elf/upx-3.95
|
||||||
e1f8df77bb4591b1a68f7c110ed36ad778fef240ed52f9d3e511318a2d091e66 *i386-win32.pe/upx-3.91.exe
|
f3d33c5c9809943a902133490bcf0cfbe39a5ef1635a0c29b3bdc4f35dfffa50 *i386-win32.pe/upx-3.91.exe
|
||||||
265f4c7045bae686897dd9981575a5ebeb99ab28233d66e9a8164789359f00d8 *i386-win32.pe/upx-3.95.exe
|
474e68a2390cf0376f59402eaef4c902daa49428b628e025b1c8506428a37937 *i386-win32.pe/upx-3.95.exe
|
||||||
55732af6251cc6aa7bbb9c52415424a8cc4074288004a6064d9311a2ee01fddb *m68k-atari.tos/upx-3.91.ttp
|
1561dd69f67e8705804dba41ebd876bce6a4ce8ed8b0bc0d0e7628697e7fee68 *m68k-atari.tos/upx-3.91.ttp
|
||||||
138f3f2798f0cac9235011f14910ef6b079b908746d570a2ec631bb62d0f5917 *mips-linux.elf/upx-3.95
|
74f7f69b4a8b2b7c428fa55e3970ee767c1947f19ed1b0644870ecb6b3cb713d *mips-linux.elf/upx-3.95
|
||||||
4f740937696b2d86a4bd89ec61d52338db4c739c71a8dde5cc6ff67f675304c6 *mipsel-linux.elf/upx-3.91
|
12a42365234c001a52586b74a9597dc7d65184ddf1ee1d40734823a3443cd92a *mipsel-linux.elf/upx-3.91
|
||||||
18b3320462c479420723407cc3aea2b07911a4c725b0c334e1d9585a51c86bf0 *mipsel-linux.elf/upx-3.95
|
68f674d081d87e86e54f0051eee9e2bc85b566051992774ab28ff3173cbcb75a *mipsel-linux.elf/upx-3.95
|
||||||
c8f8974ebc401286910894d6751b0a13cd908d09b51e186e49e0c309ace3d282 *powerpc-linux.elf/upx-3.91
|
f569d8f49d7110bb8b262a48055b39d889e9977c40c5f1b21e74f8cbf93b27ae *powerpc-linux.elf/upx-3.91
|
||||||
ad08eb6c4339cd8ec63c12dd8551ef10851dcce66be27d0f9fbb251003ef0f4b *powerpc-linux.elf/upx-3.95
|
d8227a8a88c083760889acaf259e7da59eab75a23e341289bc8e3c60563ae344 *powerpc-linux.elf/upx-3.95
|
||||||
fb0fa7d60c542653e7d3448f2aa69e7c2ed5aaebf3845d5aa5f10c5bff2ee279 *powerpc64le-linux.elf/upx-3.95
|
e4b58ed65025b765953af02e80be9a171c49b6c707c835949b1c888fdbe8bba0 *powerpc64le-linux.elf/upx-3.95
|
||||||
"
|
"
|
||||||
expected_sha256sums__t170_compress_all_methods_no_lzma_5_no_filter="\
|
expected_sha256sums__t170_compress_all_methods_no_lzma_5_no_filter="\
|
||||||
3a5098207aa95f40fd8a62a6a79f416837f69bf0a1ac729264fbee72d1fae0f6 *amd64-linux.elf/upx-3.91
|
52a39c30b60abb82c1ec2826297eb46abdc29b5dd55d7a7a41dd2fc1c573f60a *amd64-linux.elf/upx-3.91
|
||||||
4748b6f0bb08e1417dc62cff1c049eb2ee993717be4f9f5359fc7454e736def2 *amd64-linux.elf/upx-3.95
|
f0c728c42e8775767e0d963e1eef7ca78711f3f6dd180df980a1faef926d7cac *amd64-linux.elf/upx-3.95
|
||||||
9fc18a2ec177ff3b48b5d299828e3275be1585db6c205ec5652e3d13f4d91eda *amd64-win64.pe/upx-3.95.exe
|
e07e9babdeb12fddeebbfa1b0293163cc5e63017d6f0933d02587c8da1e90a82 *amd64-win64.pe/upx-3.95.exe
|
||||||
d90b9a2f71107025885e289633ef9e7942f494a7f8aa0e0597e79664b09ad034 *arm-linux.elf/upx-3.95
|
f0359efa2247e9ea756f54c85e7518d61f3b293e08f566c3812c64c7d5f0db0f *arm-linux.elf/upx-3.95
|
||||||
f03a3f07787765e499ad5a60f7c576598f433ba9a1f4d7158b0923f510929142 *arm-wince.pe/upx-3.91.exe
|
8d1706ab02013b536c3a4cec20d40a96591ffa45fdcb464ccd3f038567006d79 *arm-wince.pe/upx-3.91.exe
|
||||||
d01b573be7bb79257c3e0637f38a7fe8940e9302c7391fbc4a75664219a5522c *arm64-linux.elf/upx-3.95
|
14932490ff17e27bb5bedde576b8683892c4720f4a0058f373aab9f8894fda09 *arm64-linux.elf/upx-3.95
|
||||||
085600cfffbe1d9e0c1bc25a3e48bbf3130b023b49ccbca001db27b4881e6246 *armeb-linux.elf/upx-3.91
|
64a73512e40c2fb49d8ae3a1d496b379c97b8724cf8ca4461a85825ff04366a0 *armeb-linux.elf/upx-3.91
|
||||||
a7923c6b78b9d3d58ee4f1bc42861476a57bb9935af47d2a15e048efb642f5d4 *armeb-linux.elf/upx-3.95
|
078e7cd073ba071f17ad4292e2211b7d635f57e974546e7f156cc87f9aa716e2 *armeb-linux.elf/upx-3.95
|
||||||
0970d5a8ee6c819e11b2bd889c7ee908403af2adf3542f7670ed92eb51090485 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
dda2c348c43741a1bd65049a8e7b51be1ebf873d215370ec002185c85390c168 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
e2d6b3c8de85bdc7b0262f64c1a16c9d41695a92e6f374cc9f12e87ca78fd956 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
560392427ded22f2f3fea59ef10e55d65cf841001e67b1e4558ef13514baa602 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
9e28e20b115e4a671b3f4006934b94fd59fcd48dc36311a479dda6bc1ccebe07 *i386-linux.elf/upx-3.91
|
f3f8feceebe8536633554b204df68c2e94e1d1a313fe7a576b7f5d404c916083 *i386-linux.elf/upx-3.91
|
||||||
910401db763c9a0bcb8e4d1b9cf1ee476c034b94b54a9350bcd303a5487085ef *i386-linux.elf/upx-3.95
|
e7f98419e346670f72d66ac25f3d6ad53201e768819980eecae24d801366be27 *i386-linux.elf/upx-3.95
|
||||||
0a413298c461facb93048106cfd261d72192443e6d2d313f2b48dbdf6537b22a *i386-win32.pe/upx-3.91.exe
|
3510bc5627237752bedd275e73c42bc02cd46145ff916e7bccbdec663f763ee4 *i386-win32.pe/upx-3.91.exe
|
||||||
684a0e0309d062e3fb7a1fabbdb7b2be45d3bde6a9a030f8a45fcc369a066efa *i386-win32.pe/upx-3.95.exe
|
ad47c7522167f6f7e47d495e1fa119431386ca5ea9bc16b6a4b9cb38cf9cd29f *i386-win32.pe/upx-3.95.exe
|
||||||
3ea4fe59d58b92fe0b0e41662c15c40130d72ed30425871d572a8c06c3c27bbf *m68k-atari.tos/upx-3.91.ttp
|
1c999e5c6cded8c99a7f6b4595879893ae63d2af1388dc61dd8b4e3106676480 *m68k-atari.tos/upx-3.91.ttp
|
||||||
e098036f912764f9dcef7377d17fe15b4f21439303306f9c84838d35fe655530 *mips-linux.elf/upx-3.95
|
55a098c2cdce1917b76ce0845f434fc23b0bd30b34e884b19401c51c8c7f4756 *mips-linux.elf/upx-3.95
|
||||||
df4106be954d5233644a3d761a9f899132f052741d16e1d793ae481aafd51caa *mipsel-linux.elf/upx-3.91
|
4b6487d412f43acb8e41951a2135e56025139a9ad3e57102749df4d4bef934fa *mipsel-linux.elf/upx-3.91
|
||||||
4c87f94f926aedbe17bf2d7ef72873506bbae75b8abf51a6775eb4b2e0ac0d96 *mipsel-linux.elf/upx-3.95
|
1dcd626fc4566c608e987fd6999b695793c5cae7f78872e3d1a9a23942fea188 *mipsel-linux.elf/upx-3.95
|
||||||
4c6b2ca8ed7bbe6b9705f02a26781e6d93ab2a1011c119283130a738df5e47eb *powerpc-linux.elf/upx-3.91
|
2047a4a880322bf41e8afbb4787f6103364de4a299b543808251a4144c4d990b *powerpc-linux.elf/upx-3.91
|
||||||
ccecc0acef4c430a8871704f93280a17bff518267499f05ba89a5290ba654a89 *powerpc-linux.elf/upx-3.95
|
63679bd238f30bfb14853246eb257536471fea10f942b2adfdd43cbef21dea30 *powerpc-linux.elf/upx-3.95
|
||||||
86123a78b0ff91321acbc837874034c099443f77ff62848e338bb61c0888e1c6 *powerpc64le-linux.elf/upx-3.95
|
c75d1548db879ed589b55bc1319869b49d37595f4560a64b34016951dc02f997 *powerpc64le-linux.elf/upx-3.95
|
||||||
"
|
"
|
||||||
########## end .sha256sums.recreate
|
########## end .sha256sums.recreate
|
||||||
|
|||||||
@@ -29,23 +29,25 @@ if [[ -z $upx_exe ]]; then echo "UPX-ERROR: please set \$upx_exe"; exit 1; fi
|
|||||||
if [[ ! -f $upx_exe ]]; then echo "UPX-ERROR: file '$upx_exe' does not exist"; exit 1; fi
|
if [[ ! -f $upx_exe ]]; then echo "UPX-ERROR: file '$upx_exe' does not exist"; exit 1; fi
|
||||||
upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
||||||
[[ -f $upx_exe ]] || exit 1
|
[[ -f $upx_exe ]] || exit 1
|
||||||
upx_run=()
|
|
||||||
|
# set emu and run_upx
|
||||||
|
emu=()
|
||||||
if [[ -n $upx_exe_runner ]]; then
|
if [[ -n $upx_exe_runner ]]; then
|
||||||
# usage examples:
|
# usage examples:
|
||||||
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
||||||
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
||||||
# export upx_exe_runner="wine"
|
# export upx_exe_runner="wine"
|
||||||
IFS=' ' read -r -a upx_run <<< "$upx_exe_runner" # split at spaces into array
|
IFS=' ' read -r -a emu <<< "$upx_exe_runner" # split at spaces into array
|
||||||
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
|
||||||
IFS=';' read -r -a upx_run <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
IFS=';' read -r -a emu <<< "$CMAKE_CROSSCOMPILING_EMULATOR" # split at semicolons into array
|
||||||
fi
|
fi
|
||||||
upx_run+=( "$upx_exe" )
|
run_upx=( "${emu[@]}" "$upx_exe" )
|
||||||
echo "upx_run='${upx_run[*]}'"
|
echo "run_upx='${run_upx[*]}'"
|
||||||
|
|
||||||
# upx_run sanity check, part1
|
# run_upx sanity check
|
||||||
if ! "${upx_run[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
if ! "${run_upx[@]}" --version-short >/dev/null; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||||
if ! "${upx_run[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||||
if ! "${upx_run[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||||
|
|
||||||
# upx_testsuite_SRCDIR
|
# upx_testsuite_SRCDIR
|
||||||
if [[ -z $upx_testsuite_SRCDIR ]]; then
|
if [[ -z $upx_testsuite_SRCDIR ]]; then
|
||||||
@@ -74,19 +76,30 @@ fi
|
|||||||
mkdir -p "$upx_testsuite_BUILDDIR" || exit 1
|
mkdir -p "$upx_testsuite_BUILDDIR" || exit 1
|
||||||
upx_testsuite_BUILDDIR=$(readlink -fn "$upx_testsuite_BUILDDIR") # make absolute
|
upx_testsuite_BUILDDIR=$(readlink -fn "$upx_testsuite_BUILDDIR") # make absolute
|
||||||
[[ -d $upx_testsuite_BUILDDIR ]] || exit 1
|
[[ -d $upx_testsuite_BUILDDIR ]] || exit 1
|
||||||
|
|
||||||
cd / && cd "$upx_testsuite_BUILDDIR" || exit 1
|
cd / && cd "$upx_testsuite_BUILDDIR" || exit 1
|
||||||
: > ./.mfxnobackup
|
: > ./.mfxnobackup
|
||||||
|
|
||||||
# upx_run sanity check, part2
|
# run_upx sanity check after "cd"
|
||||||
if ! "${upx_run[@]}" --version-short >/dev/null; then
|
if ! "${run_upx[@]}" --version-short >/dev/null; then
|
||||||
echo "UPX-ERROR: FATAL: upx --version-short FAILED"
|
echo "UPX-ERROR: FATAL: upx --version-short FAILED"
|
||||||
echo "please make sure that \$upx_exe contains ABSOLUTE file paths and can be run from any directory"
|
echo "please make sure that \$upx_exe contains ABSOLUTE file paths and can be run from any directory"
|
||||||
echo "INFO: upx_run='${upx_run[*]}'"
|
echo "INFO: run_upx='${run_upx[*]}'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! "${upx_run[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
|
||||||
if ! "${upx_run[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
#***********************************************************************
|
||||||
|
# setup
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
#set -x # debug
|
||||||
|
|
||||||
|
exit_code=0
|
||||||
|
num_errors=0
|
||||||
|
all_errors=
|
||||||
|
|
||||||
|
export UPX="--prefer-ucl --no-color --no-progress"
|
||||||
|
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
||||||
|
export UPX_DEBUG_DOCTEST_DISABLE=1 # already checked above
|
||||||
|
|
||||||
case $UPX_TESTSUITE_LEVEL in
|
case $UPX_TESTSUITE_LEVEL in
|
||||||
[0-8]) ;;
|
[0-8]) ;;
|
||||||
@@ -97,19 +110,6 @@ if [[ $UPX_TESTSUITE_LEVEL == 0 ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#***********************************************************************
|
|
||||||
# setup
|
|
||||||
#***********************************************************************
|
|
||||||
|
|
||||||
#set -x # debug
|
|
||||||
exit_code=0
|
|
||||||
num_errors=0
|
|
||||||
all_errors=
|
|
||||||
|
|
||||||
export UPX="--prefer-ucl --no-color --no-progress"
|
|
||||||
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
|
||||||
export UPX_DEBUG_DOCTEST_VERBOSE=0
|
|
||||||
|
|
||||||
rm -rf ./testsuite_1
|
rm -rf ./testsuite_1
|
||||||
mkdir testsuite_1 || exit 1
|
mkdir testsuite_1 || exit 1
|
||||||
cd testsuite_1 || exit 1
|
cd testsuite_1 || exit 1
|
||||||
@@ -119,13 +119,14 @@ cd testsuite_1 || exit 1
|
|||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
run_upx() {
|
run_upx() {
|
||||||
|
local flags="--disable-random-id --fake-stub-version=5.01 --fake-stub-year=2025"
|
||||||
local ec=0
|
local ec=0
|
||||||
if [[ $UPX_TESTSUITE_VERBOSE == 1 ]]; then
|
if [[ $UPX_TESTSUITE_VERBOSE == 1 ]]; then
|
||||||
echo "LOG: '${upx_run[*]}' $*"
|
echo "LOG: '${run_upx[*]}' $*"
|
||||||
fi
|
fi
|
||||||
"${upx_run[@]}" "$@" || ec=$?
|
"${run_upx[@]}" $flags "$@" || ec=$?
|
||||||
if [[ $ec != 0 ]]; then
|
if [[ $ec != 0 ]]; then
|
||||||
echo "FATAL: '${upx_run[*]}' $*"
|
echo "FATAL: '${run_upx[*]}' $*"
|
||||||
echo " (exit code was $ec)"
|
echo " (exit code was $ec)"
|
||||||
exit 42
|
exit 42
|
||||||
fi
|
fi
|
||||||
@@ -319,7 +320,7 @@ ls -l "$upx_exe"
|
|||||||
if command -v file >/dev/null; then
|
if command -v file >/dev/null; then
|
||||||
file "$upx_exe" || true
|
file "$upx_exe" || true
|
||||||
fi
|
fi
|
||||||
echo "upx_run='${upx_run[*]}'"
|
echo "run_upx='${run_upx[*]}'"
|
||||||
echo "upx_testsuite_SRCDIR='$upx_testsuite_SRCDIR'"
|
echo "upx_testsuite_SRCDIR='$upx_testsuite_SRCDIR'"
|
||||||
echo "upx_testsuite_BUILDDIR='$upx_testsuite_BUILDDIR'"
|
echo "upx_testsuite_BUILDDIR='$upx_testsuite_BUILDDIR'"
|
||||||
echo ".sha256sums.{expected,current} counts:"
|
echo ".sha256sums.{expected,current} counts:"
|
||||||
|
|||||||
@@ -9,6 +9,12 @@
|
|||||||
Memcheck:Cond
|
Memcheck:Cond
|
||||||
fun:enframe
|
fun:enframe
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
musl-malloc-get_nominal_size
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:get_nominal_size
|
||||||
|
fun:__libc_free
|
||||||
|
}
|
||||||
|
|
||||||
# these are only needed for older musl versions
|
# these are only needed for older musl versions
|
||||||
|
|
||||||
|
|||||||
+15
-18
@@ -3,8 +3,8 @@
|
|||||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
#
|
#
|
||||||
|
|
||||||
# NOTE: this Makefile is deprecated - please directly use
|
# NOTE: this Makefile is intended for developers - please use
|
||||||
# the top-level CMake build instead.
|
# the top-level Makefile instead
|
||||||
|
|
||||||
ifndef srcdir
|
ifndef srcdir
|
||||||
srcdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
|
srcdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
|
||||||
@@ -14,7 +14,7 @@ ifndef top_srcdir
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# redirect to top-level CMake build
|
# redirect to top-level Makefile
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
# NOTE that the top-level Makefile .DEFAULT_GOAL is build/release
|
# NOTE that the top-level Makefile .DEFAULT_GOAL is build/release
|
||||||
@@ -25,17 +25,13 @@ endif
|
|||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
build/debug build/release build/all: PHONY; $(MAKE) -C $(top_srcdir) $@
|
build/debug build/release build/all: PHONY; $(MAKE) -C "$(top_srcdir)" $@
|
||||||
build/debug+test build/release+test build/all+test: PHONY; $(MAKE) -C $(top_srcdir) $@
|
build/debug+test build/release+test build/all+test: PHONY; $(MAKE) -C "$(top_srcdir)" $@
|
||||||
# shortcuts
|
# shortcuts
|
||||||
debug release all: PHONY; $(MAKE) -C $(top_srcdir) $@
|
debug release all: PHONY; $(MAKE) -C "$(top_srcdir)" $@
|
||||||
debug+test release+test all+test: PHONY; $(MAKE) -C $(top_srcdir) $@
|
debug+test release+test all+test: PHONY; $(MAKE) -C "$(top_srcdir)" $@
|
||||||
|
|
||||||
test:: build/all+test PHONY
|
test: $$(patsubst %+test,%,$$(.DEFAULT_GOAL))+test PHONY
|
||||||
|
|
||||||
# OLD target names [deprecated]
|
|
||||||
$(top_srcdir)/build/debug: build/debug PHONY
|
|
||||||
$(top_srcdir)/build/release: build/release PHONY
|
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# make run-testsuite
|
# make run-testsuite
|
||||||
@@ -60,15 +56,16 @@ endif
|
|||||||
ifneq ($(wildcard $(upx_testsuite_SRCDIR)/files/packed/.),)
|
ifneq ($(wildcard $(upx_testsuite_SRCDIR)/files/packed/.),)
|
||||||
ifneq ($(wildcard $(top_srcdir)/misc/testsuite/upx_testsuite_1.sh),)
|
ifneq ($(wildcard $(top_srcdir)/misc/testsuite/upx_testsuite_1.sh),)
|
||||||
run-testsuite: run-testsuite-release PHONY
|
run-testsuite: run-testsuite-release PHONY
|
||||||
|
run-testsuite-all: run-testsuite-debug run-testsuite-release PHONY
|
||||||
run-testsuite-%: export upx_testsuite_SRCDIR := $(upx_testsuite_SRCDIR)
|
run-testsuite-%: export upx_testsuite_SRCDIR := $(upx_testsuite_SRCDIR)
|
||||||
run-testsuite-debug: export upx_testsuite_BUILDDIR := ./tmp-upx-testsuite-debug
|
run-testsuite-debug: export upx_testsuite_BUILDDIR := ./tmp-upx-testsuite-debug
|
||||||
run-testsuite-debug: export upx_exe := $(top_srcdir)/build/debug/upx
|
run-testsuite-debug: export upx_exe := $(top_srcdir)/build/debug/upx
|
||||||
run-testsuite-debug: build/debug PHONY
|
run-testsuite-debug: build/debug PHONY
|
||||||
time -p bash $(top_srcdir)/misc/testsuite/upx_testsuite_1.sh
|
time -p bash "$(top_srcdir)/misc/testsuite/upx_testsuite_1.sh"
|
||||||
run-testsuite-release: export upx_testsuite_BUILDDIR := ./tmp-upx-testsuite-release
|
run-testsuite-release: export upx_testsuite_BUILDDIR := ./tmp-upx-testsuite-release
|
||||||
run-testsuite-release: export upx_exe := $(top_srcdir)/build/release/upx
|
run-testsuite-release: export upx_exe := $(top_srcdir)/build/release/upx
|
||||||
run-testsuite-release: build/release PHONY
|
run-testsuite-release: build/release PHONY
|
||||||
time -p bash $(top_srcdir)/misc/testsuite/upx_testsuite_1.sh
|
time -p bash "$(top_srcdir)/misc/testsuite/upx_testsuite_1.sh"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -78,9 +75,9 @@ endif
|
|||||||
|
|
||||||
ifneq ($(wildcard /usr/bin/env),) # need Unix utils like bash, perl, sed, xargs, etc.
|
ifneq ($(wildcard /usr/bin/env),) # need Unix utils like bash, perl, sed, xargs, etc.
|
||||||
|
|
||||||
CHECK_WHITESPACE = bash $(top_srcdir)/misc/scripts/check_whitespace.sh $(top_srcdir)
|
CHECK_WHITESPACE = bash "$(top_srcdir)/misc/scripts/check_whitespace.sh" "$(top_srcdir)"
|
||||||
ifneq ($(wildcard $(top_srcdir)/.git/.),)
|
ifneq ($(wildcard $(top_srcdir)/.git/.),)
|
||||||
CHECK_WHITESPACE = bash $(top_srcdir)/misc/scripts/check_whitespace_git.sh $(top_srcdir)
|
CHECK_WHITESPACE = bash "$(top_srcdir)/misc/scripts/check_whitespace_git.sh" "$(top_srcdir)"
|
||||||
endif
|
endif
|
||||||
check-whitespace: PHONY; $(CHECK_WHITESPACE)
|
check-whitespace: PHONY; $(CHECK_WHITESPACE)
|
||||||
|
|
||||||
@@ -90,7 +87,7 @@ endif # /usr/bin/env
|
|||||||
# make clang-format
|
# make clang-format
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
# automatically format some C++ source code files
|
# automatically format most C++ source code files
|
||||||
ifneq ($(wildcard /usr/bin/env),)
|
ifneq ($(wildcard /usr/bin/env),)
|
||||||
ifeq ($(shell uname),Linux)
|
ifeq ($(shell uname),Linux)
|
||||||
|
|
||||||
@@ -103,7 +100,7 @@ CLANG_FORMAT_FILES += $(sort $(wildcard ../misc/cmake/try_compile/*.[ch]*))
|
|||||||
CLANG_FORMAT_FILES := $(sort $(filter-out $(CLANG_FORMAT_EXCLUDE_FILES),$(CLANG_FORMAT_FILES)))
|
CLANG_FORMAT_FILES := $(sort $(filter-out $(CLANG_FORMAT_EXCLUDE_FILES),$(CLANG_FORMAT_FILES)))
|
||||||
clang-format: $(CLANG_FORMAT_FILES) PHONY
|
clang-format: $(CLANG_FORMAT_FILES) PHONY
|
||||||
@echo "running upx-clang-format"
|
@echo "running upx-clang-format"
|
||||||
@bash $(top_srcdir)/misc/scripts/upx-clang-format.sh -i $(CLANG_FORMAT_FILES)
|
@bash "$(top_srcdir)/misc/scripts/upx-clang-format.sh" -i $(CLANG_FORMAT_FILES)
|
||||||
|
|
||||||
endif # Linux
|
endif # Linux
|
||||||
endif # /usr/bin/env
|
endif # /usr/bin/env
|
||||||
|
|||||||
+494
-216
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#if defined(BELE_CTP)
|
#if defined(BELE_CTP)
|
||||||
// CTP - Compile-Time Polymorphism (templates)
|
// CTP - Compile-Time Polymorphism (templates)
|
||||||
#define V static inline
|
#define V static inline bele_constexpr
|
||||||
#define VV static forceinline_constexpr
|
#define VV static forceinline_constexpr
|
||||||
#define S static int __acc_cdecl_qsort
|
#define S static int __acc_cdecl_qsort
|
||||||
#define C noexcept
|
#define C noexcept
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
#if defined(BELE_RTP)
|
#if defined(BELE_RTP)
|
||||||
struct AbstractPolicy {
|
struct AbstractPolicy {
|
||||||
explicit inline AbstractPolicy() noexcept {}
|
explicit inline AbstractPolicy() noexcept = default;
|
||||||
virtual inline ~AbstractPolicy() noexcept {}
|
virtual inline ~AbstractPolicy() noexcept {}
|
||||||
V bool isBE() C = 0;
|
V bool isBE() C = 0;
|
||||||
V bool isLE() C = 0;
|
V bool isLE() C = 0;
|
||||||
@@ -92,12 +92,12 @@ private:
|
|||||||
#define C const noexcept override
|
#define C const noexcept override
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct BEPolicy
|
struct BEPolicy final
|
||||||
#if defined(BELE_RTP)
|
#if defined(BELE_RTP)
|
||||||
final : public AbstractPolicy
|
: public AbstractPolicy
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
explicit inline BEPolicy() noexcept {}
|
explicit inline BEPolicy() noexcept = default;
|
||||||
#if defined(BELE_CTP)
|
#if defined(BELE_CTP)
|
||||||
typedef N_BELE_RTP::BEPolicy RTP_Policy;
|
typedef N_BELE_RTP::BEPolicy RTP_Policy;
|
||||||
#elif defined(BELE_RTP)
|
#elif defined(BELE_RTP)
|
||||||
@@ -135,7 +135,7 @@ struct BEPolicy
|
|||||||
S u32_compare_signed(const void *a, const void *b) C { return be32_compare_signed(a, b); }
|
S u32_compare_signed(const void *a, const void *b) C { return be32_compare_signed(a, b); }
|
||||||
S u64_compare_signed(const void *a, const void *b) C { return be64_compare_signed(a, b); }
|
S u64_compare_signed(const void *a, const void *b) C { return be64_compare_signed(a, b); }
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() noexcept {
|
||||||
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
|
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
|
||||||
COMPILE_TIME_ASSERT(sizeof(U32) == 4)
|
COMPILE_TIME_ASSERT(sizeof(U32) == 4)
|
||||||
COMPILE_TIME_ASSERT(sizeof(U64) == 8)
|
COMPILE_TIME_ASSERT(sizeof(U64) == 8)
|
||||||
@@ -151,12 +151,12 @@ private:
|
|||||||
UPX_CXX_DISABLE_NEW_DELETE(BEPolicy)
|
UPX_CXX_DISABLE_NEW_DELETE(BEPolicy)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LEPolicy
|
struct LEPolicy final
|
||||||
#if defined(BELE_RTP)
|
#if defined(BELE_RTP)
|
||||||
final : public AbstractPolicy
|
: public AbstractPolicy
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
explicit inline LEPolicy() noexcept {}
|
explicit inline LEPolicy() noexcept = default;
|
||||||
#if defined(BELE_CTP)
|
#if defined(BELE_CTP)
|
||||||
typedef N_BELE_RTP::LEPolicy RTP_Policy;
|
typedef N_BELE_RTP::LEPolicy RTP_Policy;
|
||||||
#elif defined(BELE_RTP)
|
#elif defined(BELE_RTP)
|
||||||
@@ -194,7 +194,7 @@ struct LEPolicy
|
|||||||
S u32_compare_signed(const void *a, const void *b) C { return le32_compare_signed(a, b); }
|
S u32_compare_signed(const void *a, const void *b) C { return le32_compare_signed(a, b); }
|
||||||
S u64_compare_signed(const void *a, const void *b) C { return le64_compare_signed(a, b); }
|
S u64_compare_signed(const void *a, const void *b) C { return le64_compare_signed(a, b); }
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() noexcept {
|
||||||
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
|
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
|
||||||
COMPILE_TIME_ASSERT(sizeof(U32) == 4)
|
COMPILE_TIME_ASSERT(sizeof(U32) == 4)
|
||||||
COMPILE_TIME_ASSERT(sizeof(U64) == 8)
|
COMPILE_TIME_ASSERT(sizeof(U64) == 8)
|
||||||
@@ -210,7 +210,7 @@ private:
|
|||||||
UPX_CXX_DISABLE_NEW_DELETE(LEPolicy)
|
UPX_CXX_DISABLE_NEW_DELETE(LEPolicy)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Native Endianness policy (aka host policy)
|
// NE - Native Endianness policy (aka Host Policy)
|
||||||
#if (ACC_ABI_BIG_ENDIAN)
|
#if (ACC_ABI_BIG_ENDIAN)
|
||||||
typedef BEPolicy NEPolicy;
|
typedef BEPolicy NEPolicy;
|
||||||
typedef BEPolicy HostPolicy;
|
typedef BEPolicy HostPolicy;
|
||||||
|
|||||||
+829
-139
File diff suppressed because it is too large
Load Diff
+748
-153
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -27,120 +27,30 @@
|
|||||||
// lots of tests (and probably quite a number of redundant tests)
|
// lots of tests (and probably quite a number of redundant tests)
|
||||||
// modern compilers will optimize away much of this code
|
// modern compilers will optimize away much of this code
|
||||||
|
|
||||||
#if 0 // TODO later
|
|
||||||
// libc++ hardenining
|
|
||||||
#if defined(__clang__) && defined(__clang_major__) && (__clang_major__ + 0 >= 18)
|
|
||||||
#if DEBUG
|
|
||||||
#define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEBUG
|
|
||||||
#else
|
|
||||||
#define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_EXTENSIVE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if defined(__clang__) && defined(__clang_major__) && (__clang_major__ + 0 < 18)
|
|
||||||
#if DEBUG
|
|
||||||
#define _LIBCPP_ENABLE_ASSERTIONS 1
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif // TODO later
|
|
||||||
|
|
||||||
#include "../util/system_headers.h"
|
#include "../util/system_headers.h"
|
||||||
#include <vector>
|
#include <vector> // std::vector
|
||||||
#include "../conf.h"
|
#include "../conf.h"
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// compile-time checks
|
// standard C++ library
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// need extra parenthesis because the C preprocessor does not understand C++ templates
|
TEST_CASE("std::vector") {
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((upx::is_same_all_v<int>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((upx::is_same_all_v<int, int>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((upx::is_same_all_v<int, int, int>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((!upx::is_same_all_v<int, char>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((!upx::is_same_all_v<int, char, int>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((!upx::is_same_all_v<int, int, char>) )
|
|
||||||
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((!upx::is_same_any_v<int>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((upx::is_same_any_v<int, int>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((upx::is_same_any_v<int, char, int>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((upx::is_same_any_v<int, int, char>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((!upx::is_same_any_v<int, char>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((!upx::is_same_any_v<int, char, char>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((!upx::is_same_any_v<int, char, long>) )
|
|
||||||
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((upx::is_same_any_v<ptrdiff_t, int, long, long long>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(
|
|
||||||
(upx::is_same_any_v<size_t, unsigned, unsigned long, unsigned long long>) )
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(
|
|
||||||
(upx::is_same_any_v<upx_uintptr_t, unsigned, unsigned long, unsigned long long>) )
|
|
||||||
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(int) == sizeof(int))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof('a') == sizeof(char))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof("") == 1)
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof("a") == 2)
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof("ab") == 3)
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(L'a') == sizeof(wchar_t))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(L"") == 1 * sizeof(wchar_t))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(L"a") == 2 * sizeof(wchar_t))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(L"ab") == 3 * sizeof(wchar_t))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(0) == sizeof(int))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(0L) == sizeof(long))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(0LL) == sizeof(long long))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(nullptr) == sizeof(void *))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(sizeof(0)) == sizeof(size_t))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof(usizeof(0)) == sizeof(unsigned))
|
|
||||||
#if 0
|
|
||||||
// works, but may trigger clang/gcc warnings "-Wunused-value"
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof((1LL, 1)) == sizeof(int))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(usizeof((1, 1LL)) == sizeof(long long))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace compile_time = upx::compile_time;
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_len("") == 0)
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_len("a") == 1)
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_len("ab") == 2)
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_len("abc") == 3)
|
|
||||||
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_eq("", ""))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_eq("a", ""))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_eq("", "a"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_eq("abc", "abc"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_eq("ab", "abc"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_eq("abc", "ab"))
|
|
||||||
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_lt("", ""))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_lt("a", ""))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_lt("", "a"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_lt("abc", "abc"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_lt("ab", "abc"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_lt("abc", "ab"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_lt("abc", "aba"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_lt("abc", "abz"))
|
|
||||||
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_ne("abc", "abz"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_gt("abc", "abz"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_ge("abc", "abz"))
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_le("abc", "abz"))
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
TEST_CASE("libc++") {
|
|
||||||
constexpr size_t N = 16;
|
constexpr size_t N = 16;
|
||||||
std::vector<int> v(N);
|
std::vector<int> v(N);
|
||||||
CHECK(v.end() - v.begin() == N);
|
CHECK(v.end() - v.begin() == N);
|
||||||
CHECK(&v[0] == &(*(v.begin())));
|
CHECK(&v[0] == &(*(v.begin())));
|
||||||
// CHECK(&v[0] + N == &(*(v.end()))); // TODO later: is this legal??
|
// CHECK(&v[0] + N == &(*(v.end()))); // TODO later: is this legal??
|
||||||
// TODO later: make sure that this throws
|
#if defined(_LIBCPP_HARDENING_MODE) && defined(_LIBCPP_HARDENING_MODE_DEBUG) && \
|
||||||
#if defined(_LIBCPP_HARDENING_MODE_DEBUG) && \
|
|
||||||
(_LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG)
|
(_LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG)
|
||||||
CHECK_THROWS((void) &v[N]);
|
// unfortunately this does NOT throw but ABORTS
|
||||||
|
////CHECK_THROWS((void) &v[N]);
|
||||||
#endif
|
#endif
|
||||||
UNUSED(v);
|
UNUSED(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// UPX_CXX_DISABLE_xxx
|
// core util: UPX_CXX_DISABLE_xxx, noncopyable
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -256,50 +166,209 @@ struct Z2_X2 : public X2 {
|
|||||||
|
|
||||||
} // namespace test_disable_new_delete
|
} // namespace test_disable_new_delete
|
||||||
|
|
||||||
|
TEST_CASE("upx::noncopyable") {
|
||||||
|
struct Test : private upx::noncopyable {
|
||||||
|
int v = 1;
|
||||||
|
};
|
||||||
|
Test t = {};
|
||||||
|
CHECK(t.v == 1);
|
||||||
|
#if (ACC_CC_MSC) // MSVC thinks that Test is not std::is_trivially_copyable; true or compiler bug?
|
||||||
|
// @COMPILER_BUG @MSVC_BUG
|
||||||
|
t.v = 0;
|
||||||
|
#else
|
||||||
|
mem_clear(&t);
|
||||||
|
#endif
|
||||||
|
CHECK(t.v == 0);
|
||||||
|
constexpr Test x = {};
|
||||||
|
static_assert(x.v == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// <type_traits>
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
static_assert(!upx::is_bounded_array_v<std::nullptr_t>);
|
||||||
|
static_assert(!upx::is_bounded_array_v<decltype(nullptr)>);
|
||||||
|
static_assert(!upx::is_bounded_array_v<void *>);
|
||||||
|
static_assert(!upx::is_bounded_array_v<int *>);
|
||||||
|
static_assert(!upx::is_bounded_array_v<const int *>);
|
||||||
|
static_assert(!upx::is_bounded_array_v<volatile int *>);
|
||||||
|
static_assert(!upx::is_bounded_array_v<const volatile int *>);
|
||||||
|
static_assert(upx::is_bounded_array_v<int[1]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<const int[1]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<volatile int[1]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<const volatile int[1]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<int[1u]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<const int[1u]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<volatile int[1u]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<const volatile int[1u]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<int[1l]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<const int[1l]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<volatile int[1l]>);
|
||||||
|
static_assert(upx::is_bounded_array_v<const volatile int[1l]>);
|
||||||
|
|
||||||
|
static_assert(upx::is_same_all_v<int>);
|
||||||
|
static_assert(upx::is_same_all_v<int, int>);
|
||||||
|
static_assert(upx::is_same_all_v<int, int, int>);
|
||||||
|
static_assert(!upx::is_same_all_v<int, char>);
|
||||||
|
static_assert(!upx::is_same_all_v<int, char, int>);
|
||||||
|
static_assert(!upx::is_same_all_v<int, int, char>);
|
||||||
|
|
||||||
|
static_assert(!upx::is_same_any_v<int>);
|
||||||
|
static_assert(upx::is_same_any_v<int, int>);
|
||||||
|
static_assert(upx::is_same_any_v<int, char, int>);
|
||||||
|
static_assert(upx::is_same_any_v<int, int, char>);
|
||||||
|
static_assert(!upx::is_same_any_v<int, char>);
|
||||||
|
static_assert(!upx::is_same_any_v<int, char, char>);
|
||||||
|
static_assert(!upx::is_same_any_v<int, char, long>);
|
||||||
|
|
||||||
|
static_assert(upx::is_same_any_v<ptrdiff_t, int, long, long long>);
|
||||||
|
static_assert(upx::is_same_any_v<size_t, unsigned, unsigned long, unsigned long long>);
|
||||||
|
static_assert(upx::is_same_any_v<upx_ptraddr_t, unsigned, unsigned long, unsigned long long>);
|
||||||
|
#if defined(__CHERI__) && defined(__CHERI_PURE_CAPABILITY__)
|
||||||
|
static_assert(!upx::is_same_any_v<upx_uintptr_t, unsigned, unsigned long, unsigned long long>);
|
||||||
|
#else
|
||||||
|
static_assert(upx::is_same_any_v<upx_uintptr_t, unsigned, unsigned long, unsigned long long>);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static_assert(std::is_same_v<int, upx::remove_cvref_t<int> >);
|
||||||
|
static_assert(std::is_same_v<int, upx::remove_cvref_t<const int> >);
|
||||||
|
static_assert(std::is_same_v<int, upx::remove_cvref_t<int &> >);
|
||||||
|
static_assert(std::is_same_v<int, upx::remove_cvref_t<const int &> >);
|
||||||
|
static_assert(std::is_same_v<int, upx::remove_cvref_t<int &&> >);
|
||||||
|
static_assert(std::is_same_v<int, upx::remove_cvref_t<const int &&> >);
|
||||||
|
static_assert(std::is_same_v<int *, upx::remove_cvref_t<int *> >);
|
||||||
|
static_assert(std::is_same_v<int *, upx::remove_cvref_t<int *const> >);
|
||||||
|
static_assert(std::is_same_v<const int *, upx::remove_cvref_t<const int *> >);
|
||||||
|
static_assert(std::is_same_v<int *, upx::remove_cvref_t<int *&> >);
|
||||||
|
static_assert(std::is_same_v<int *, upx::remove_cvref_t<int *const &> >);
|
||||||
|
static_assert(std::is_same_v<const int *, upx::remove_cvref_t<const int *&> >);
|
||||||
|
static_assert(std::is_same_v<int *, upx::remove_cvref_t<int *&&> >);
|
||||||
|
static_assert(std::is_same_v<int *, upx::remove_cvref_t<int *const &&> >);
|
||||||
|
static_assert(std::is_same_v<const int *, upx::remove_cvref_t<const int *&&> >);
|
||||||
|
static_assert(std::is_same_v<int[1], upx::remove_cvref_t<int[1]> >);
|
||||||
|
static_assert(std::is_same_v<int[1], upx::remove_cvref_t<const int[1]> >);
|
||||||
|
|
||||||
|
static_assert(std::is_same_v<int, upx::type_identity_t<int> >);
|
||||||
|
static_assert(std::is_same_v<const int, upx::type_identity_t<const int> >);
|
||||||
|
static_assert(std::is_same_v<int *, upx::type_identity_t<int *> >);
|
||||||
|
static_assert(std::is_same_v<int *const, upx::type_identity_t<int *const> >);
|
||||||
|
static_assert(std::is_same_v<const int *, upx::type_identity_t<const int *> >);
|
||||||
|
static_assert(std::is_same_v<int &, upx::type_identity_t<int &> >);
|
||||||
|
static_assert(std::is_same_v<const int &, upx::type_identity_t<const int &> >);
|
||||||
|
static_assert(std::is_same_v<int &&, upx::type_identity_t<int &&> >);
|
||||||
|
static_assert(std::is_same_v<const int &&, upx::type_identity_t<const int &&> >);
|
||||||
|
static_assert(std::is_same_v<int[1], upx::type_identity_t<int[1]> >);
|
||||||
|
static_assert(std::is_same_v<const int[1], upx::type_identity_t<const int[1]> >);
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// <bit>
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
static_assert(!upx::has_single_bit(0));
|
||||||
|
static_assert(upx::has_single_bit(1));
|
||||||
|
static_assert(upx::has_single_bit(2));
|
||||||
|
static_assert(!upx::has_single_bit(3));
|
||||||
|
static_assert(upx::has_single_bit(4));
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// <algorithm>
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
static_assert(upx::align_down(0, 4) == 0);
|
||||||
|
static_assert(upx::align_down(1, 4) == 0);
|
||||||
|
static_assert(upx::align_down(2, 4) == 0);
|
||||||
|
static_assert(upx::align_down(3, 4) == 0);
|
||||||
|
static_assert(upx::align_down(4, 4) == 4);
|
||||||
|
static_assert(upx::align_up(0, 4) == 0);
|
||||||
|
static_assert(upx::align_up(1, 4) == 4);
|
||||||
|
static_assert(upx::align_up(2, 4) == 4);
|
||||||
|
static_assert(upx::align_up(3, 4) == 4);
|
||||||
|
static_assert(upx::align_up(4, 4) == 4);
|
||||||
|
static_assert(upx::align_up_gap(0, 4) == 0);
|
||||||
|
static_assert(upx::align_up_gap(1, 4) == 3);
|
||||||
|
static_assert(upx::align_up_gap(2, 4) == 2);
|
||||||
|
static_assert(upx::align_up_gap(3, 4) == 1);
|
||||||
|
static_assert(upx::align_up_gap(4, 4) == 0);
|
||||||
|
|
||||||
|
static_assert(upx::min<upx_int8_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::min<upx_int16_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::min<upx_int32_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::min<upx_int64_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::min<intmax_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::max<upx_int8_t>(1, 2) == 2);
|
||||||
|
static_assert(upx::max<upx_int16_t>(1, 2) == 2);
|
||||||
|
static_assert(upx::max<upx_int32_t>(1, 2) == 2);
|
||||||
|
static_assert(upx::max<upx_int64_t>(1, 2) == 2);
|
||||||
|
static_assert(upx::max<intmax_t>(1, 2) == 2);
|
||||||
|
|
||||||
|
static_assert(upx::min(1, 2) == 1);
|
||||||
|
static_assert(upx::min(1l, 2l) == 1);
|
||||||
|
static_assert(upx::min(1ll, 2ll) == 1);
|
||||||
|
static_assert(upx::max(1, 2) == 2);
|
||||||
|
static_assert(upx::max(1l, 2l) == 2);
|
||||||
|
static_assert(upx::max(1ll, 2ll) == 2);
|
||||||
|
|
||||||
|
static_assert(upx::umin<upx_uint8_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::umin<upx_uint16_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::umin<upx_uint32_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::umin<upx_uint64_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::umin<uintmax_t>(1, 2) == 1);
|
||||||
|
static_assert(upx::umax<upx_uint8_t>(1, 2) == 2);
|
||||||
|
static_assert(upx::umax<upx_uint16_t>(1, 2) == 2);
|
||||||
|
static_assert(upx::umax<upx_uint32_t>(1, 2) == 2);
|
||||||
|
static_assert(upx::umax<upx_uint64_t>(1, 2) == 2);
|
||||||
|
static_assert(upx::umax<uintmax_t>(1, 2) == 2);
|
||||||
|
|
||||||
|
static_assert(upx::umin(1u, 2u) == 1);
|
||||||
|
static_assert(upx::umin(1ul, 2ul) == 1);
|
||||||
|
static_assert(upx::umin(1ull, 2ull) == 1);
|
||||||
|
static_assert(upx::umax(1u, 2u) == 2);
|
||||||
|
static_assert(upx::umax(1ul, 2ul) == 2);
|
||||||
|
static_assert(upx::umax(1ull, 2ull) == 2);
|
||||||
|
|
||||||
|
static_assert(upx::wrapping_add<upx_int8_t>(127, 2) == -127);
|
||||||
|
static_assert(upx::wrapping_add<upx_int16_t>(32767, 2) == -32767);
|
||||||
|
static_assert(upx::wrapping_add(2147483647, 2) == -2147483647);
|
||||||
|
static_assert(upx::wrapping_add(9223372036854775807ll, 2ll) == -9223372036854775807ll);
|
||||||
|
static_assert(upx::wrapping_sub<upx_int8_t>(-127, 2) == 127);
|
||||||
|
static_assert(upx::wrapping_sub<upx_int16_t>(-32767, 2) == 32767);
|
||||||
|
static_assert(upx::wrapping_sub(-2147483647, 2) == 2147483647);
|
||||||
|
static_assert(upx::wrapping_sub(-9223372036854775807ll, 2ll) == 9223372036854775807ll);
|
||||||
|
|
||||||
|
static_assert(upx::wrapping_add<upx_uint8_t>(255, 2) == 1);
|
||||||
|
static_assert(upx::wrapping_sub<upx_uint8_t>(1, 2) == 255);
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// util
|
// util
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
TEST_CASE("upx::ObjectDeleter 1") {
|
// upx::UnsignedSizeOf
|
||||||
LE16 *o = nullptr; // object
|
static_assert(usizeof(int) == sizeof(int));
|
||||||
LE32 *a = nullptr; // array
|
static_assert(usizeof('a') == sizeof(char));
|
||||||
{
|
static_assert(usizeof("") == 1);
|
||||||
const upx::ObjectDeleter<LE16 **> o_deleter{&o, 1};
|
static_assert(usizeof("a") == 2);
|
||||||
o = new LE16;
|
static_assert(usizeof("ab") == 3);
|
||||||
assert(o != nullptr);
|
static_assert(usizeof(L'a') == sizeof(wchar_t));
|
||||||
const upx::ArrayDeleter<LE32 **> a_deleter{&a, 1};
|
static_assert(usizeof(L"") == 1 * sizeof(wchar_t));
|
||||||
a = New(LE32, 1);
|
static_assert(usizeof(L"a") == 2 * sizeof(wchar_t));
|
||||||
assert(a != nullptr);
|
static_assert(usizeof(L"ab") == 3 * sizeof(wchar_t));
|
||||||
}
|
static_assert(usizeof(0) == sizeof(int));
|
||||||
assert(o == nullptr);
|
static_assert(usizeof(0L) == sizeof(long));
|
||||||
assert(a == nullptr);
|
static_assert(usizeof(0LL) == sizeof(long long));
|
||||||
}
|
static_assert(usizeof(nullptr) == sizeof(void *));
|
||||||
|
static_assert(usizeof(sizeof(0)) == sizeof(size_t));
|
||||||
TEST_CASE("upx::ObjectDeleter 2") {
|
static_assert(usizeof(usizeof(0)) == sizeof(unsigned));
|
||||||
constexpr size_t N = 2;
|
#if 0
|
||||||
BE16 *o[N]; // multiple objects
|
// works, but may trigger clang/gcc warnings "-Wunused-value"
|
||||||
BE32 *a[N]; // multiple arrays
|
static_assert(usizeof((1LL, 1)) == sizeof(int));
|
||||||
{
|
static_assert(usizeof((1, 1LL)) == sizeof(long long));
|
||||||
upx::ObjectDeleter<BE16 **> o_deleter{o, 0};
|
#endif
|
||||||
upx::ArrayDeleter<BE32 **> a_deleter{a, 0};
|
|
||||||
for (size_t i = 0; i < N; i++) {
|
|
||||||
o[i] = new BE16;
|
|
||||||
assert(o[i] != nullptr);
|
|
||||||
o_deleter.count += 1;
|
|
||||||
a[i] = New(BE32, 1 + i);
|
|
||||||
assert(a[i] != nullptr);
|
|
||||||
a_deleter.count += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < N; i++) {
|
|
||||||
assert(o[i] == nullptr);
|
|
||||||
assert(a[i] == nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("upx::ptr_static_cast") {
|
TEST_CASE("upx::ptr_static_cast") {
|
||||||
// check that we don't trigger any -Wcast-align warnings
|
// check that we do not trigger any -Wcast-align warnings
|
||||||
using upx::ptr_static_cast;
|
using upx::ptr_static_cast;
|
||||||
|
|
||||||
void *vp = nullptr;
|
void *vp = nullptr;
|
||||||
byte *bp = nullptr;
|
byte *bp = nullptr;
|
||||||
int *ip = nullptr;
|
int *ip = nullptr;
|
||||||
@@ -337,31 +406,551 @@ TEST_CASE("upx::ptr_static_cast") {
|
|||||||
assert((ic == ptr_static_cast<const int *>(ic)));
|
assert((ic == ptr_static_cast<const int *>(ic)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("upx::noncopyable") {
|
TEST_CASE("upx::ptr_static_cast constexpr 1") {
|
||||||
struct Test : private upx::noncopyable {
|
// check that casts work at compile-time
|
||||||
int v = 1;
|
using upx::ptr_static_cast;
|
||||||
};
|
|
||||||
Test t = {};
|
constexpr void *vp = nullptr;
|
||||||
CHECK(t.v == 1);
|
constexpr byte *bp = nullptr;
|
||||||
#if (ACC_CC_MSC) // MSVC thinks that Test is not std::is_trivially_copyable; true or compiler bug?
|
constexpr int *ip = nullptr;
|
||||||
// @COMPILER_BUG @MSVC_BUG
|
constexpr double *dp = nullptr;
|
||||||
t.v = 0;
|
static_assert((vp == ptr_static_cast<void *>(vp)));
|
||||||
#else
|
static_assert((bp == ptr_static_cast<byte *>(bp)));
|
||||||
mem_clear(&t);
|
static_assert((ip == ptr_static_cast<int *>(ip)));
|
||||||
|
static_assert((dp == ptr_static_cast<double *>(dp)));
|
||||||
|
|
||||||
|
constexpr const void *vc = nullptr;
|
||||||
|
constexpr const byte *bc = nullptr;
|
||||||
|
constexpr const int *ic = nullptr;
|
||||||
|
constexpr const double *dc = nullptr;
|
||||||
|
static_assert((vc == ptr_static_cast<const void *>(vc)));
|
||||||
|
static_assert((bc == ptr_static_cast<const byte *>(bc)));
|
||||||
|
static_assert((ic == ptr_static_cast<const int *>(ic)));
|
||||||
|
static_assert((dc == ptr_static_cast<const double *>(dc)));
|
||||||
|
|
||||||
|
constexpr void **vpp = nullptr;
|
||||||
|
constexpr byte **bpp = nullptr;
|
||||||
|
constexpr int **ipp = nullptr;
|
||||||
|
constexpr double **dpp = nullptr;
|
||||||
|
static_assert((vpp == ptr_static_cast<void **>(vpp)));
|
||||||
|
static_assert((bpp == ptr_static_cast<byte **>(bpp)));
|
||||||
|
static_assert((ipp == ptr_static_cast<int **>(ipp)));
|
||||||
|
static_assert((dpp == ptr_static_cast<double **>(dpp)));
|
||||||
|
|
||||||
|
constexpr const void **vcp = nullptr;
|
||||||
|
constexpr const byte **bcp = nullptr;
|
||||||
|
constexpr const int **icp = nullptr;
|
||||||
|
constexpr const double **dcp = nullptr;
|
||||||
|
static_assert((vcp == ptr_static_cast<const void **>(vcp)));
|
||||||
|
static_assert((bcp == ptr_static_cast<const byte **>(bcp)));
|
||||||
|
static_assert((icp == ptr_static_cast<const int **>(icp)));
|
||||||
|
static_assert((dcp == ptr_static_cast<const double **>(dcp)));
|
||||||
|
|
||||||
|
constexpr void *const *vpc = nullptr;
|
||||||
|
constexpr byte *const *bpc = nullptr;
|
||||||
|
constexpr int *const *ipc = nullptr;
|
||||||
|
constexpr double *const *dpc = nullptr;
|
||||||
|
static_assert((vpc == ptr_static_cast<void *const *>(vpc)));
|
||||||
|
static_assert((bpc == ptr_static_cast<byte *const *>(bpc)));
|
||||||
|
static_assert((ipc == ptr_static_cast<int *const *>(ipc)));
|
||||||
|
static_assert((dpc == ptr_static_cast<double *const *>(dpc)));
|
||||||
|
|
||||||
|
constexpr const void *const *vcc = nullptr;
|
||||||
|
constexpr const byte *const *bcc = nullptr;
|
||||||
|
constexpr const int *const *icc = nullptr;
|
||||||
|
constexpr const double *const *dcc = nullptr;
|
||||||
|
static_assert((vcc == ptr_static_cast<const void *const *>(vcc)));
|
||||||
|
static_assert((bcc == ptr_static_cast<const byte *const *>(bcc)));
|
||||||
|
static_assert((icc == ptr_static_cast<const int *const *>(icc)));
|
||||||
|
static_assert((dcc == ptr_static_cast<const double *const *>(dcc)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("upx::ptr_static_cast constexpr 2") {
|
||||||
|
// check that casts work at compile-time
|
||||||
|
using upx::ptr_static_cast;
|
||||||
|
|
||||||
|
constexpr void *vp = nullptr;
|
||||||
|
constexpr byte *bp = nullptr;
|
||||||
|
constexpr int *ip = nullptr;
|
||||||
|
constexpr double *dp = nullptr;
|
||||||
|
static_assert((vp == static_cast<void *>(vp)));
|
||||||
|
static_assert((vp == static_cast<void *>(bp)));
|
||||||
|
static_assert((vp == static_cast<void *>(ip)));
|
||||||
|
static_assert((vp == static_cast<void *>(dp)));
|
||||||
|
static_assert((vp == ptr_static_cast<void *>(vp)));
|
||||||
|
static_assert((vp == ptr_static_cast<void *>(bp)));
|
||||||
|
static_assert((vp == ptr_static_cast<void *>(ip)));
|
||||||
|
static_assert((vp == ptr_static_cast<void *>(dp)));
|
||||||
|
|
||||||
|
constexpr const void *vc = nullptr;
|
||||||
|
constexpr const byte *bc = nullptr;
|
||||||
|
constexpr const int *ic = nullptr;
|
||||||
|
constexpr const double *dc = nullptr;
|
||||||
|
static_assert((vc == static_cast<const void *>(vp)));
|
||||||
|
static_assert((vc == static_cast<const void *>(bp)));
|
||||||
|
static_assert((vc == static_cast<const void *>(ip)));
|
||||||
|
static_assert((vc == static_cast<const void *>(dp)));
|
||||||
|
static_assert((vc == ptr_static_cast<const void *>(vp)));
|
||||||
|
static_assert((vc == ptr_static_cast<const void *>(dp)));
|
||||||
|
static_assert((vc == ptr_static_cast<const void *>(bp)));
|
||||||
|
static_assert((vc == ptr_static_cast<const void *>(ip)));
|
||||||
|
static_assert((vc == static_cast<const void *>(vc)));
|
||||||
|
static_assert((vc == static_cast<const void *>(bc)));
|
||||||
|
static_assert((vc == static_cast<const void *>(ic)));
|
||||||
|
static_assert((vc == static_cast<const void *>(dc)));
|
||||||
|
static_assert((vc == ptr_static_cast<const void *>(vc)));
|
||||||
|
static_assert((vc == ptr_static_cast<const void *>(dc)));
|
||||||
|
static_assert((vc == ptr_static_cast<const void *>(bc)));
|
||||||
|
static_assert((vc == ptr_static_cast<const void *>(ic)));
|
||||||
|
|
||||||
|
// these are invalid:
|
||||||
|
//// constexpr char *cc1 = static_cast<char *>(bp);
|
||||||
|
//// constexpr char *cc2 = ptr_static_cast<char *>(bp);
|
||||||
|
//// constexpr unsigned *uc1 = static_cast<unsigned *>(ip);
|
||||||
|
//// constexpr unsigned *uc2 = ptr_static_cast<unsigned *>(ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WITH_THREADS
|
||||||
|
TEST_CASE("upx::ptr_std_atomic_cast") {
|
||||||
|
// pointer-size
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((void **) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((uintptr_t *) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((upx_uintptr_t *) nullptr), nullptr);
|
||||||
|
#if 1
|
||||||
|
// more fundamental types
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((char *) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((short *) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((int *) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((long *) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((ptrdiff_t *) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((size_t *) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((upx_int8_t *) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((upx_int16_t *) nullptr), nullptr);
|
||||||
|
CHECK_EQ(upx::ptr_std_atomic_cast((upx_int32_t *) nullptr), nullptr);
|
||||||
#endif
|
#endif
|
||||||
CHECK(t.v == 0);
|
}
|
||||||
constexpr Test x = {};
|
#endif // WITH_THREADS
|
||||||
static_assert(x.v == 1);
|
|
||||||
|
TEST_CASE("upx::atomic_exchange") {
|
||||||
|
{
|
||||||
|
upx_uintptr_t x = (upx_uintptr_t) 0 - 1;
|
||||||
|
upx_uintptr_t y = upx::atomic_exchange(&x, (upx_uintptr_t) 2);
|
||||||
|
CHECK_EQ(x, 2);
|
||||||
|
CHECK_EQ(y, (upx_uintptr_t) 0 - 1);
|
||||||
|
UNUSED(y);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const int buf[2] = {101, 202};
|
||||||
|
const int *ptr_array[2] = {&buf[0], &buf[1]};
|
||||||
|
assert_noexcept(*ptr_array[0] == 101 && *ptr_array[1] == 202);
|
||||||
|
const int *p = upx::atomic_exchange(&ptr_array[0], ptr_array[1]);
|
||||||
|
CHECK_EQ(p, buf + 0);
|
||||||
|
assert_noexcept(*ptr_array[0] == 202 && *ptr_array[1] == 202);
|
||||||
|
p = upx::atomic_exchange(&ptr_array[1], p);
|
||||||
|
CHECK_EQ(p, buf + 1);
|
||||||
|
assert_noexcept(*ptr_array[0] == 202 && *ptr_array[1] == 101);
|
||||||
|
UNUSED(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("upx::ObjectDeleter 1") {
|
||||||
|
LE16 *o = nullptr; // object
|
||||||
|
LE32 *a = nullptr; // array
|
||||||
|
LE64 *m = nullptr; // malloc
|
||||||
|
{
|
||||||
|
// auto o_deleter = upx::ObjectDeleter(&o, 1);
|
||||||
|
upx::ObjectDeleter<LE16> o_deleter = upx::ObjectDeleter(&o, 1);
|
||||||
|
o = new LE16;
|
||||||
|
assert(o != nullptr);
|
||||||
|
auto a_deleter = upx::ArrayDeleter(&a, 1);
|
||||||
|
a = New(LE32, 1);
|
||||||
|
assert(a != nullptr);
|
||||||
|
auto m_deleter = upx::MallocDeleter(&m, 1);
|
||||||
|
m = (LE64 *) ::malloc(sizeof(LE64));
|
||||||
|
assert(m != nullptr);
|
||||||
|
}
|
||||||
|
assert(o == nullptr);
|
||||||
|
assert(a == nullptr);
|
||||||
|
assert(m == nullptr);
|
||||||
|
// test "const" versions
|
||||||
|
{
|
||||||
|
const auto o_deleter = upx::ObjectDeleter(&o, 1);
|
||||||
|
o = new LE16;
|
||||||
|
assert(o != nullptr);
|
||||||
|
const auto a_deleter = upx::ArrayDeleter(&a, 1);
|
||||||
|
a = New(LE32, 1);
|
||||||
|
assert(a != nullptr);
|
||||||
|
const auto m_deleter = upx::MallocDeleter(&m, 1);
|
||||||
|
m = (LE64 *) ::malloc(sizeof(LE64));
|
||||||
|
assert(m != nullptr);
|
||||||
|
}
|
||||||
|
assert(o == nullptr);
|
||||||
|
assert(a == nullptr);
|
||||||
|
assert(m == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("upx::ObjectDeleter 2") {
|
||||||
|
constexpr size_t N = 2;
|
||||||
|
BE16 *o[N]; // multiple objects
|
||||||
|
BE32 *a[N]; // multiple arrays
|
||||||
|
BE64 *m[N]; // multiple mallocs
|
||||||
|
{
|
||||||
|
// auto o_deleter = upx::ObjectDeleter(o, 0);
|
||||||
|
upx::ObjectDeleter<BE16> o_deleter = upx::ObjectDeleter(o, 0);
|
||||||
|
auto a_deleter = upx::ArrayDeleter(a, 0);
|
||||||
|
auto m_deleter = upx::MallocDeleter(m, 0);
|
||||||
|
for (size_t i = 0; i < N; i++) {
|
||||||
|
o[i] = new BE16;
|
||||||
|
assert(o[i] != nullptr);
|
||||||
|
o_deleter.count += 1;
|
||||||
|
a[i] = New(BE32, 1 + i);
|
||||||
|
assert(a[i] != nullptr);
|
||||||
|
a_deleter.count += 1;
|
||||||
|
m[i] = (BE64 *) ::malloc(sizeof(BE64));
|
||||||
|
assert(m[i] != nullptr);
|
||||||
|
m_deleter.count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < N; i++) {
|
||||||
|
assert(o[i] == nullptr);
|
||||||
|
assert(a[i] == nullptr);
|
||||||
|
assert(m[i] == nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// TriBool checks
|
// namespace upx::compile_time
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
static_assert(upx::compile_time::string_len("") == 0);
|
||||||
|
static_assert(upx::compile_time::string_len("a") == 1);
|
||||||
|
static_assert(upx::compile_time::string_len("ab") == 2);
|
||||||
|
static_assert(upx::compile_time::string_len("abc") == 3);
|
||||||
|
|
||||||
|
static_assert(upx::compile_time::string_eq("", ""));
|
||||||
|
static_assert(!upx::compile_time::string_eq("a", ""));
|
||||||
|
static_assert(!upx::compile_time::string_eq("", "a"));
|
||||||
|
static_assert(upx::compile_time::string_eq("abc", "abc"));
|
||||||
|
static_assert(!upx::compile_time::string_eq("ab", "abc"));
|
||||||
|
static_assert(!upx::compile_time::string_eq("abc", "ab"));
|
||||||
|
|
||||||
|
static_assert(!upx::compile_time::string_lt("", ""));
|
||||||
|
static_assert(!upx::compile_time::string_lt("a", ""));
|
||||||
|
static_assert(upx::compile_time::string_lt("", "a"));
|
||||||
|
static_assert(!upx::compile_time::string_lt("abc", "abc"));
|
||||||
|
static_assert(upx::compile_time::string_lt("ab", "abc"));
|
||||||
|
static_assert(!upx::compile_time::string_lt("abc", "ab"));
|
||||||
|
static_assert(!upx::compile_time::string_lt("abc", "aba"));
|
||||||
|
static_assert(upx::compile_time::string_lt("abc", "abz"));
|
||||||
|
|
||||||
|
static_assert(upx::compile_time::string_ne("abc", "abz"));
|
||||||
|
static_assert(!upx::compile_time::string_gt("abc", "abz"));
|
||||||
|
static_assert(!upx::compile_time::string_ge("abc", "abz"));
|
||||||
|
static_assert(upx::compile_time::string_le("abc", "abz"));
|
||||||
|
|
||||||
|
static_assert(upx::compile_time::mem_eq((const char *) nullptr, (const char *) nullptr, 0));
|
||||||
|
static_assert(upx::compile_time::mem_eq((const char *) nullptr, (const byte *) nullptr, 0));
|
||||||
|
static_assert(upx::compile_time::mem_eq((const byte *) nullptr, (const char *) nullptr, 0));
|
||||||
|
static_assert(upx::compile_time::mem_eq((const byte *) nullptr, (const byte *) nullptr, 0));
|
||||||
|
static_assert(upx::compile_time::mem_eq("", "", 0));
|
||||||
|
static_assert(upx::compile_time::mem_eq("abc", "abc", 3));
|
||||||
|
static_assert(!upx::compile_time::mem_eq("abc", "abz", 3));
|
||||||
|
|
||||||
|
static_assert(upx::compile_time::bswap16(0x0102) == 0x0201);
|
||||||
|
static_assert(upx::compile_time::bswap32(0x01020304) == 0x04030201);
|
||||||
|
static_assert(upx::compile_time::bswap64(0x0102030405060708ull) == 0x0807060504030201ull);
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
struct alignas(1) TestCT final {
|
||||||
|
byte d[8]; // public data
|
||||||
|
|
||||||
|
static constexpr TestCT makeBE16(upx_uint16_t v) noexcept {
|
||||||
|
TestCT x = {};
|
||||||
|
upx::compile_time::set_be16(x.d, v);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
static constexpr TestCT makeBE24(upx_uint32_t v) noexcept {
|
||||||
|
TestCT x = {};
|
||||||
|
upx::compile_time::set_be24(x.d, v);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
static constexpr TestCT makeBE32(upx_uint32_t v) noexcept {
|
||||||
|
TestCT x = {};
|
||||||
|
upx::compile_time::set_be32(x.d, v);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
static constexpr TestCT makeBE64(upx_uint64_t v) noexcept {
|
||||||
|
TestCT x = {};
|
||||||
|
upx::compile_time::set_be64(x.d, v);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
static constexpr TestCT makeLE16(upx_uint16_t v) noexcept {
|
||||||
|
TestCT x = {};
|
||||||
|
upx::compile_time::set_le16(x.d, v);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
static constexpr TestCT makeLE24(upx_uint32_t v) noexcept {
|
||||||
|
TestCT x = {};
|
||||||
|
upx::compile_time::set_le24(x.d, v);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
static constexpr TestCT makeLE32(upx_uint32_t v) noexcept {
|
||||||
|
TestCT x = {};
|
||||||
|
upx::compile_time::set_le32(x.d, v);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
static constexpr TestCT makeLE64(upx_uint64_t v) noexcept {
|
||||||
|
TestCT x = {};
|
||||||
|
upx::compile_time::set_le64(x.d, v);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
// run-time
|
||||||
|
static noinline upx_uint16_t noinline_bswap16(upx_uint16_t v) noexcept {
|
||||||
|
return upx::compile_time::bswap16(v);
|
||||||
|
}
|
||||||
|
static noinline upx_uint32_t noinline_bswap32(upx_uint32_t v) noexcept {
|
||||||
|
return upx::compile_time::bswap32(v);
|
||||||
|
}
|
||||||
|
static noinline upx_uint64_t noinline_bswap64(upx_uint64_t v) noexcept {
|
||||||
|
return upx::compile_time::bswap64(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static noinline upx_uint16_t noinline_get_be16(const byte *p) noexcept {
|
||||||
|
return upx::compile_time::get_be16(p);
|
||||||
|
}
|
||||||
|
static noinline upx_uint32_t noinline_get_be24(const byte *p) noexcept {
|
||||||
|
return upx::compile_time::get_be24(p);
|
||||||
|
}
|
||||||
|
static noinline upx_uint32_t noinline_get_be32(const byte *p) noexcept {
|
||||||
|
return upx::compile_time::get_be32(p);
|
||||||
|
}
|
||||||
|
static noinline upx_uint64_t noinline_get_be64(const byte *p) noexcept {
|
||||||
|
return upx::compile_time::get_be64(p);
|
||||||
|
}
|
||||||
|
static noinline upx_uint16_t noinline_get_le16(const byte *p) noexcept {
|
||||||
|
return upx::compile_time::get_le16(p);
|
||||||
|
}
|
||||||
|
static noinline upx_uint32_t noinline_get_le24(const byte *p) noexcept {
|
||||||
|
return upx::compile_time::get_le24(p);
|
||||||
|
}
|
||||||
|
static noinline upx_uint32_t noinline_get_le32(const byte *p) noexcept {
|
||||||
|
return upx::compile_time::get_le32(p);
|
||||||
|
}
|
||||||
|
static noinline upx_uint64_t noinline_get_le64(const byte *p) noexcept {
|
||||||
|
return upx::compile_time::get_le64(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static noinline void noinline_set_be16(byte * p, upx_uint16_t v) noexcept {
|
||||||
|
upx::compile_time::set_be16(p, v);
|
||||||
|
}
|
||||||
|
static noinline void noinline_set_be24(byte * p, upx_uint32_t v) noexcept {
|
||||||
|
upx::compile_time::set_be24(p, v);
|
||||||
|
}
|
||||||
|
static noinline void noinline_set_be32(byte * p, upx_uint32_t v) noexcept {
|
||||||
|
upx::compile_time::set_be32(p, v);
|
||||||
|
}
|
||||||
|
static noinline void noinline_set_be64(byte * p, upx_uint64_t v) noexcept {
|
||||||
|
upx::compile_time::set_be64(p, v);
|
||||||
|
}
|
||||||
|
static noinline void noinline_set_le16(byte * p, upx_uint16_t v) noexcept {
|
||||||
|
upx::compile_time::set_le16(p, v);
|
||||||
|
}
|
||||||
|
static noinline void noinline_set_le24(byte * p, upx_uint32_t v) noexcept {
|
||||||
|
upx::compile_time::set_le24(p, v);
|
||||||
|
}
|
||||||
|
static noinline void noinline_set_le32(byte * p, upx_uint32_t v) noexcept {
|
||||||
|
upx::compile_time::set_le32(p, v);
|
||||||
|
}
|
||||||
|
static noinline void noinline_set_le64(byte * p, upx_uint64_t v) noexcept {
|
||||||
|
upx::compile_time::set_le64(p, v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
static_assert(sizeof(TestCT) == 8);
|
||||||
|
static_assert(alignof(TestCT) == 1);
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
TEST_CASE("upx::compile_time 1") {
|
||||||
|
constexpr upx_uint16_t v16 = 0x0201;
|
||||||
|
constexpr upx_uint32_t v24 = 0x030201;
|
||||||
|
constexpr upx_uint32_t v32 = 0x04030201;
|
||||||
|
constexpr upx_uint64_t v64 = 0x0807060504030201ull;
|
||||||
|
{
|
||||||
|
static_assert(upx::compile_time::bswap16(v16) == 0x0102);
|
||||||
|
static_assert(upx::compile_time::bswap32(v32) == 0x01020304);
|
||||||
|
static_assert(upx::compile_time::bswap64(v64) == 0x0102030405060708ull);
|
||||||
|
assert_noexcept(TestCT::noinline_bswap16(v16) == 0x0102);
|
||||||
|
assert_noexcept(TestCT::noinline_bswap32(v32) == 0x01020304);
|
||||||
|
assert_noexcept(TestCT::noinline_bswap64(v64) == 0x0102030405060708ull);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
constexpr const byte d[8] = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||||
|
static_assert(upx::compile_time::get_be16(d) == 0x0102);
|
||||||
|
static_assert(upx::compile_time::get_be24(d) == 0x010203);
|
||||||
|
static_assert(upx::compile_time::get_be32(d) == 0x01020304);
|
||||||
|
static_assert(upx::compile_time::get_be64(d) == 0x0102030405060708ull);
|
||||||
|
static_assert(upx::compile_time::get_le16(d) == 0x0201);
|
||||||
|
static_assert(upx::compile_time::get_le24(d) == 0x030201);
|
||||||
|
static_assert(upx::compile_time::get_le32(d) == 0x04030201);
|
||||||
|
static_assert(upx::compile_time::get_le64(d) == 0x0807060504030201ull);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
using upx::compile_time::mem_eq;
|
||||||
|
upx_alignas_max byte aligned_buffer[16] = {};
|
||||||
|
upx::compile_time::mem_set(aligned_buffer, 0xff, 16);
|
||||||
|
assert_noexcept(mem_eq(aligned_buffer, aligned_buffer + 8, 8));
|
||||||
|
byte *const buf = aligned_buffer + 7;
|
||||||
|
|
||||||
|
constexpr auto be16 = TestCT::makeBE16(v16);
|
||||||
|
static_assert(upx::compile_time::get_be16(be16.d) == v16);
|
||||||
|
static_assert(mem_eq(be16.d, "\x02\x01", 2));
|
||||||
|
upx::compile_time::mem_clear(buf, 8);
|
||||||
|
TestCT::noinline_set_be16(buf, v16);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be16(buf) == v16);
|
||||||
|
assert_noexcept(upx::compile_time::get_be16(buf) == v16);
|
||||||
|
assert_noexcept(memcmp(buf, be16.d, 8) == 0);
|
||||||
|
|
||||||
|
constexpr auto be24 = TestCT::makeBE24(v24);
|
||||||
|
static_assert(upx::compile_time::get_be24(be24.d) == v24);
|
||||||
|
static_assert(mem_eq(be24.d, "\x03\x02\x01", 3));
|
||||||
|
upx::compile_time::mem_clear(buf, 8);
|
||||||
|
TestCT::noinline_set_be24(buf, v24);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be24(buf) == v24);
|
||||||
|
assert_noexcept(upx::compile_time::get_be24(buf) == v24);
|
||||||
|
assert_noexcept(memcmp(buf, be24.d, 8) == 0);
|
||||||
|
|
||||||
|
constexpr auto be32 = TestCT::makeBE32(v32);
|
||||||
|
static_assert(upx::compile_time::get_be32(be32.d) == v32);
|
||||||
|
static_assert(mem_eq(be32.d, "\x04\x03\x02\x01", 4));
|
||||||
|
upx::compile_time::mem_clear(buf, 8);
|
||||||
|
TestCT::noinline_set_be32(buf, v32);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be32(buf) == v32);
|
||||||
|
assert_noexcept(upx::compile_time::get_be32(buf) == v32);
|
||||||
|
assert_noexcept(memcmp(buf, be32.d, 8) == 0);
|
||||||
|
|
||||||
|
constexpr auto be64 = TestCT::makeBE64(v64);
|
||||||
|
static_assert(upx::compile_time::get_be64(be64.d) == v64);
|
||||||
|
static_assert(mem_eq(be64.d, "\x08\x07\x06\x05\x04\x03\x02\x01", 8));
|
||||||
|
upx::compile_time::mem_clear(buf, 8);
|
||||||
|
TestCT::noinline_set_be64(buf, v64);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be64(buf) == v64);
|
||||||
|
assert_noexcept(upx::compile_time::get_be64(buf) == v64);
|
||||||
|
assert_noexcept(memcmp(buf, be64.d, 8) == 0);
|
||||||
|
|
||||||
|
constexpr auto le16 = TestCT::makeLE16(v16);
|
||||||
|
static_assert(upx::compile_time::get_le16(le16.d) == v16);
|
||||||
|
static_assert(mem_eq(le16.d, "\x01\x02", 2));
|
||||||
|
upx::compile_time::mem_clear(buf, 8);
|
||||||
|
TestCT::noinline_set_le16(buf, v16);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le16(buf) == v16);
|
||||||
|
assert_noexcept(upx::compile_time::get_le16(buf) == v16);
|
||||||
|
assert_noexcept(memcmp(buf, le16.d, 8) == 0);
|
||||||
|
|
||||||
|
constexpr auto le24 = TestCT::makeLE24(v24);
|
||||||
|
static_assert(upx::compile_time::get_le24(le24.d) == v24);
|
||||||
|
static_assert(mem_eq(le24.d, "\x01\x02\x03", 3));
|
||||||
|
upx::compile_time::mem_clear(buf, 8);
|
||||||
|
TestCT::noinline_set_le24(buf, v24);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le24(buf) == v24);
|
||||||
|
assert_noexcept(upx::compile_time::get_le24(buf) == v24);
|
||||||
|
assert_noexcept(memcmp(buf, le24.d, 8) == 0);
|
||||||
|
|
||||||
|
constexpr auto le32 = TestCT::makeLE32(v32);
|
||||||
|
static_assert(upx::compile_time::get_le32(le32.d) == v32);
|
||||||
|
static_assert(mem_eq(le32.d, "\x01\x02\x03\x04", 4));
|
||||||
|
upx::compile_time::mem_clear(buf, 8);
|
||||||
|
TestCT::noinline_set_le32(buf, v32);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le32(buf) == v32);
|
||||||
|
assert_noexcept(upx::compile_time::get_le32(buf) == v32);
|
||||||
|
assert_noexcept(memcmp(buf, le32.d, 8) == 0);
|
||||||
|
|
||||||
|
constexpr auto le64 = TestCT::makeLE64(v64);
|
||||||
|
static_assert(upx::compile_time::get_le64(le64.d) == v64);
|
||||||
|
static_assert(mem_eq(le64.d, "\x01\x02\x03\x04\x05\x06\x07\x08", 8));
|
||||||
|
upx::compile_time::mem_clear(buf, 8);
|
||||||
|
TestCT::noinline_set_le64(buf, v64);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le64(buf) == v64);
|
||||||
|
assert_noexcept(upx::compile_time::get_le64(buf) == v64);
|
||||||
|
assert_noexcept(memcmp(buf, le64.d, 8) == 0);
|
||||||
|
|
||||||
|
static_assert(upx::compile_time::bswap16(upx::compile_time::get_be16(be16.d)) ==
|
||||||
|
upx::compile_time::get_be16(le16.d));
|
||||||
|
static_assert(upx::compile_time::bswap32(upx::compile_time::get_be32(be32.d)) ==
|
||||||
|
upx::compile_time::get_be32(le32.d));
|
||||||
|
static_assert(upx::compile_time::bswap64(upx::compile_time::get_be64(be64.d)) ==
|
||||||
|
upx::compile_time::get_be64(le64.d));
|
||||||
|
assert_noexcept(TestCT::noinline_bswap16(TestCT::noinline_get_be16(be16.d)) ==
|
||||||
|
TestCT::noinline_get_be16(le16.d));
|
||||||
|
assert_noexcept(TestCT::noinline_bswap32(TestCT::noinline_get_be32(be32.d)) ==
|
||||||
|
TestCT::noinline_get_be32(le32.d));
|
||||||
|
assert_noexcept(TestCT::noinline_bswap64(TestCT::noinline_get_be64(be64.d)) ==
|
||||||
|
TestCT::noinline_get_be64(le64.d));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("upx::compile_time 2") {
|
||||||
|
constexpr upx_uint16_t v16 = 0xf2f1;
|
||||||
|
constexpr upx_uint32_t v24 = 0xf3f2f1;
|
||||||
|
constexpr upx_uint32_t v32 = 0xf4f3f2f1;
|
||||||
|
constexpr upx_uint64_t v64 = 0xf8f7f6f5f4f3f2f1ull;
|
||||||
|
{
|
||||||
|
using upx::compile_time::mem_eq;
|
||||||
|
upx_alignas_max byte aligned_buffer[32];
|
||||||
|
byte *const buf1 = aligned_buffer + 3;
|
||||||
|
byte *const buf2 = aligned_buffer + 13;
|
||||||
|
|
||||||
|
upx::compile_time::set_be16(buf1, v16);
|
||||||
|
TestCT::noinline_set_be16(buf2, v16);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be16(buf1) == v16);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be16(buf2) == v16);
|
||||||
|
assert_noexcept(memcmp(buf1, buf2, 2) == 0);
|
||||||
|
upx::compile_time::set_be24(buf1, v24);
|
||||||
|
TestCT::noinline_set_be24(buf2, v24);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be24(buf1) == v24);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be24(buf2) == v24);
|
||||||
|
assert_noexcept(memcmp(buf1, buf2, 3) == 0);
|
||||||
|
upx::compile_time::set_be32(buf1, v32);
|
||||||
|
TestCT::noinline_set_be32(buf2, v32);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be32(buf1) == v32);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be32(buf2) == v32);
|
||||||
|
assert_noexcept(memcmp(buf1, buf2, 4) == 0);
|
||||||
|
upx::compile_time::set_be64(buf1, v64);
|
||||||
|
TestCT::noinline_set_be64(buf2, v64);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be64(buf1) == v64);
|
||||||
|
assert_noexcept(TestCT::noinline_get_be64(buf2) == v64);
|
||||||
|
assert_noexcept(memcmp(buf1, buf2, 8) == 0);
|
||||||
|
|
||||||
|
upx::compile_time::set_le16(buf1, v16);
|
||||||
|
TestCT::noinline_set_le16(buf2, v16);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le16(buf1) == v16);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le16(buf2) == v16);
|
||||||
|
assert_noexcept(memcmp(buf1, buf2, 2) == 0);
|
||||||
|
upx::compile_time::set_le24(buf1, v24);
|
||||||
|
TestCT::noinline_set_le24(buf2, v24);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le24(buf1) == v24);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le24(buf2) == v24);
|
||||||
|
assert_noexcept(memcmp(buf1, buf2, 3) == 0);
|
||||||
|
upx::compile_time::set_le32(buf1, v32);
|
||||||
|
TestCT::noinline_set_le32(buf2, v32);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le32(buf1) == v32);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le32(buf2) == v32);
|
||||||
|
assert_noexcept(memcmp(buf1, buf2, 4) == 0);
|
||||||
|
upx::compile_time::set_le64(buf1, v64);
|
||||||
|
TestCT::noinline_set_le64(buf2, v64);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le64(buf1) == v64);
|
||||||
|
assert_noexcept(TestCT::noinline_get_le64(buf2) == v64);
|
||||||
|
assert_noexcept(memcmp(buf1, buf2, 8) == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// TriBool
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
template <class T>
|
template <class T>
|
||||||
struct TestTriBool {
|
struct TestTriBool final {
|
||||||
static void test(bool expect_true) {
|
static noinline void test(bool expect_true) {
|
||||||
static_assert(std::is_class<T>::value);
|
static_assert(std::is_class<T>::value);
|
||||||
static_assert(std::is_nothrow_default_constructible<T>::value);
|
static_assert(std::is_nothrow_default_constructible<T>::value);
|
||||||
static_assert(std::is_nothrow_destructible<T>::value);
|
static_assert(std::is_nothrow_destructible<T>::value);
|
||||||
@@ -369,8 +958,12 @@ struct TestTriBool {
|
|||||||
static_assert(std::is_trivially_copyable<T>::value);
|
static_assert(std::is_trivially_copyable<T>::value);
|
||||||
static_assert(sizeof(typename T::value_type) == sizeof(typename T::underlying_type));
|
static_assert(sizeof(typename T::value_type) == sizeof(typename T::underlying_type));
|
||||||
static_assert(alignof(typename T::value_type) == alignof(typename T::underlying_type));
|
static_assert(alignof(typename T::value_type) == alignof(typename T::underlying_type));
|
||||||
#if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
|
#if defined(__m68k__) && defined(__atarist__) && defined(__GNUC__)
|
||||||
// broken compiler or broken ABI
|
// broken compiler or broken ABI
|
||||||
|
#elif defined(__i386__) && defined(__GNUC__) && (__GNUC__ == 7) && !defined(__clang__)
|
||||||
|
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
|
||||||
|
// i386: "long long" enum align bug/ABI problem on older compilers
|
||||||
|
static_assert(alignof(T) <= alignof(typename T::underlying_type));
|
||||||
#else
|
#else
|
||||||
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
|
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
|
||||||
static_assert(alignof(T) == alignof(typename T::underlying_type));
|
static_assert(alignof(T) == alignof(typename T::underlying_type));
|
||||||
@@ -445,9 +1038,11 @@ struct TestTriBool {
|
|||||||
assert(a);
|
assert(a);
|
||||||
assert(bool(a));
|
assert(bool(a));
|
||||||
assert((a ? true : false));
|
assert((a ? true : false));
|
||||||
|
assert((!a ? false : true));
|
||||||
} else {
|
} else {
|
||||||
assert(!a);
|
assert(!a);
|
||||||
assert(!bool(a));
|
assert(!bool(a));
|
||||||
|
assert((a ? false : true));
|
||||||
assert((!a ? true : false));
|
assert((!a ? true : false));
|
||||||
}
|
}
|
||||||
assert(!a.isStrictFalse());
|
assert(!a.isStrictFalse());
|
||||||
|
|||||||
+13
-3
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -49,18 +49,28 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wshadow"
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(UPX_DOCTEST_CONFIG_MULTITHREADING) && !(WITH_THREADS)
|
#if !(WITH_THREADS) && !defined(UPX_DOCTEST_CONFIG_MULTITHREADING)
|
||||||
#ifndef DOCTEST_CONFIG_NO_MULTITHREADING
|
#ifndef DOCTEST_CONFIG_NO_MULTITHREADING
|
||||||
#define DOCTEST_CONFIG_NO_MULTITHREADING
|
#define DOCTEST_CONFIG_NO_MULTITHREADING
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__clang__) && defined(__FAST_MATH__) && defined(__INTEL_LLVM_COMPILER)
|
#if defined(__FAST_MATH__) && defined(__clang__) && (__clang_major__ + 0 > 0)
|
||||||
|
#if __clang_major__ >= 6
|
||||||
// warning: comparison with NaN always evaluates to false in fast floating point modes
|
// warning: comparison with NaN always evaluates to false in fast floating point modes
|
||||||
#pragma clang diagnostic ignored "-Wtautological-constant-compare"
|
#pragma clang diagnostic ignored "-Wtautological-constant-compare"
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__has_warning)
|
||||||
|
#if __has_warning("-Wnan-infinity-disabled")
|
||||||
|
// warning: use of NaN is undefined behavior due to the currently enabled floating-point options
|
||||||
|
#pragma clang diagnostic ignored "-Wnan-infinity-disabled"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// NOLINTBEGIN(bugprone-unintended-char-ostream-output)
|
||||||
#include <doctest/doctest/parts/doctest.cpp>
|
#include <doctest/doctest/parts/doctest.cpp>
|
||||||
|
// NOLINTEND(bugprone-unintended-char-ostream-output)
|
||||||
|
|
||||||
#endif // DOCTEST_CONFIG_DISABLE
|
#endif // DOCTEST_CONFIG_DISABLE
|
||||||
|
|
||||||
|
|||||||
+190
-7
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -101,9 +101,6 @@ TEST_CASE("basic xspan usage") {
|
|||||||
CHECK(b0.raw_size_in_bytes() == 0u);
|
CHECK(b0.raw_size_in_bytes() == 0u);
|
||||||
CHECK(bp.raw_size_in_bytes() == 0u);
|
CHECK(bp.raw_size_in_bytes() == 0u);
|
||||||
#endif
|
#endif
|
||||||
CHECK(raw_bytes(b0, 999999) == buf);
|
|
||||||
CHECK(raw_bytes(bp, 999999) == buf);
|
|
||||||
|
|
||||||
CHECK(raw_bytes(c0, 4) == buf);
|
CHECK(raw_bytes(c0, 4) == buf);
|
||||||
CHECK(raw_index_bytes(c0, 1, 3) == buf + 1);
|
CHECK(raw_index_bytes(c0, 1, 3) == buf + 1);
|
||||||
CHECK(raw_bytes(cp, 4) == buf);
|
CHECK(raw_bytes(cp, 4) == buf);
|
||||||
@@ -180,9 +177,6 @@ TEST_CASE("basic xspan usage") {
|
|||||||
CHECK(b0.raw_size_in_bytes() == 0u);
|
CHECK(b0.raw_size_in_bytes() == 0u);
|
||||||
CHECK(bp.raw_size_in_bytes() == 0u);
|
CHECK(bp.raw_size_in_bytes() == 0u);
|
||||||
#endif
|
#endif
|
||||||
CHECK(raw_bytes(b0, 999999) == buf);
|
|
||||||
CHECK(raw_bytes(bp, 999999) == buf);
|
|
||||||
|
|
||||||
CHECK(raw_bytes(c0, 4) == buf);
|
CHECK(raw_bytes(c0, 4) == buf);
|
||||||
CHECK(raw_index_bytes(c0, 1, 3) == buf + 1);
|
CHECK(raw_index_bytes(c0, 1, 3) == buf + 1);
|
||||||
CHECK(raw_bytes(cp, 4) == buf);
|
CHECK(raw_bytes(cp, 4) == buf);
|
||||||
@@ -876,6 +870,195 @@ TEST_CASE("PtrOrSpan int") {
|
|||||||
CHECK(a == buf + 8);
|
CHECK(a == buf + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifdef UPX_VERSION_HEX
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
template <class T>
|
||||||
|
static noinline void check_bele_a(const T &mb, size_t i) {
|
||||||
|
if (i < 2) {
|
||||||
|
CHECK_THROWS(get_ne16(mb));
|
||||||
|
CHECK_THROWS(get_be16(mb));
|
||||||
|
CHECK_THROWS(get_le16(mb));
|
||||||
|
CHECK_THROWS(set_ne16(mb, 0));
|
||||||
|
CHECK_THROWS(set_be16(mb, 0));
|
||||||
|
CHECK_THROWS(set_le16(mb, 0));
|
||||||
|
} else {
|
||||||
|
CHECK_NOTHROW(get_ne16(mb));
|
||||||
|
CHECK_NOTHROW(get_be16(mb));
|
||||||
|
CHECK_NOTHROW(get_le16(mb));
|
||||||
|
CHECK_NOTHROW(set_ne16(mb, 0));
|
||||||
|
CHECK_NOTHROW(set_be16(mb, 0));
|
||||||
|
CHECK_NOTHROW(set_le16(mb, 0));
|
||||||
|
}
|
||||||
|
if (i < 3) {
|
||||||
|
CHECK_THROWS(get_ne24(mb));
|
||||||
|
CHECK_THROWS(get_be24(mb));
|
||||||
|
CHECK_THROWS(get_le24(mb));
|
||||||
|
CHECK_THROWS(set_ne24(mb, 0));
|
||||||
|
CHECK_THROWS(set_be24(mb, 0));
|
||||||
|
CHECK_THROWS(set_le24(mb, 0));
|
||||||
|
} else {
|
||||||
|
CHECK_NOTHROW(get_ne24(mb));
|
||||||
|
CHECK_NOTHROW(get_be24(mb));
|
||||||
|
CHECK_NOTHROW(get_le24(mb));
|
||||||
|
CHECK_NOTHROW(set_ne24(mb, 0));
|
||||||
|
CHECK_NOTHROW(set_be24(mb, 0));
|
||||||
|
CHECK_NOTHROW(set_le24(mb, 0));
|
||||||
|
}
|
||||||
|
if (i < 4) {
|
||||||
|
CHECK_THROWS(get_ne32(mb));
|
||||||
|
CHECK_THROWS(get_be32(mb));
|
||||||
|
CHECK_THROWS(get_le32(mb));
|
||||||
|
CHECK_THROWS(set_ne32(mb, 0));
|
||||||
|
CHECK_THROWS(set_be32(mb, 0));
|
||||||
|
CHECK_THROWS(set_le32(mb, 0));
|
||||||
|
} else {
|
||||||
|
CHECK_NOTHROW(get_ne32(mb));
|
||||||
|
CHECK_NOTHROW(get_be32(mb));
|
||||||
|
CHECK_NOTHROW(get_le32(mb));
|
||||||
|
CHECK_NOTHROW(set_ne32(mb, 0));
|
||||||
|
CHECK_NOTHROW(set_be32(mb, 0));
|
||||||
|
CHECK_NOTHROW(set_le32(mb, 0));
|
||||||
|
}
|
||||||
|
if (i < 8) {
|
||||||
|
CHECK_THROWS(get_ne64(mb));
|
||||||
|
CHECK_THROWS(get_be64(mb));
|
||||||
|
CHECK_THROWS(get_le64(mb));
|
||||||
|
CHECK_THROWS(set_ne64(mb, 0));
|
||||||
|
CHECK_THROWS(set_be64(mb, 0));
|
||||||
|
CHECK_THROWS(set_le64(mb, 0));
|
||||||
|
} else {
|
||||||
|
CHECK_NOTHROW(get_ne64(mb));
|
||||||
|
CHECK_NOTHROW(get_be64(mb));
|
||||||
|
CHECK_NOTHROW(get_le64(mb));
|
||||||
|
CHECK_NOTHROW(set_ne64(mb, 0));
|
||||||
|
CHECK_NOTHROW(set_be64(mb, 0));
|
||||||
|
CHECK_NOTHROW(set_le64(mb, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template <class T>
|
||||||
|
static noinline void check_bele_c(const T &mb, size_t i) {
|
||||||
|
if (i < 2) {
|
||||||
|
CHECK_THROWS(get_ne16(mb));
|
||||||
|
CHECK_THROWS(get_be16(mb));
|
||||||
|
CHECK_THROWS(get_le16(mb));
|
||||||
|
} else {
|
||||||
|
CHECK_NOTHROW(get_ne16(mb));
|
||||||
|
CHECK_NOTHROW(get_be16(mb));
|
||||||
|
CHECK_NOTHROW(get_le16(mb));
|
||||||
|
}
|
||||||
|
if (i < 3) {
|
||||||
|
CHECK_THROWS(get_ne24(mb));
|
||||||
|
CHECK_THROWS(get_be24(mb));
|
||||||
|
CHECK_THROWS(get_le24(mb));
|
||||||
|
} else {
|
||||||
|
CHECK_NOTHROW(get_ne24(mb));
|
||||||
|
CHECK_NOTHROW(get_be24(mb));
|
||||||
|
CHECK_NOTHROW(get_le24(mb));
|
||||||
|
}
|
||||||
|
if (i < 4) {
|
||||||
|
CHECK_THROWS(get_ne32(mb));
|
||||||
|
CHECK_THROWS(get_be32(mb));
|
||||||
|
CHECK_THROWS(get_le32(mb));
|
||||||
|
} else {
|
||||||
|
CHECK_NOTHROW(get_ne32(mb));
|
||||||
|
CHECK_NOTHROW(get_be32(mb));
|
||||||
|
CHECK_NOTHROW(get_le32(mb));
|
||||||
|
}
|
||||||
|
if (i < 8) {
|
||||||
|
CHECK_THROWS(get_ne64(mb));
|
||||||
|
CHECK_THROWS(get_be64(mb));
|
||||||
|
CHECK_THROWS(get_le64(mb));
|
||||||
|
} else {
|
||||||
|
CHECK_NOTHROW(get_ne64(mb));
|
||||||
|
CHECK_NOTHROW(get_be64(mb));
|
||||||
|
CHECK_NOTHROW(get_le64(mb));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // UPX_VERSION_HEX
|
||||||
|
|
||||||
|
TEST_CASE("xspan global overloads") {
|
||||||
|
byte buf_a[16] = {};
|
||||||
|
const byte buf_c[16] = {};
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 16; i++) {
|
||||||
|
XSPAN_0_VAR(byte, a0, buf_a, i);
|
||||||
|
XSPAN_P_VAR(byte, ap, buf_a, i);
|
||||||
|
XSPAN_S_VAR(byte, as, buf_a, i);
|
||||||
|
|
||||||
|
XSPAN_0_VAR(const byte, c0, buf_c, i);
|
||||||
|
XSPAN_P_VAR(const byte, cp, buf_c, i);
|
||||||
|
XSPAN_S_VAR(const byte, cs, buf_c, i);
|
||||||
|
|
||||||
|
#ifdef UPX_VERSION_HEX
|
||||||
|
check_bele_a(a0, i);
|
||||||
|
check_bele_a(ap, i);
|
||||||
|
check_bele_a(as, i);
|
||||||
|
|
||||||
|
check_bele_c(c0, i);
|
||||||
|
check_bele_c(cp, i);
|
||||||
|
check_bele_c(cs, i);
|
||||||
|
|
||||||
|
CHECK_THROWS(upx_adler32(a0, i + 1));
|
||||||
|
CHECK_THROWS(upx_adler32(ap, i + 1));
|
||||||
|
CHECK_THROWS(upx_adler32(as, i + 1));
|
||||||
|
CHECK_THROWS(upx_adler32(c0, i + 1));
|
||||||
|
CHECK_THROWS(upx_adler32(cp, i + 1));
|
||||||
|
CHECK_THROWS(upx_adler32(cs, i + 1));
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
CHECK_THROWS(upx_safe_strlen(a0));
|
||||||
|
CHECK_THROWS(upx_safe_strlen(ap));
|
||||||
|
CHECK_THROWS(upx_safe_strlen(as));
|
||||||
|
CHECK_THROWS(upx_safe_strlen(c0));
|
||||||
|
CHECK_THROWS(upx_safe_strlen(cp));
|
||||||
|
CHECK_THROWS(upx_safe_strlen(cs));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CHECK_THROWS(memchr(a0, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
|
||||||
|
CHECK_THROWS(memchr(ap, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
|
||||||
|
CHECK_THROWS(memchr(as, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
|
||||||
|
CHECK_THROWS(memchr(c0, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
|
||||||
|
CHECK_THROWS(memchr(cp, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
|
||||||
|
CHECK_THROWS(memchr(cs, 0, i + 1)); // NOLINT(bugprone-unused-return-value)
|
||||||
|
|
||||||
|
CHECK(memcmp(a0, a0, i) == 0);
|
||||||
|
CHECK(memcmp(ap, a0, i) == 0);
|
||||||
|
CHECK(memcmp(as, a0, i) == 0);
|
||||||
|
CHECK_THROWS(memcmp(a0, a0, i + 1)); // NOLINT(bugprone-unused-return-value)
|
||||||
|
CHECK_THROWS(memcmp(ap, a0, i + 1)); // NOLINT(bugprone-unused-return-value)
|
||||||
|
CHECK_THROWS(memcmp(as, a0, i + 1)); // NOLINT(bugprone-unused-return-value)
|
||||||
|
|
||||||
|
CHECK_NOTHROW(memcpy(a0, c0, i));
|
||||||
|
CHECK_NOTHROW(memcpy(ap, cp, i));
|
||||||
|
CHECK_NOTHROW(memcpy(as, cs, i));
|
||||||
|
CHECK_THROWS(memcpy(a0, c0, i + 1));
|
||||||
|
CHECK_THROWS(memcpy(ap, cp, i + 1));
|
||||||
|
CHECK_THROWS(memcpy(as, cs, i + 1));
|
||||||
|
|
||||||
|
CHECK_NOTHROW(memmove(a0, c0, i));
|
||||||
|
CHECK_NOTHROW(memmove(ap, cp, i));
|
||||||
|
CHECK_NOTHROW(memmove(as, cs, i));
|
||||||
|
CHECK_THROWS(memmove(a0, c0, i + 1));
|
||||||
|
CHECK_THROWS(memmove(ap, cp, i + 1));
|
||||||
|
CHECK_THROWS(memmove(as, cs, i + 1));
|
||||||
|
|
||||||
|
CHECK_NOTHROW(memset(a0, 255, i));
|
||||||
|
CHECK_NOTHROW(memset(ap, 255, i));
|
||||||
|
CHECK_NOTHROW(memset(as, 255, i));
|
||||||
|
CHECK_THROWS(memset(a0, 254, i + 1));
|
||||||
|
CHECK_THROWS(memset(ap, 254, i + 1));
|
||||||
|
CHECK_THROWS(memset(as, 254, i + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// codegen
|
// codegen
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -30,16 +30,11 @@
|
|||||||
|
|
||||||
#if (ACC_CC_CLANG)
|
#if (ACC_CC_CLANG)
|
||||||
#pragma clang diagnostic ignored "-Wshadow"
|
#pragma clang diagnostic ignored "-Wshadow"
|
||||||
#endif
|
#elif (ACC_CC_GNUC >= 0x040200)
|
||||||
#if (ACC_CC_GNUC >= 0x040200)
|
|
||||||
#pragma GCC diagnostic ignored "-Wshadow"
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
#endif
|
#elif (ACC_CC_MSC)
|
||||||
#if (ACC_CC_MSC)
|
|
||||||
#pragma warning(disable : 4456) // -Wno-shadow
|
#pragma warning(disable : 4456) // -Wno-shadow
|
||||||
#endif
|
#endif
|
||||||
#if (ACC_CC_MSC && (_MSC_VER < 1900))
|
|
||||||
#pragma warning(disable : 4127) // warning C4127: conditional expression is constant
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void lzma_compress_config_t::reset() noexcept {
|
void lzma_compress_config_t::reset() noexcept {
|
||||||
pos_bits.reset();
|
pos_bits.reset();
|
||||||
@@ -53,41 +48,15 @@ void lzma_compress_config_t::reset() noexcept {
|
|||||||
max_num_probs = 0;
|
max_num_probs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// INFO: the LZMA SDK is covered by a permissive license which allows
|
// INFO: LZMA SDK is placed in the public domain.
|
||||||
// using unmodified LZMA source code in UPX and the UPX stubs.
|
|
||||||
// See SPECIAL EXCEPTION below.
|
|
||||||
//
|
//
|
||||||
// Quoting from lzma-4.43/lzma.txt:
|
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
// distribute the original LZMA SDK code, either in source code form
|
||||||
|
// or as a compiled binary, for any purpose, commercial or non-commercial,
|
||||||
|
// and by any means.
|
||||||
//
|
//
|
||||||
// LICENSE
|
// https://www.7-zip.org/sdk.html
|
||||||
// -------
|
// https://sourceforge.net/p/sevenzip/discussion/45797/thread/685169cf/
|
||||||
//
|
|
||||||
// LZMA SDK is available under any of the following licenses:
|
|
||||||
//
|
|
||||||
// 1) GNU Lesser General Public License (GNU LGPL)
|
|
||||||
// 2) Common Public License (CPL)
|
|
||||||
// 3) Simplified license for unmodified code (read SPECIAL EXCEPTION)
|
|
||||||
// 4) Proprietary license
|
|
||||||
//
|
|
||||||
// It means that you can select one of these four options and follow rules
|
|
||||||
// of that license.
|
|
||||||
//
|
|
||||||
// 1,2) GNU LGPL and CPL licenses are pretty similar and both these
|
|
||||||
// licenses are classified as
|
|
||||||
// - "Free software licenses" at http://www.gnu.org/
|
|
||||||
// - "OSI-approved" at http://www.opensource.org/
|
|
||||||
//
|
|
||||||
// 3) SPECIAL EXCEPTION
|
|
||||||
//
|
|
||||||
// Igor Pavlov, as the author of this code, expressly permits you
|
|
||||||
// to statically or dynamically link your code (or bind by name)
|
|
||||||
// to the files from LZMA SDK without subjecting your linked
|
|
||||||
// code to the terms of the CPL or GNU LGPL.
|
|
||||||
// Any modifications or additions to files from LZMA SDK, however,
|
|
||||||
// are subject to the GNU LGPL or CPL terms.
|
|
||||||
//
|
|
||||||
// SPECIAL EXCEPTION allows you to use LZMA SDK in applications with closed code,
|
|
||||||
// while you keep LZMA SDK code unmodified.
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// compress defaults
|
// compress defaults
|
||||||
@@ -158,11 +127,11 @@ static bool prepare_result(lzma_compress_result_t *res, unsigned src_len, int me
|
|||||||
|
|
||||||
// cconf overrides
|
// cconf overrides
|
||||||
if (lcconf) {
|
if (lcconf) {
|
||||||
oassign(res->pos_bits, lcconf->pos_bits);
|
upx::oassign(res->pos_bits, lcconf->pos_bits);
|
||||||
oassign(res->lit_pos_bits, lcconf->lit_pos_bits);
|
upx::oassign(res->lit_pos_bits, lcconf->lit_pos_bits);
|
||||||
oassign(res->lit_context_bits, lcconf->lit_context_bits);
|
upx::oassign(res->lit_context_bits, lcconf->lit_context_bits);
|
||||||
oassign(res->dict_size, lcconf->dict_size);
|
upx::oassign(res->dict_size, lcconf->dict_size);
|
||||||
oassign(res->num_fast_bytes, lcconf->num_fast_bytes);
|
upx::oassign(res->num_fast_bytes, lcconf->num_fast_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// limit dictionary size
|
// limit dictionary size
|
||||||
@@ -206,15 +175,12 @@ error:
|
|||||||
// compress - cruft because of pseudo-COM layer
|
// compress - cruft because of pseudo-COM layer
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// ensure proper nullptr usage
|
#if (ACC_CC_CLANG >= 0x080000)
|
||||||
// TODO later: examine why we need this in the first place
|
#pragma clang diagnostic push
|
||||||
#undef NULL
|
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||||
// NOLINTBEGIN(clang-analyzer-optin.cplusplus.*)
|
#elif (ACC_CC_GNUC >= 0x040700)
|
||||||
#define NULL nullptr
|
#pragma GCC diagnostic push
|
||||||
// NOLINTEND(clang-analyzer-optin.cplusplus.*)
|
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||||
#if defined(__GNUC__)
|
|
||||||
#undef __null
|
|
||||||
#define __null nullptr
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef MSDOS
|
#undef MSDOS
|
||||||
@@ -316,6 +282,12 @@ STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outS
|
|||||||
#include <lzma-sdk/C/7zip/Compress/RangeCoder/RangeCoderBit.cpp>
|
#include <lzma-sdk/C/7zip/Compress/RangeCoder/RangeCoderBit.cpp>
|
||||||
#undef RC_NORMALIZE
|
#undef RC_NORMALIZE
|
||||||
|
|
||||||
|
#if (ACC_CC_CLANG >= 0x080000)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#elif (ACC_CC_GNUC >= 0x040700)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
int upx_lzma_compress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsigned *dst_len,
|
int upx_lzma_compress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsigned *dst_len,
|
||||||
upx_callback_t *cb, int method, int level,
|
upx_callback_t *cb, int method, int level,
|
||||||
const upx_compress_config_t *cconf_parm, upx_compress_result_t *cresult) {
|
const upx_compress_config_t *cconf_parm, upx_compress_result_t *cresult) {
|
||||||
@@ -340,7 +312,8 @@ int upx_lzma_compress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsi
|
|||||||
progress.cb = cb; // progress.Init()
|
progress.cb = cb; // progress.Init()
|
||||||
|
|
||||||
NCompress::NLZMA::CEncoder enc;
|
NCompress::NLZMA::CEncoder enc;
|
||||||
const PROPID propIDs[8] = {
|
constexpr unsigned NPROPS = 8;
|
||||||
|
static const PROPID propIDs[NPROPS] = {
|
||||||
NCoderPropID::kPosStateBits, // 0 pb _posStateBits(2)
|
NCoderPropID::kPosStateBits, // 0 pb _posStateBits(2)
|
||||||
NCoderPropID::kLitPosBits, // 1 lp _numLiteralPosStateBits(0)
|
NCoderPropID::kLitPosBits, // 1 lp _numLiteralPosStateBits(0)
|
||||||
NCoderPropID::kLitContextBits, // 2 lc _numLiteralContextBits(3)
|
NCoderPropID::kLitContextBits, // 2 lc _numLiteralContextBits(3)
|
||||||
@@ -350,8 +323,7 @@ int upx_lzma_compress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsi
|
|||||||
NCoderPropID::kMatchFinderCycles, // 6 mfc _matchFinderCycles, _cutValue
|
NCoderPropID::kMatchFinderCycles, // 6 mfc _matchFinderCycles, _cutValue
|
||||||
NCoderPropID::kMatchFinder // 7 mf
|
NCoderPropID::kMatchFinder // 7 mf
|
||||||
};
|
};
|
||||||
PROPVARIANT pr[8];
|
PROPVARIANT pr[NPROPS];
|
||||||
const unsigned nprops = 8;
|
|
||||||
if (!prepare_result(res, src_len, method, level, lcconf))
|
if (!prepare_result(res, src_len, method, level, lcconf))
|
||||||
goto error;
|
goto error;
|
||||||
pr[0].vt = pr[1].vt = pr[2].vt = pr[3].vt = pr[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
|
pr[0].vt = pr[1].vt = pr[2].vt = pr[3].vt = pr[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
|
||||||
@@ -368,7 +340,7 @@ int upx_lzma_compress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsi
|
|||||||
pr[7].bstrVal = ACC_PCAST(BSTR, ACC_UNCONST_CAST(wchar_t *, matchfinder));
|
pr[7].bstrVal = ACC_PCAST(BSTR, ACC_UNCONST_CAST(wchar_t *, matchfinder));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (enc.SetCoderProperties(propIDs, pr, nprops) != S_OK)
|
if (enc.SetCoderProperties(propIDs, pr, NPROPS) != S_OK)
|
||||||
goto error;
|
goto error;
|
||||||
// encode properties in LZMA-style (5 bytes)
|
// encode properties in LZMA-style (5 bytes)
|
||||||
if (enc.WriteCoderProperties(&os) != S_OK)
|
if (enc.WriteCoderProperties(&os) != S_OK)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -248,8 +248,13 @@ static void __UCL_CDECL my_free(ucl_voidp p) { free(p); }
|
|||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
int upx_ucl_init(void) {
|
int upx_ucl_init(void) {
|
||||||
|
#if 1 && (ACC_CC_MSC && ACC_ARCH_I386) && (_MSC_VER >= 1940)
|
||||||
|
// @COMPILER_BUG @MSVC_BUG
|
||||||
|
(void) ucl_init();
|
||||||
|
#else
|
||||||
if (ucl_init() != UCL_E_OK)
|
if (ucl_init() != UCL_E_OK)
|
||||||
return -1;
|
return -1;
|
||||||
|
#endif
|
||||||
if (UCL_VERSION != ucl_version() || strcmp(UCL_VERSION_STRING, ucl_version_string()) != 0)
|
if (UCL_VERSION != ucl_version() || strcmp(UCL_VERSION_STRING, ucl_version_string()) != 0)
|
||||||
return -2;
|
return -2;
|
||||||
ucl_set_malloc_hooks(my_malloc, my_free);
|
ucl_set_malloc_hooks(my_malloc, my_free);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -25,13 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../conf.h"
|
#include "../conf.h"
|
||||||
#include "compress.h"
|
|
||||||
#include "../util/membuffer.h"
|
|
||||||
// NOLINTBEGIN(clang-analyzer-optin.performance.Padding)
|
|
||||||
#define ZLIB_CONST 1
|
|
||||||
#include <zlib/zlib.h>
|
|
||||||
#include <zlib/deflate.h>
|
|
||||||
// NOLINTEND(clang-analyzer-optin.performance.Padding)
|
|
||||||
|
|
||||||
void zlib_compress_config_t::reset() noexcept {
|
void zlib_compress_config_t::reset() noexcept {
|
||||||
mem_clear(this);
|
mem_clear(this);
|
||||||
@@ -40,6 +33,15 @@ void zlib_compress_config_t::reset() noexcept {
|
|||||||
strategy.reset();
|
strategy.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WITH_ZLIB
|
||||||
|
#include "compress.h"
|
||||||
|
#include "../util/membuffer.h"
|
||||||
|
// NOLINTBEGIN(clang-analyzer-optin.performance.Padding)
|
||||||
|
#define ZLIB_CONST 1
|
||||||
|
#include <zlib/zlib.h>
|
||||||
|
#include <zlib/deflate.h>
|
||||||
|
// NOLINTEND(clang-analyzer-optin.performance.Padding)
|
||||||
|
|
||||||
static int convert_errno_from_zlib(int zr) {
|
static int convert_errno_from_zlib(int zr) {
|
||||||
switch (zr) {
|
switch (zr) {
|
||||||
case Z_OK:
|
case Z_OK:
|
||||||
@@ -95,9 +97,9 @@ int upx_zlib_compress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsi
|
|||||||
zlib_compress_config_t::strategy_t strategy;
|
zlib_compress_config_t::strategy_t strategy;
|
||||||
// cconf overrides
|
// cconf overrides
|
||||||
if (lcconf) {
|
if (lcconf) {
|
||||||
oassign(mem_level, lcconf->mem_level);
|
upx::oassign(mem_level, lcconf->mem_level);
|
||||||
oassign(window_bits, lcconf->window_bits);
|
upx::oassign(window_bits, lcconf->window_bits);
|
||||||
oassign(strategy, lcconf->strategy);
|
upx::oassign(strategy, lcconf->strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
z_stream s;
|
z_stream s;
|
||||||
@@ -307,4 +309,6 @@ TEST_CASE("upx_zlib_decompress") {
|
|||||||
UNUSED(r);
|
UNUSED(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // WITH_ZLIB
|
||||||
|
|
||||||
/* vim:set ts=4 sw=4 et: */
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+116
-103
@@ -1,9 +1,9 @@
|
|||||||
/* conf.h --
|
/* conf.h -- primary configuration
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -32,6 +32,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "util/system_headers.h"
|
#include "util/system_headers.h"
|
||||||
|
#include "util/system_undefs.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#if !defined(__has_attribute)
|
#if !defined(__has_attribute)
|
||||||
@@ -40,29 +41,46 @@
|
|||||||
#if !defined(__has_builtin)
|
#if !defined(__has_builtin)
|
||||||
#define __has_builtin(x) 0
|
#define __has_builtin(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(__has_declspec_attribute)
|
||||||
|
#define __has_declspec_attribute(x) 0
|
||||||
|
#endif
|
||||||
#if !defined(__has_feature)
|
#if !defined(__has_feature)
|
||||||
#define __has_feature(x) 0
|
#define __has_feature(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(__has_include)
|
||||||
|
#define __has_include(x) 0
|
||||||
|
#endif
|
||||||
|
#if !defined(__has_warning)
|
||||||
|
#define __has_warning(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// reserve name "upx" for namespace
|
// reserve name "upx" for namespace
|
||||||
namespace upx {}
|
namespace upx {}
|
||||||
|
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(CHAR_BIT == 8)
|
// check compiler core
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(short) == 2)
|
static_assert(CHAR_BIT == 8);
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4)
|
static_assert(sizeof(short) == 2);
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(long long) == 8)
|
static_assert(sizeof(int) == 4);
|
||||||
|
static_assert(sizeof(long long) == 8);
|
||||||
// check sane compiler mandatory flags
|
// check sane compiler mandatory flags
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(-1 == ~0) // two's complement - see http://wg21.link/P0907R4
|
static_assert(-1 == ~0); // two's complement - see https://wg21.link/P0907R4
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(0u - 1 == ~0u) // two's complement - see http://wg21.link/P0907R4
|
static_assert(0u - 1 == ~0u); // two's complement - see https://wg21.link/P0907R4
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((1u << 31) << 1 == 0)
|
static_assert((1u << 31) << 1 == 0);
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(((int) (1u << 31)) >> 31 == -1) // arithmetic right shift
|
static_assert(((int) (1u << 31)) >> 31 == -1); // arithmetic right shift
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((-1) >> 31 == -1) // arithmetic right shift
|
static_assert((-1) >> 31 == -1); // arithmetic right shift
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(CHAR_MAX == 255) // -funsigned-char
|
static_assert(CHAR_MAX == 255); // -funsigned-char
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER((char) (-1) == 255)
|
static_assert((char) (-1) == 255); // -funsigned-char
|
||||||
|
|
||||||
|
// disable some more strict warnings
|
||||||
|
#if defined(__clang__) && __has_warning("-Wunnecessary-virtual-specifier")
|
||||||
|
#pragma clang diagnostic ignored "-Wunnecessary-virtual-specifier"
|
||||||
|
#endif
|
||||||
// enable some more strict warnings for Git developer builds
|
// enable some more strict warnings for Git developer builds
|
||||||
#if defined(UPX_CONFIG_DISABLE_WSTRICT) && (UPX_CONFIG_DISABLE_WSTRICT + 0 == 0)
|
#if defined(UPX_CONFIG_DISABLE_WSTRICT) && (UPX_CONFIG_DISABLE_WSTRICT + 0 == 0)
|
||||||
#if defined(UPX_CONFIG_DISABLE_WERROR) && (UPX_CONFIG_DISABLE_WERROR + 0 == 0)
|
#if defined(UPX_CONFIG_DISABLE_WERROR) && (UPX_CONFIG_DISABLE_WERROR + 0 == 0)
|
||||||
|
#if (ACC_CC_MSC)
|
||||||
|
#pragma warning(error : 4714) // W4: function marked as __forceinline not inlined
|
||||||
|
#endif
|
||||||
#if (ACC_CC_CLANG >= 0x0b0000)
|
#if (ACC_CC_CLANG >= 0x0b0000)
|
||||||
#pragma clang diagnostic error "-Wsuggest-override"
|
#pragma clang diagnostic error "-Wsuggest-override"
|
||||||
#elif (ACC_CC_GNUC >= 0x0a0000)
|
#elif (ACC_CC_GNUC >= 0x0a0000)
|
||||||
@@ -82,6 +100,15 @@ ACC_COMPILE_TIME_ASSERT_HEADER((char) (-1) == 255)
|
|||||||
#endif // UPX_CONFIG_DISABLE_WERROR
|
#endif // UPX_CONFIG_DISABLE_WERROR
|
||||||
#endif // UPX_CONFIG_DISABLE_WSTRICT
|
#endif // UPX_CONFIG_DISABLE_WSTRICT
|
||||||
|
|
||||||
|
// upx_is_constant_evaluated
|
||||||
|
#if __cplusplus >= 202002L // C++20
|
||||||
|
#define upx_is_constant_evaluated std::is_constant_evaluated
|
||||||
|
#elif __has_builtin(__builtin_is_constant_evaluated) // clang-9, gcc-10
|
||||||
|
#define upx_is_constant_evaluated __builtin_is_constant_evaluated
|
||||||
|
#elif (ACC_CC_GNUC >= 0x090000) && 1 // gcc-9
|
||||||
|
#define upx_is_constant_evaluated __builtin_is_constant_evaluated
|
||||||
|
#endif
|
||||||
|
|
||||||
// multithreading (UPX currently does not use multithreading)
|
// multithreading (UPX currently does not use multithreading)
|
||||||
#if (WITH_THREADS)
|
#if (WITH_THREADS)
|
||||||
#define upx_thread_local thread_local
|
#define upx_thread_local thread_local
|
||||||
@@ -93,7 +120,7 @@ ACC_COMPILE_TIME_ASSERT_HEADER((char) (-1) == 255)
|
|||||||
#define upx_std_atomic(Type) Type
|
#define upx_std_atomic(Type) Type
|
||||||
#define upx_std_once_flag upx_std_atomic(size_t)
|
#define upx_std_once_flag upx_std_atomic(size_t)
|
||||||
template <class NoexceptCallable>
|
template <class NoexceptCallable>
|
||||||
inline void upx_std_call_once(upx_std_once_flag &flag, NoexceptCallable &&f) {
|
inline void upx_std_call_once(upx_std_once_flag &flag, NoexceptCallable &&f) noexcept {
|
||||||
if (__acc_unlikely(!flag)) {
|
if (__acc_unlikely(!flag)) {
|
||||||
flag = 1;
|
flag = 1;
|
||||||
f();
|
f();
|
||||||
@@ -115,7 +142,7 @@ inline constexpr bool upx_is_integral_v = upx_is_integral<T>::value;
|
|||||||
#define upx_fake_alignas_16 __attribute__((__aligned__(2))) // object file maximum 2 ???
|
#define upx_fake_alignas_16 __attribute__((__aligned__(2))) // object file maximum 2 ???
|
||||||
#define upx_fake_alignas__(x) upx_fake_alignas_##x
|
#define upx_fake_alignas__(x) upx_fake_alignas_##x
|
||||||
#define alignas(x) upx_fake_alignas__(x)
|
#define alignas(x) upx_fake_alignas__(x)
|
||||||
#define upx_alignas_max upx_fake_alignas_4
|
#define upx_alignas_max upx_fake_alignas_2
|
||||||
#endif
|
#endif
|
||||||
#ifndef upx_alignas_max
|
#ifndef upx_alignas_max
|
||||||
#define upx_alignas_max alignas(std::max_align_t)
|
#define upx_alignas_max alignas(std::max_align_t)
|
||||||
@@ -143,7 +170,19 @@ typedef acc_int32_t upx_int32_t;
|
|||||||
typedef acc_uint32_t upx_uint32_t;
|
typedef acc_uint32_t upx_uint32_t;
|
||||||
typedef acc_int64_t upx_int64_t;
|
typedef acc_int64_t upx_int64_t;
|
||||||
typedef acc_uint64_t upx_uint64_t;
|
typedef acc_uint64_t upx_uint64_t;
|
||||||
|
#if (__SIZEOF_INT128__ == 16)
|
||||||
|
typedef __int128 upx_int128_t;
|
||||||
|
typedef unsigned __int128 upx_uint128_t;
|
||||||
|
#endif
|
||||||
typedef acc_uintptr_t upx_uintptr_t;
|
typedef acc_uintptr_t upx_uintptr_t;
|
||||||
|
#if defined(__PTRADDR_TYPE__) // CHERI
|
||||||
|
typedef __PTRADDR_TYPE__ upx_ptraddr_t;
|
||||||
|
#else
|
||||||
|
typedef upx_uintptr_t upx_ptraddr_t;
|
||||||
|
#endif
|
||||||
|
typedef std::make_signed_t<upx_ptraddr_t> upx_sptraddr_t; // signed ptraddr_t
|
||||||
|
typedef std::make_unsigned_t<ptrdiff_t> upx_uptrdiff_t; // unsigned ptrdiff_t
|
||||||
|
typedef std::make_signed_t<size_t> upx_ssize_t; // signed size_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
|
||||||
@@ -156,13 +195,13 @@ typedef unsigned char uchar;
|
|||||||
// upx_charptr_unit_type is some opaque type with sizeof(type) == 1
|
// upx_charptr_unit_type is some opaque type with sizeof(type) == 1
|
||||||
//// typedef char upx_charptr_unit_type; // also works
|
//// typedef char upx_charptr_unit_type; // also works
|
||||||
struct alignas(1) upx_charptr_unit_type final { char hidden__; };
|
struct alignas(1) upx_charptr_unit_type final { char hidden__; };
|
||||||
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(upx_charptr_unit_type) == 1)
|
static_assert(sizeof(upx_charptr_unit_type) == 1);
|
||||||
|
|
||||||
// using the system off_t was a bad idea even back in 199x...
|
// using the system off_t was a bad idea even back in 199x...
|
||||||
typedef upx_int64_t upx_off_t;
|
typedef long long upx_off_t;
|
||||||
#undef off_t
|
#undef off_t
|
||||||
#if 0
|
#if 0
|
||||||
// TODO cleanup: at some future point we can do this:
|
// TODO later cleanup: at some future point we can do this:
|
||||||
#define off_t DO_NOT_USE_off_t
|
#define off_t DO_NOT_USE_off_t
|
||||||
#else
|
#else
|
||||||
#define off_t upx_off_t
|
#define off_t upx_off_t
|
||||||
@@ -180,7 +219,7 @@ typedef upx_int64_t upx_off_t;
|
|||||||
#if defined(__clang__) || defined(__GNUC__)
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
#define noreturn noinline __attribute__((__noreturn__))
|
#define noreturn noinline __attribute__((__noreturn__))
|
||||||
#elif (ACC_CC_MSC)
|
#elif (ACC_CC_MSC)
|
||||||
// do not use, generates annoying "warning C4702: unreachable code"
|
// do not use, triggers annoying "warning C4702: unreachable code"
|
||||||
////#define noreturn noinline __declspec(noreturn)
|
////#define noreturn noinline __declspec(noreturn)
|
||||||
#define noreturn noinline
|
#define noreturn noinline
|
||||||
#else
|
#else
|
||||||
@@ -192,8 +231,8 @@ typedef upx_int64_t upx_off_t;
|
|||||||
#define very_likely __acc_very_likely
|
#define very_likely __acc_very_likely
|
||||||
#define very_unlikely __acc_very_unlikely
|
#define very_unlikely __acc_very_unlikely
|
||||||
|
|
||||||
// cosmetic: explicitly annotate some functions which may throw exceptions
|
// cosmetic: explicitly annotate some functions which may throw exceptions;
|
||||||
// note: noexcept(false) is the default for all C++ functions anyway
|
// note that noexcept(false) is the default for all C++ functions anyway
|
||||||
#define may_throw noexcept(false)
|
#define may_throw noexcept(false)
|
||||||
|
|
||||||
#define COMPILE_TIME_ASSERT(e) ACC_COMPILE_TIME_ASSERT(e)
|
#define COMPILE_TIME_ASSERT(e) ACC_COMPILE_TIME_ASSERT(e)
|
||||||
@@ -204,20 +243,6 @@ typedef upx_int64_t upx_off_t;
|
|||||||
// portab
|
// portab
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// some platform system headers may pre-define these, so undef to avoid conflicts
|
|
||||||
#undef _
|
|
||||||
#undef __
|
|
||||||
#undef ___
|
|
||||||
#undef dos
|
|
||||||
#undef large
|
|
||||||
#undef linux
|
|
||||||
#undef PAGE_MASK
|
|
||||||
#undef PAGE_SIZE
|
|
||||||
#undef small
|
|
||||||
#undef SP
|
|
||||||
#undef SS
|
|
||||||
#undef tos
|
|
||||||
#undef unix
|
|
||||||
#if (ACC_OS_POSIX) && !defined(__unix__)
|
#if (ACC_OS_POSIX) && !defined(__unix__)
|
||||||
#define __unix__ 1
|
#define __unix__ 1
|
||||||
#endif
|
#endif
|
||||||
@@ -230,12 +255,6 @@ typedef upx_int64_t upx_off_t;
|
|||||||
#undef sopen
|
#undef sopen
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_DUP) && (HAVE_DUP + 0 == 0)
|
|
||||||
// TODO later: add upx_fd_dup() util
|
|
||||||
#undef dup
|
|
||||||
#define dup(x) (-1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef STDIN_FILENO
|
#ifndef STDIN_FILENO
|
||||||
#define STDIN_FILENO (fileno(stdin))
|
#define STDIN_FILENO (fileno(stdin))
|
||||||
#endif
|
#endif
|
||||||
@@ -292,6 +311,14 @@ typedef upx_int64_t upx_off_t;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// some platforms may provide their own system bswapXX() functions, so rename to avoid conflicts
|
||||||
|
#undef bswap16
|
||||||
|
#undef bswap32
|
||||||
|
#undef bswap64
|
||||||
|
#define bswap16 upx_bswap16
|
||||||
|
#define bswap32 upx_bswap32
|
||||||
|
#define bswap64 upx_bswap64
|
||||||
|
|
||||||
// avoid warnings about shadowing global symbols
|
// avoid warnings about shadowing global symbols
|
||||||
#undef _base
|
#undef _base
|
||||||
#undef basename
|
#undef basename
|
||||||
@@ -338,7 +365,7 @@ typedef upx_int64_t upx_off_t;
|
|||||||
// TODO later: check __MINGW_PRINTF_FORMAT
|
// TODO later: check __MINGW_PRINTF_FORMAT
|
||||||
#if defined(_WIN32) && defined(__MINGW32__) && defined(__GNUC__) && !defined(__clang__)
|
#if defined(_WIN32) && defined(__MINGW32__) && defined(__GNUC__) && !defined(__clang__)
|
||||||
#define attribute_format(a, b) __attribute__((__format__(__gnu_printf__, a, b)))
|
#define attribute_format(a, b) __attribute__((__format__(__gnu_printf__, a, b)))
|
||||||
#elif (ACC_CC_CLANG || ACC_CC_GNUC)
|
#elif defined(__clang__) || defined(__GNUC__)
|
||||||
#define attribute_format(a, b) __attribute__((__format__(__printf__, a, b)))
|
#define attribute_format(a, b) __attribute__((__format__(__printf__, a, b)))
|
||||||
#else
|
#else
|
||||||
#define attribute_format(a, b) /*empty*/
|
#define attribute_format(a, b) /*empty*/
|
||||||
@@ -346,11 +373,21 @@ typedef upx_int64_t upx_off_t;
|
|||||||
|
|
||||||
// for no-op debug output
|
// for no-op debug output
|
||||||
inline void NO_printf(const char *, ...) noexcept attribute_format(1, 2);
|
inline void NO_printf(const char *, ...) noexcept attribute_format(1, 2);
|
||||||
inline void NO_fprintf(FILE *, const char *, ...) noexcept attribute_format(2, 3);
|
|
||||||
inline void NO_printf(const char *, ...) noexcept {}
|
inline void NO_printf(const char *, ...) noexcept {}
|
||||||
|
inline void NO_fprintf(FILE *, const char *, ...) noexcept attribute_format(2, 3);
|
||||||
inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
|
inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
|
||||||
|
|
||||||
#if __has_builtin(__builtin_memcpy_inline)
|
// upx_memcmp_inline
|
||||||
|
#if __has_builtin(__builtin_memcmp)
|
||||||
|
#define upx_memcmp_inline __builtin_memcmp
|
||||||
|
#elif defined(__clang__) || defined(__GNUC__)
|
||||||
|
#define upx_memcmp_inline __builtin_memcmp
|
||||||
|
#else
|
||||||
|
#define upx_memcmp_inline memcmp
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// upx_memcpy_inline
|
||||||
|
#if __has_builtin(__builtin_memcpy_inline) && 0 // TODO later: clang constexpr limitation?
|
||||||
#define upx_memcpy_inline __builtin_memcpy_inline
|
#define upx_memcpy_inline __builtin_memcpy_inline
|
||||||
#elif __has_builtin(__builtin_memcpy)
|
#elif __has_builtin(__builtin_memcpy)
|
||||||
#define upx_memcpy_inline __builtin_memcpy
|
#define upx_memcpy_inline __builtin_memcpy
|
||||||
@@ -360,6 +397,7 @@ inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
|
|||||||
#define upx_memcpy_inline memcpy
|
#define upx_memcpy_inline memcpy
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// upx_return_address()
|
||||||
#if defined(__wasi__)
|
#if defined(__wasi__)
|
||||||
#define upx_return_address() nullptr
|
#define upx_return_address() nullptr
|
||||||
#elif __has_builtin(__builtin_return_address)
|
#elif __has_builtin(__builtin_return_address)
|
||||||
@@ -400,39 +438,6 @@ inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
|
|||||||
|
|
||||||
#define TABLESIZE(table) ((sizeof(table) / sizeof((table)[0])))
|
#define TABLESIZE(table) ((sizeof(table) / sizeof((table)[0])))
|
||||||
|
|
||||||
// TODO later: move these to upx namespace in util/cxxlib.h; also see bele.h
|
|
||||||
template <class T>
|
|
||||||
inline T ALIGN_DOWN(const T &a, const T &b) {
|
|
||||||
T r;
|
|
||||||
r = (a / b) * b;
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
template <class T>
|
|
||||||
inline T ALIGN_UP(const T &a, const T &b) {
|
|
||||||
T r;
|
|
||||||
r = ((a + b - 1) / b) * b;
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
template <class T>
|
|
||||||
inline T ALIGN_GAP(const T &a, const T &b) {
|
|
||||||
T r;
|
|
||||||
r = ALIGN_UP(a, b) - a;
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline const T &UPX_MAX(const T &a, const T &b) {
|
|
||||||
if (a < b)
|
|
||||||
return b;
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
template <class T>
|
|
||||||
inline const T &UPX_MIN(const T &a, const T &b) {
|
|
||||||
if (a < b)
|
|
||||||
return a;
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void mem_clear(T *object) noexcept {
|
inline void mem_clear(T *object) noexcept {
|
||||||
static_assert(std::is_class_v<T>); // UPX convention
|
static_assert(std::is_class_v<T>); // UPX convention
|
||||||
@@ -442,6 +447,7 @@ inline void mem_clear(T *object) noexcept {
|
|||||||
static_assert(size >= 1 && size <= UPX_RSIZE_MAX_MEM);
|
static_assert(size >= 1 && size <= UPX_RSIZE_MAX_MEM);
|
||||||
memset((void *) object, 0, size);
|
memset((void *) object, 0, size);
|
||||||
}
|
}
|
||||||
|
// disable some overloads
|
||||||
#if defined(__clang__) || __GNUC__ != 7
|
#if defined(__clang__) || __GNUC__ != 7
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void mem_clear(T (&array)[]) noexcept DELETED_FUNCTION;
|
inline void mem_clear(T (&array)[]) noexcept DELETED_FUNCTION;
|
||||||
@@ -463,7 +469,7 @@ noreturn void throwAssertFailed(const char *expr, const char *file, int line, co
|
|||||||
#if defined(__clang__) || defined(__GNUC__)
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
#undef assert
|
#undef assert
|
||||||
#if DEBUG || 0
|
#if DEBUG || 0
|
||||||
// generate a warning if assert() is used inside a "noexcept" context
|
// trigger a warning if assert() is used inside a "noexcept" context
|
||||||
#define assert(e) \
|
#define assert(e) \
|
||||||
((void) (__acc_cte(e) || (assertFailed(#e, __FILE__, __LINE__, __func__), throw 1, 0)))
|
((void) (__acc_cte(e) || (assertFailed(#e, __FILE__, __LINE__, __func__), throw 1, 0)))
|
||||||
#else
|
#else
|
||||||
@@ -479,11 +485,13 @@ noreturn void throwAssertFailed(const char *expr, const char *file, int line, co
|
|||||||
|
|
||||||
// C++ support library
|
// C++ support library
|
||||||
#include "util/cxxlib.h"
|
#include "util/cxxlib.h"
|
||||||
using upx::is_same_any_v;
|
|
||||||
using upx::noncopyable;
|
|
||||||
using upx::OptVar;
|
|
||||||
using upx::tribool;
|
using upx::tribool;
|
||||||
#define usizeof(expr) (upx::UnsignedSizeOf<sizeof(expr)>::value)
|
#define usizeof(expr) (upx::UnsignedSizeOf<sizeof(expr)>::value)
|
||||||
|
#define ALIGN_DOWN(a, b) (upx::align_down((a), (b)))
|
||||||
|
#define ALIGN_UP(a, b) (upx::align_up((a), (b)))
|
||||||
|
#define ALIGN_UP_GAP(a, b) (upx::align_up_gap((a), (b)))
|
||||||
|
#define UPX_MAX(a, b) (upx::max((a), (b)))
|
||||||
|
#define UPX_MIN(a, b) (upx::min((a), (b)))
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// constants
|
// constants
|
||||||
@@ -594,7 +602,7 @@ using upx::tribool;
|
|||||||
// #define M_CL1B_8 12
|
// #define M_CL1B_8 12
|
||||||
// #define M_CL1B_LE16 13
|
// #define M_CL1B_LE16 13
|
||||||
#define M_LZMA 14
|
#define M_LZMA 14
|
||||||
#define M_DEFLATE 15 // zlib
|
#define M_DEFLATE 15 // NOT YET USED
|
||||||
#define M_ZSTD 16 // NOT YET USED
|
#define M_ZSTD 16 // NOT YET USED
|
||||||
#define M_BZIP2 17 // NOT YET USED
|
#define M_BZIP2 17 // NOT YET USED
|
||||||
// compression methods internal usage
|
// compression methods internal usage
|
||||||
@@ -625,7 +633,9 @@ using upx::tribool;
|
|||||||
|
|
||||||
#define WITH_LZMA 1
|
#define WITH_LZMA 1
|
||||||
#define WITH_UCL 1
|
#define WITH_UCL 1
|
||||||
|
#ifndef WITH_ZLIB
|
||||||
#define WITH_ZLIB 1
|
#define WITH_ZLIB 1
|
||||||
|
#endif
|
||||||
#if (WITH_UCL)
|
#if (WITH_UCL)
|
||||||
#define ucl_compress_config_t REAL_ucl_compress_config_t
|
#define ucl_compress_config_t REAL_ucl_compress_config_t
|
||||||
#include <ucl/include/ucl/uclconf.h>
|
#include <ucl/include/ucl/uclconf.h>
|
||||||
@@ -655,11 +665,11 @@ struct bzip2_compress_config_t final {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct lzma_compress_config_t final {
|
struct lzma_compress_config_t final {
|
||||||
typedef OptVar<unsigned, 2u, 0u, 4u> pos_bits_t; // pb
|
typedef upx::OptVar<unsigned, 2u, 0u, 4u> pos_bits_t; // pb
|
||||||
typedef OptVar<unsigned, 0u, 0u, 4u> lit_pos_bits_t; // lp
|
typedef upx::OptVar<unsigned, 0u, 0u, 4u> lit_pos_bits_t; // lp
|
||||||
typedef OptVar<unsigned, 3u, 0u, 8u> lit_context_bits_t; // lc
|
typedef upx::OptVar<unsigned, 3u, 0u, 8u> lit_context_bits_t; // lc
|
||||||
typedef OptVar<unsigned, (1u << 22), 1u, (1u << 30)> dict_size_t;
|
typedef upx::OptVar<unsigned, (1u << 22), 1u, (1u << 30)> dict_size_t;
|
||||||
typedef OptVar<unsigned, 64u, 5u, 273u> num_fast_bytes_t;
|
typedef upx::OptVar<unsigned, 64u, 5u, 273u> num_fast_bytes_t;
|
||||||
|
|
||||||
pos_bits_t pos_bits; // pb
|
pos_bits_t pos_bits; // pb
|
||||||
lit_pos_bits_t lit_pos_bits; // lp
|
lit_pos_bits_t lit_pos_bits; // lp
|
||||||
@@ -679,9 +689,9 @@ struct ucl_compress_config_t final : public REAL_ucl_compress_config_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct zlib_compress_config_t final {
|
struct zlib_compress_config_t final {
|
||||||
typedef OptVar<unsigned, 8u, 1u, 9u> mem_level_t; // ml
|
typedef upx::OptVar<unsigned, 8u, 1u, 9u> mem_level_t; // ml
|
||||||
typedef OptVar<unsigned, 15u, 9u, 15u> window_bits_t; // wb
|
typedef upx::OptVar<unsigned, 15u, 9u, 15u> window_bits_t; // wb
|
||||||
typedef OptVar<unsigned, 0u, 0u, 4u> strategy_t; // st
|
typedef upx::OptVar<unsigned, 0u, 0u, 4u> strategy_t; // st
|
||||||
|
|
||||||
mem_level_t mem_level; // ml
|
mem_level_t mem_level; // ml
|
||||||
window_bits_t window_bits; // wb
|
window_bits_t window_bits; // wb
|
||||||
@@ -712,7 +722,7 @@ struct upx_compress_config_t final {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NULL_cconf ((upx_compress_config_t *) nullptr)
|
#define NULL_cconf ((const upx_compress_config_t *) nullptr)
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// compression - result_t
|
// compression - result_t
|
||||||
@@ -786,25 +796,26 @@ struct upx_compress_result_t final {
|
|||||||
|
|
||||||
// classes
|
// classes
|
||||||
class ElfLinker;
|
class ElfLinker;
|
||||||
typedef ElfLinker Linker;
|
typedef ElfLinker Linker; // shortcut
|
||||||
class Throwable;
|
class Throwable;
|
||||||
|
|
||||||
|
// check/dt_check.cpp
|
||||||
|
noinline void upx_compiler_sanity_check() noexcept;
|
||||||
|
noinline int upx_doctest_check(int argc, char **argv);
|
||||||
|
int upx_doctest_check();
|
||||||
|
|
||||||
// util/membuffer.h
|
// util/membuffer.h
|
||||||
class MemBuffer;
|
class MemBuffer;
|
||||||
void *membuffer_get_void_ptr(MemBuffer &mb) noexcept;
|
void *membuffer_get_void_ptr(MemBuffer &mb) noexcept;
|
||||||
unsigned membuffer_get_size(MemBuffer &mb) noexcept;
|
const void *membuffer_get_void_ptr(const MemBuffer &mb) noexcept;
|
||||||
|
unsigned membuffer_get_size_in_bytes(const MemBuffer &mb) noexcept;
|
||||||
// util/dt_check.cpp
|
|
||||||
noinline void upx_compiler_sanity_check() noexcept;
|
|
||||||
noinline int upx_doctest_check(int argc, char **argv);
|
|
||||||
int upx_doctest_check();
|
|
||||||
|
|
||||||
// main.cpp
|
// main.cpp
|
||||||
extern const char *progname;
|
extern const char *progname;
|
||||||
bool main_set_exit_code(int ec);
|
bool main_set_exit_code(int ec);
|
||||||
int main_get_options(int argc, char **argv);
|
int main_get_options(int argc, char **argv);
|
||||||
void main_get_envoptions();
|
void main_get_envoptions();
|
||||||
int upx_main(int argc, char *argv[]) may_throw;
|
noinline int upx_main(int argc, char *argv[]) may_throw;
|
||||||
|
|
||||||
// msg.cpp
|
// msg.cpp
|
||||||
void printSetNl(int need_nl) noexcept;
|
void printSetNl(int need_nl) noexcept;
|
||||||
@@ -821,13 +832,13 @@ void infoHeader();
|
|||||||
void infoWriting(const char *what, upx_int64_t size);
|
void infoWriting(const char *what, upx_int64_t size);
|
||||||
|
|
||||||
// work.cpp
|
// work.cpp
|
||||||
void do_one_file(const char *iname, char *oname) may_throw;
|
noinline void do_one_file(const char *iname, char *oname) may_throw;
|
||||||
int do_files(int i, int argc, char *argv[]) may_throw;
|
noinline int do_files(int i, int argc, char *argv[]) may_throw;
|
||||||
|
|
||||||
// help.cpp
|
// help.cpp
|
||||||
extern const char gitrev[];
|
extern const char gitrev[];
|
||||||
void show_header();
|
void show_header();
|
||||||
void show_help(int verbose = 0);
|
void show_help(int verbose);
|
||||||
void show_license();
|
void show_license();
|
||||||
void show_sysinfo(const char *options_var);
|
void show_sysinfo(const char *options_var);
|
||||||
void show_usage();
|
void show_usage();
|
||||||
@@ -865,5 +876,7 @@ int upx_test_overlap ( const upx_bytep buf,
|
|||||||
// xspan
|
// xspan
|
||||||
#include "util/raw_bytes.h"
|
#include "util/raw_bytes.h"
|
||||||
#include "util/xspan.h"
|
#include "util/xspan.h"
|
||||||
|
//
|
||||||
|
#include "util/system_check_predefs.h"
|
||||||
|
|
||||||
/* vim:set ts=4 sw=4 et: */
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+8
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -152,7 +152,7 @@ void throwCantPack(const char *format, ...) {
|
|||||||
char msg[1024];
|
char msg[1024];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
(void) upx_safe_vsnprintf_noexcept(msg, sizeof(msg), format, ap);
|
upx_safe_vsnprintf_noexcept(msg, sizeof(msg), format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
throwCantPack(msg);
|
throwCantPack(msg);
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ void throwCantUnpack(const char *format, ...) {
|
|||||||
char msg[1024];
|
char msg[1024];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
(void) upx_safe_vsnprintf_noexcept(msg, sizeof(msg), format, ap);
|
upx_safe_vsnprintf_noexcept(msg, sizeof(msg), format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
throwCantUnpack(msg);
|
throwCantUnpack(msg);
|
||||||
}
|
}
|
||||||
@@ -172,9 +172,9 @@ void throwInternalError(const char *format, ...) {
|
|||||||
char msg[1024];
|
char msg[1024];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
(void) upx_safe_vsnprintf_noexcept(msg, sizeof(msg), format, ap);
|
upx_safe_vsnprintf_noexcept(msg, sizeof(msg), format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
throwCantUnpack(msg);
|
throwInternalError(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -195,7 +195,7 @@ void throwAssertFailed(const char *expr, const char *file, int line, const char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *prettyName(const char *n) noexcept {
|
const char *prettyExceptionName(const char *n) noexcept {
|
||||||
if (n == nullptr)
|
if (n == nullptr)
|
||||||
return "(null)";
|
return "(null)";
|
||||||
while (*n) {
|
while (*n) {
|
||||||
@@ -203,7 +203,7 @@ const char *prettyName(const char *n) noexcept {
|
|||||||
n++;
|
n++;
|
||||||
else if (*n == ' ')
|
else if (*n == ' ')
|
||||||
n++;
|
n++;
|
||||||
else if (strncmp(n, "class ", 6) == 0) // Visual C++ (msvc)
|
else if (strncmp(n, "class ", 6) == 0) // Visual C++ (MSVC)
|
||||||
n += 6;
|
n += 6;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|||||||
+8
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -133,7 +133,7 @@ public:
|
|||||||
CantPackException(const char *m = nullptr, bool w = false) noexcept : super(m, 0, w) {}
|
CantPackException(const char *m = nullptr, bool w = false) noexcept : super(m, 0, w) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class UnknownExecutableFormatException : public CantPackException {
|
class UnknownExecutableFormatException final : public CantPackException {
|
||||||
typedef CantPackException super;
|
typedef CantPackException super;
|
||||||
public:
|
public:
|
||||||
UnknownExecutableFormatException(const char *m = nullptr, bool w = false) noexcept
|
UnknownExecutableFormatException(const char *m = nullptr, bool w = false) noexcept
|
||||||
@@ -178,7 +178,7 @@ public:
|
|||||||
// util
|
// util
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
const char *prettyName(const char *n) noexcept;
|
const char *prettyExceptionName(const char *n) noexcept;
|
||||||
|
|
||||||
noreturn void throwCantPack(const char *msg) may_throw;
|
noreturn void throwCantPack(const char *msg) may_throw;
|
||||||
noreturn void throwCantPackExact() may_throw;
|
noreturn void throwCantPackExact() may_throw;
|
||||||
@@ -200,15 +200,15 @@ noreturn void throwEOFException(const char *msg = nullptr, int e = 0) may_throw;
|
|||||||
// some C++ template wizardry is needed to overload throwCantPack() for varargs
|
// some C++ template wizardry is needed to overload throwCantPack() for varargs
|
||||||
template <class T>
|
template <class T>
|
||||||
void throwCantPack(const T *, ...) DELETED_FUNCTION;
|
void throwCantPack(const T *, ...) DELETED_FUNCTION;
|
||||||
template <>
|
|
||||||
noreturn void throwCantPack(const char *format, ...) may_throw attribute_format(1, 2);
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void throwCantUnpack(const T *, ...) DELETED_FUNCTION;
|
void throwCantUnpack(const T *, ...) DELETED_FUNCTION;
|
||||||
template <>
|
|
||||||
noreturn void throwCantUnpack(const char *format, ...) may_throw attribute_format(1, 2);
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void throwInternalError(const T *, ...) DELETED_FUNCTION;
|
void throwInternalError(const T *, ...) DELETED_FUNCTION;
|
||||||
template <>
|
template <>
|
||||||
|
noreturn void throwCantPack(const char *format, ...) may_throw attribute_format(1, 2);
|
||||||
|
template <>
|
||||||
|
noreturn void throwCantUnpack(const char *format, ...) may_throw attribute_format(1, 2);
|
||||||
|
template <>
|
||||||
noreturn void throwInternalError(const char *format, ...) may_throw attribute_format(1, 2);
|
noreturn void throwInternalError(const char *format, ...) may_throw attribute_format(1, 2);
|
||||||
|
|
||||||
/* vim:set ts=4 sw=4 et: */
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|||||||
+30
-13
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
#else
|
#else
|
||||||
UNUSED(name);
|
UNUSED(name);
|
||||||
UNUSED(mode);
|
UNUSED(mode);
|
||||||
|
// no error
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ bool FileBase::do_sopen() {
|
|||||||
else {
|
else {
|
||||||
#if (ACC_OS_DOS32) && defined(__DJGPP__)
|
#if (ACC_OS_DOS32) && defined(__DJGPP__)
|
||||||
_fd = ::open(_name, _flags | _shflags, _mode);
|
_fd = ::open(_name, _flags | _shflags, _mode);
|
||||||
#elif defined(__MINT__)
|
#elif (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
|
||||||
_fd = ::open(_name, _flags | (_shflags & O_SHMODE), _mode);
|
_fd = ::open(_name, _flags | (_shflags & O_SHMODE), _mode);
|
||||||
#elif defined(SH_DENYRW)
|
#elif defined(SH_DENYRW)
|
||||||
_fd = ::sopen(_name, _flags, _shflags, _mode);
|
_fd = ::sopen(_name, _flags, _shflags, _mode);
|
||||||
@@ -98,6 +99,7 @@ bool FileBase::do_sopen() {
|
|||||||
}
|
}
|
||||||
if (_fd < 0)
|
if (_fd < 0)
|
||||||
return false;
|
return false;
|
||||||
|
st.st_size = 0;
|
||||||
if (::fstat(_fd, &st) != 0)
|
if (::fstat(_fd, &st) != 0)
|
||||||
throwIOException(_name, errno);
|
throwIOException(_name, errno);
|
||||||
_length = st.st_size;
|
_length = st.st_size;
|
||||||
@@ -127,7 +129,8 @@ void FileBase::closex() may_throw {
|
|||||||
upx_off_t FileBase::seek(upx_off_t off, int whence) {
|
upx_off_t FileBase::seek(upx_off_t off, int whence) {
|
||||||
if (!isOpen())
|
if (!isOpen())
|
||||||
throwIOException("bad seek 1");
|
throwIOException("bad seek 1");
|
||||||
mem_size_assert(1, off >= 0 ? off : -off); // sanity check
|
if (!mem_size_valid_bytes(off >= 0 ? off : -off)) // sanity check
|
||||||
|
throwIOException("bad seek");
|
||||||
if (whence == SEEK_SET) {
|
if (whence == SEEK_SET) {
|
||||||
if (off < 0)
|
if (off < 0)
|
||||||
throwIOException("bad seek 2");
|
throwIOException("bad seek 2");
|
||||||
@@ -212,6 +215,20 @@ upx_off_t InputFile::seek(upx_off_t off, int whence) {
|
|||||||
|
|
||||||
upx_off_t InputFile::st_size_orig() const { return _length_orig; }
|
upx_off_t InputFile::st_size_orig() const { return _length_orig; }
|
||||||
|
|
||||||
|
int InputFile::dupFd() may_throw {
|
||||||
|
if (!isOpen())
|
||||||
|
throwIOException("bad dup");
|
||||||
|
#if defined(HAVE_DUP) && (HAVE_DUP + 0 == 0)
|
||||||
|
errno = ENOSYS;
|
||||||
|
int r = -1;
|
||||||
|
#else
|
||||||
|
int r = ::dup(getFd());
|
||||||
|
#endif
|
||||||
|
if (r < 0)
|
||||||
|
throwIOException("dup", errno);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// OutputFile
|
// OutputFile
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -302,26 +319,25 @@ void OutputFile::rewrite(SPAN_P(const void) buf, int len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
upx_off_t OutputFile::seek(upx_off_t off, int whence) {
|
upx_off_t OutputFile::seek(upx_off_t off, int whence) {
|
||||||
mem_size_assert(1, off >= 0 ? off : -off); // sanity check
|
if (!mem_size_valid_bytes(off >= 0 ? off : -off)) // sanity check
|
||||||
|
throwIOException("bad seek");
|
||||||
assert(!opt->to_stdout);
|
assert(!opt->to_stdout);
|
||||||
switch (whence) {
|
switch (whence) {
|
||||||
case SEEK_SET: {
|
case SEEK_SET:
|
||||||
if (bytes_written < off) {
|
if (bytes_written < off)
|
||||||
bytes_written = off;
|
bytes_written = off;
|
||||||
}
|
|
||||||
_length = bytes_written; // cheap, lazy update; needed?
|
_length = bytes_written; // cheap, lazy update; needed?
|
||||||
} break;
|
break;
|
||||||
case SEEK_END: {
|
case SEEK_END:
|
||||||
_length = bytes_written; // necessary
|
_length = bytes_written; // necessary
|
||||||
} break;
|
break;
|
||||||
}
|
}
|
||||||
return super::seek(off, whence);
|
return super::seek(off, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
// WARNING: fsync() does not exist in some Windows environments.
|
// WARNING: fsync() does not exist in some Windows environments.
|
||||||
// This trick works only on UNIX-like systems.
|
// This trick works only on UNIX-like systems.
|
||||||
// int OutputFile::read(void *buf, int len)
|
// int OutputFile::read(void *buf, int len) {
|
||||||
//{
|
|
||||||
// fsync(_fd);
|
// fsync(_fd);
|
||||||
// InputFile infile;
|
// InputFile infile;
|
||||||
// infile.open(this->getName(), O_RDONLY | O_BINARY);
|
// infile.open(this->getName(), O_RDONLY | O_BINARY);
|
||||||
@@ -333,6 +349,7 @@ void OutputFile::set_extent(upx_off_t offset, upx_off_t length) {
|
|||||||
super::set_extent(offset, length);
|
super::set_extent(offset, length);
|
||||||
bytes_written = 0;
|
bytes_written = 0;
|
||||||
if (0 == offset && 0xffffffffLL == length) { // TODO: check all callers of this method
|
if (0 == offset && 0xffffffffLL == length) { // TODO: check all callers of this method
|
||||||
|
st.st_size = 0;
|
||||||
if (::fstat(_fd, &st) != 0)
|
if (::fstat(_fd, &st) != 0)
|
||||||
throwIOException(_name, errno);
|
throwIOException(_name, errno);
|
||||||
_length = st.st_size - offset;
|
_length = st.st_size - offset;
|
||||||
|
|||||||
+4
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -88,6 +88,8 @@ public:
|
|||||||
virtual upx_off_t seek(upx_off_t off, int whence) override;
|
virtual upx_off_t seek(upx_off_t off, int whence) override;
|
||||||
upx_off_t st_size_orig() const;
|
upx_off_t st_size_orig() const;
|
||||||
|
|
||||||
|
noinline int dupFd() may_throw;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
upx_off_t _length_orig = 0;
|
upx_off_t _length_orig = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+6
-6
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -355,6 +355,7 @@ static int s_ct24arm_be(Filter *f) {
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if 1 //{ old reliable
|
#if 1 //{ old reliable
|
||||||
|
|
||||||
#define CT26ARM_LE(f, cond, addvalue, get, set) \
|
#define CT26ARM_LE(f, cond, addvalue, get, set) \
|
||||||
byte *b = f->buf; \
|
byte *b = f->buf; \
|
||||||
byte *b_end = b + f->buf_len - 4; \
|
byte *b_end = b + f->buf_len - 4; \
|
||||||
@@ -387,10 +388,9 @@ static int s_ct26arm_le(Filter *f) {
|
|||||||
|
|
||||||
#else //}{ new enhanced but DIFFERENT; need new filter type!
|
#else //}{ new enhanced but DIFFERENT; need new filter type!
|
||||||
|
|
||||||
static int CTarm64(Filter *f, int dir) // dir: 1, 0, -1
|
static int CTarm64(Filter *f, int dir) { // dir: 1, 0, -1
|
||||||
{
|
byte *b = f->buf; // will be incremented
|
||||||
upx_byte *b = f->buf; // will be incremented
|
byte *const b_end = b + f->buf_len - 4;
|
||||||
upx_byte *const b_end = b + f->buf_len - 4;
|
|
||||||
do {
|
do {
|
||||||
unsigned const a = b - f->buf;
|
unsigned const a = b - f->buf;
|
||||||
int const d = dir * (f->addvalue + (a >> 2));
|
int const d = dir * (f->addvalue + (a >> 2));
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+3
-3
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
Copyright (C) 2000-2024 John F. Reiser
|
Copyright (C) 2000-2025 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+3
-3
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
Copyright (C) 2000-2024 John F. Reiser
|
Copyright (C) 2000-2025 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+3
-3
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
Copyright (C) 2000-2024 John F. Reiser
|
Copyright (C) 2000-2025 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -28,8 +28,6 @@
|
|||||||
#include "../conf.h"
|
#include "../conf.h"
|
||||||
#include "../filter.h"
|
#include "../filter.h"
|
||||||
|
|
||||||
static unsigned umin(const unsigned a, const unsigned b) { return (a <= b) ? a : b; }
|
|
||||||
|
|
||||||
#define set_dummy(p, v) ((void) 0)
|
#define set_dummy(p, v) ((void) 0)
|
||||||
#define get_8(p) (*(p))
|
#define get_8(p) (*(p))
|
||||||
#define set_8(p, v) (*(p) = (v))
|
#define set_8(p, v) (*(p) = (v))
|
||||||
@@ -206,7 +204,8 @@ static unsigned umin(const unsigned a, const unsigned b) { return (a <= b) ? a :
|
|||||||
{ 0x36, 6, 0x00ffffff, f_ctoj32_e8e9_bswap_le, u_ctoj32_e8e9_bswap_le, s_ctoj32_e8e9_bswap_le },
|
{ 0x36, 6, 0x00ffffff, f_ctoj32_e8e9_bswap_le, u_ctoj32_e8e9_bswap_le, s_ctoj32_e8e9_bswap_le },
|
||||||
|
|
||||||
// 32-bit calltrick with jmp, optional jcc; runtime can unfilter more than one block
|
// 32-bit calltrick with jmp, optional jcc; runtime can unfilter more than one block
|
||||||
{ 0x46, 6, 0x00ffffff, f_ctok32_e8e9_bswap_le, u_ctok32_e8e9_bswap_le, s_ctok32_e8e9_bswap_le },
|
// Note 0x46 uses 'ctoj', while 0x49 uses 'ctok'.
|
||||||
|
{ 0x46, 6, 0x00ffffff, f_ctoj32_e8e9_bswap_le, u_ctoj32_e8e9_bswap_le, s_ctoj32_e8e9_bswap_le },
|
||||||
{ 0x49, 6, 0x00ffffff, f_ctok32_e8e9_bswap_le, u_ctok32_e8e9_bswap_le, s_ctok32_e8e9_bswap_le },
|
{ 0x49, 6, 0x00ffffff, f_ctok32_e8e9_bswap_le, u_ctok32_e8e9_bswap_le, s_ctok32_e8e9_bswap_le },
|
||||||
|
|
||||||
// 24-bit calltrick for arm
|
// 24-bit calltrick for arm
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+5
-5
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
Copyright (C) 2004-2024 John F. Reiser
|
Copyright (C) 2004-2025 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -44,7 +44,7 @@ static int F(Filter *f) {
|
|||||||
// scan
|
// scan
|
||||||
const byte *b = f->buf;
|
const byte *b = f->buf;
|
||||||
#endif
|
#endif
|
||||||
const unsigned size = umin(f->buf_len, 0u - (~0u << (32 - (6 + W_CTO))));
|
const unsigned size = upx::umin(f->buf_len, 0u - (~0u << (32 - (6 + W_CTO))));
|
||||||
const unsigned size4 = size - 4;
|
const unsigned size4 = size - 4;
|
||||||
|
|
||||||
unsigned ic;
|
unsigned ic;
|
||||||
@@ -123,7 +123,7 @@ static int F(Filter *f) {
|
|||||||
#ifdef U
|
#ifdef U
|
||||||
static int U(Filter *f) {
|
static int U(Filter *f) {
|
||||||
byte *b = f->buf;
|
byte *b = f->buf;
|
||||||
const unsigned size4 = umin(f->buf_len - 4, 0u - (~0u << (32 - (6 + W_CTO))));
|
const unsigned size4 = upx::umin(f->buf_len - 4, 0u - (~0u << (32 - (6 + W_CTO))));
|
||||||
const unsigned addvalue = f->addvalue;
|
const unsigned addvalue = f->addvalue;
|
||||||
|
|
||||||
unsigned ic;
|
unsigned ic;
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+141
-34
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -25,10 +25,16 @@
|
|||||||
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(_WIN32_WINNT)
|
||||||
|
static constexpr long long initial_win32_winnt = _WIN32_WINNT + 0LL;
|
||||||
|
#else
|
||||||
|
static constexpr long long initial_win32_winnt = 0;
|
||||||
|
#endif
|
||||||
#define WANT_WINDOWS_LEAN_H 1 // _WIN32_WINNT
|
#define WANT_WINDOWS_LEAN_H 1 // _WIN32_WINNT
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "compress/compress.h" // upx_ucl_version_string()
|
#include "compress/compress.h" // upx_ucl_version_string()
|
||||||
// for list_all_packers():
|
// for list_all_packers():
|
||||||
|
#include "filter.h" // Filter::isValidFilter
|
||||||
#include "packer.h"
|
#include "packer.h"
|
||||||
#include "packmast.h" // PackMaster::visitAllPackers
|
#include "packmast.h" // PackMaster::visitAllPackers
|
||||||
|
|
||||||
@@ -43,7 +49,7 @@ const char gitrev[] = UPX_VERSION_GITREV;
|
|||||||
const char gitrev[1] = {0};
|
const char gitrev[1] = {0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void show_header(void) {
|
void show_header() {
|
||||||
FILE *f = con_term;
|
FILE *f = con_term;
|
||||||
int fg;
|
int fg;
|
||||||
|
|
||||||
@@ -79,7 +85,7 @@ void show_header(void) {
|
|||||||
// usage
|
// usage
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void show_usage(void) {
|
void show_usage() {
|
||||||
FILE *f = con_term;
|
FILE *f = con_term;
|
||||||
|
|
||||||
con_fprintf(f, "Usage: %s [-123456789dlthVL] [-qvfk] [-o file] %sfile..\n", progname,
|
con_fprintf(f, "Usage: %s [-123456789dlthVL] [-qvfk] [-o file] %sfile..\n", progname,
|
||||||
@@ -95,49 +101,86 @@ void show_usage(void) {
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct PackerNames {
|
struct PackerNames final {
|
||||||
PackerNames() noexcept = default;
|
explicit PackerNames() noexcept = default;
|
||||||
~PackerNames() noexcept = default;
|
~PackerNames() noexcept = default;
|
||||||
|
|
||||||
|
static constexpr unsigned MAX_NAMES = 64; // arbitrary limit, increase as needed
|
||||||
struct Entry {
|
struct Entry {
|
||||||
const char *fname;
|
const char *fname;
|
||||||
const char *sname;
|
const char *sname;
|
||||||
|
unsigned methods_count;
|
||||||
|
unsigned filters_count;
|
||||||
|
unsigned methods[PackerBase::MAX_METHODS];
|
||||||
|
unsigned filters[PackerBase::MAX_FILTERS];
|
||||||
};
|
};
|
||||||
static constexpr size_t MAX_NAMES = 64;
|
Entry names_array[MAX_NAMES];
|
||||||
Entry names[MAX_NAMES];
|
Entry *names[MAX_NAMES];
|
||||||
size_t names_count = 0;
|
unsigned names_count = 0;
|
||||||
const Options *o = nullptr;
|
const Options *o = nullptr;
|
||||||
|
|
||||||
void add(const PackerBase *pb) {
|
void add(const PackerBase *pb) {
|
||||||
assert_noexcept(names_count < MAX_NAMES);
|
assert_noexcept(names_count < MAX_NAMES);
|
||||||
names[names_count].fname = pb->getFullName(o);
|
Entry &e = names_array[names_count];
|
||||||
names[names_count].sname = pb->getName();
|
names[names_count++] = &e;
|
||||||
names_count++;
|
e.fname = pb->getFullName(o);
|
||||||
|
e.sname = pb->getName();
|
||||||
|
e.methods_count = e.filters_count = 0;
|
||||||
|
for (const int *m = pb->getCompressionMethods(M_ALL, 10); *m != M_END; m++) {
|
||||||
|
if (*m >= 0) {
|
||||||
|
assert_noexcept(Packer::isValidCompressionMethod(*m));
|
||||||
|
assert_noexcept(e.methods_count < PackerBase::MAX_METHODS);
|
||||||
|
e.methods[e.methods_count++] = *m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const int *f = pb->getFilters(); f != nullptr && *f != FT_END; f++) {
|
||||||
|
if (*f >= 0) {
|
||||||
|
assert_noexcept(Filter::isValidFilter(*f));
|
||||||
|
assert_noexcept(e.filters_count < PackerBase::MAX_FILTERS);
|
||||||
|
e.filters[e.filters_count++] = *f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upx_gnomesort(e.methods, e.methods_count, sizeof(e.methods[0]), ne32_compare);
|
||||||
|
upx_gnomesort(e.filters, e.filters_count, sizeof(e.filters[0]), ne32_compare);
|
||||||
}
|
}
|
||||||
static tribool visit(PackerBase *pb, void *user) {
|
static tribool visit(PackerBase *pb, void *user) {
|
||||||
|
NO_fprintf(stderr, "visit %s\n", pb->getFullName(nullptr));
|
||||||
PackerNames *self = (PackerNames *) user;
|
PackerNames *self = (PackerNames *) user;
|
||||||
self->add(pb);
|
self->add(pb);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
static int __acc_cdecl_qsort cmp_fname(const void *a, const void *b) {
|
static int __acc_cdecl_qsort compare_fname(const void *aa, const void *bb) {
|
||||||
return strcmp(((const Entry *) a)->fname, ((const Entry *) b)->fname);
|
const Entry *a = *(const Entry *const *) aa;
|
||||||
}
|
const Entry *b = *(const Entry *const *) bb;
|
||||||
static int __acc_cdecl_qsort cmp_sname(const void *a, const void *b) {
|
return strcmp(a->fname, b->fname);
|
||||||
return strcmp(((const Entry *) a)->sname, ((const Entry *) b)->sname);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
static void list_all_packers(FILE *f, int verbose) {
|
static noinline void list_all_packers(FILE *f, int verbose) {
|
||||||
Options o;
|
Options o;
|
||||||
o.reset();
|
o.reset();
|
||||||
PackerNames pn;
|
PackerNames pn;
|
||||||
pn.o = &o;
|
pn.o = &o;
|
||||||
(void) PackMaster::visitAllPackers(PackerNames::visit, nullptr, &o, &pn);
|
(void) PackMaster::visitAllPackers(PackerNames::visit, nullptr, &o, &pn);
|
||||||
upx_qsort(pn.names, pn.names_count, sizeof(PackerNames::Entry), PackerNames::cmp_fname);
|
// NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion)
|
||||||
|
upx_gnomesort(pn.names, pn.names_count, sizeof(pn.names[0]), PackerNames::compare_fname);
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
for (size_t i = 0; i < pn.names_count; ++i) {
|
for (size_t i = 0; i < pn.names_count; i++) {
|
||||||
const char *fn = pn.names[i].fname;
|
const PackerNames::Entry &e = *pn.names[i];
|
||||||
const char *sn = pn.names[i].sname;
|
const char *const fn = e.fname;
|
||||||
if (verbose > 0) {
|
const char *const sn = e.sname;
|
||||||
|
if (verbose >= 3) {
|
||||||
|
con_fprintf(f, " %-36s %s\n", fn, sn);
|
||||||
|
con_fprintf(f, " methods:");
|
||||||
|
for (size_t j = 0; j < e.methods_count; j++)
|
||||||
|
con_fprintf(f, " %#x", e.methods[j]);
|
||||||
|
con_fprintf(f, "\n");
|
||||||
|
con_fprintf(f, " filters:");
|
||||||
|
for (size_t j = 0; j < e.filters_count; j++)
|
||||||
|
con_fprintf(f, " %#x", e.filters[j]);
|
||||||
|
con_fprintf(f, "\n");
|
||||||
|
} else if (verbose >= 2) {
|
||||||
con_fprintf(f, " %-36s %s\n", fn, sn);
|
con_fprintf(f, " %-36s %s\n", fn, sn);
|
||||||
} else {
|
} else {
|
||||||
size_t fl = strlen(fn);
|
size_t fl = strlen(fn);
|
||||||
@@ -153,7 +196,7 @@ static void list_all_packers(FILE *f, int verbose) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (verbose <= 0 && pn.names_count)
|
if (verbose < 2 && pn.names_count)
|
||||||
con_fprintf(f, "\n");
|
con_fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,9 +220,12 @@ void show_help(int verbose) {
|
|||||||
"%s"
|
"%s"
|
||||||
" -d decompress -l list compressed file\n"
|
" -d decompress -l list compressed file\n"
|
||||||
" -t test compressed file -V display version number\n"
|
" -t test compressed file -V display version number\n"
|
||||||
|
"%s"
|
||||||
" -h give %s help -L display software license\n%s",
|
" -h give %s help -L display software license\n%s",
|
||||||
verbose == 0 ? "" : " --best compress best (can be slow for big files)\n",
|
verbose == 0 ? "" : " --best compress best (can be slow for big files)\n",
|
||||||
verbose == 0 ? "more" : "this", verbose == 0 ? "" : "\n");
|
verbose == 0 ? "" : " --fileinfo show parameters of already-compressed file\n",
|
||||||
|
verbose == 0 ? "more" : "this",
|
||||||
|
verbose == 0 ? "" : "\n");
|
||||||
|
|
||||||
fg = con_fg(f, FG_YELLOW);
|
fg = con_fg(f, FG_YELLOW);
|
||||||
con_fprintf(f, "Options:\n");
|
con_fprintf(f, "Options:\n");
|
||||||
@@ -296,6 +342,7 @@ void show_help(int verbose) {
|
|||||||
fg = con_fg(f, fg);
|
fg = con_fg(f, fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --preserve-build-id copy .gnu.note.build-id to compressed output\n"
|
" --preserve-build-id copy .gnu.note.build-id to compressed output\n"
|
||||||
|
" --catch-sigsegv debug errors in hardware or de-compressor\n"
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
// clang-format on
|
// clang-format on
|
||||||
@@ -334,7 +381,7 @@ void show_help(int verbose) {
|
|||||||
// license
|
// license
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void show_license(void) {
|
void show_license() {
|
||||||
FILE *f = con_term;
|
FILE *f = con_term;
|
||||||
|
|
||||||
show_header();
|
show_header();
|
||||||
@@ -422,14 +469,15 @@ void show_version(bool one_line) {
|
|||||||
fprintf(f, "doctest C++ testing framework version %s\n", DOCTEST_VERSION_STR);
|
fprintf(f, "doctest C++ testing framework version %s\n", DOCTEST_VERSION_STR);
|
||||||
#endif
|
#endif
|
||||||
// clang-format off
|
// clang-format off
|
||||||
fprintf(f, "Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer\n");
|
fprintf(f, "Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer\n");
|
||||||
fprintf(f, "Copyright (C) 1996-2024 Laszlo Molnar\n");
|
fprintf(f, "Copyright (C) 1996-2025 Laszlo Molnar\n");
|
||||||
fprintf(f, "Copyright (C) 2000-2024 John F. Reiser\n");
|
fprintf(f, "Copyright (C) 2000-2025 John F. Reiser\n");
|
||||||
fprintf(f, "Copyright (C) 2002-2024 Jens Medoch\n");
|
|
||||||
#if (WITH_ZLIB)
|
#if (WITH_ZLIB)
|
||||||
|
// see vendor/zlib/LICENSE
|
||||||
fprintf(f, "Copyright (C) 1995" "-2024 Jean-loup Gailly and Mark Adler\n");
|
fprintf(f, "Copyright (C) 1995" "-2024 Jean-loup Gailly and Mark Adler\n");
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
|
// see vendor/lzma-sdk
|
||||||
fprintf(f, "Copyright (C) 1999" "-2006 Igor Pavlov\n");
|
fprintf(f, "Copyright (C) 1999" "-2006 Igor Pavlov\n");
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_ZSTD)
|
#if (WITH_ZSTD)
|
||||||
@@ -437,13 +485,15 @@ void show_version(bool one_line) {
|
|||||||
fprintf(f, "Copyright (C) 2015" "-2024 Meta Platforms, Inc. and affiliates\n");
|
fprintf(f, "Copyright (C) 2015" "-2024 Meta Platforms, Inc. and affiliates\n");
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_BZIP2)
|
#if (WITH_BZIP2)
|
||||||
fprintf(f, "Copyright (C) 1996" "-2010 Julian Seward\n"); // see <bzlib.h>
|
// see vendor/bzip2/bzlib.h
|
||||||
|
fprintf(f, "Copyright (C) 1996" "-2010 Julian Seward\n");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(DOCTEST_CONFIG_DISABLE)
|
#if !defined(DOCTEST_CONFIG_DISABLE)
|
||||||
|
// see vendor/doctest/LICENSE.txt
|
||||||
fprintf(f, "Copyright (C) 2016" "-2023 Viktor Kirilov\n");
|
fprintf(f, "Copyright (C) 2016" "-2023 Viktor Kirilov\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(f, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname);
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
fprintf(f, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -477,11 +527,16 @@ void show_sysinfo(const char *options_var) {
|
|||||||
con_fprintf(f, fmt, v);
|
con_fprintf(f, fmt, v);
|
||||||
con_fprintf(f, "\n");
|
con_fprintf(f, "\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
// language
|
// language
|
||||||
cf_print("__cplusplus", "%lld", __cplusplus + 0, 3);
|
cf_print("__cplusplus", "%lld", __cplusplus + 0, 3);
|
||||||
#if defined(_MSVC_LANG)
|
#if defined(_MSVC_LANG)
|
||||||
cf_print("_MSVC_LANG", "%lld", _MSVC_LANG + 0, 3);
|
cf_print("_MSVC_LANG", "%lld", _MSVC_LANG + 0, 3);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(upx_is_constant_evaluated)
|
||||||
|
cf_print("upx_is_constant_evaluated", "%lld", 1, 3);
|
||||||
|
#endif
|
||||||
|
|
||||||
// compiler
|
// compiler
|
||||||
#if defined(ACC_CC_CLANG)
|
#if defined(ACC_CC_CLANG)
|
||||||
cf_print("ACC_CC_CLANG", "0x%06llx", ACC_CC_CLANG + 0, 3);
|
cf_print("ACC_CC_CLANG", "0x%06llx", ACC_CC_CLANG + 0, 3);
|
||||||
@@ -519,12 +574,38 @@ void show_sysinfo(const char *options_var) {
|
|||||||
#if defined(_MSC_FULL_VER)
|
#if defined(_MSC_FULL_VER)
|
||||||
cf_print("_MSC_FULL_VER", "%lld", _MSC_FULL_VER + 0);
|
cf_print("_MSC_FULL_VER", "%lld", _MSC_FULL_VER + 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// architecture
|
||||||
|
#if defined(__CHERI__)
|
||||||
|
cf_print("__CHERI__", "%lld", __CHERI__ + 0, 3);
|
||||||
|
#endif
|
||||||
|
#if defined(__CHERI_PURE_CAPABILITY__)
|
||||||
|
cf_print("__CHERI_PURE_CAPABILITY__", "%lld", __CHERI_PURE_CAPABILITY__ + 0, 3);
|
||||||
|
#endif
|
||||||
|
#if defined(__mips_hard_float)
|
||||||
|
cf_print("__mips_hard_float", "%lld", __mips_hard_float + 0);
|
||||||
|
#endif
|
||||||
|
#if defined(__mips_soft_float)
|
||||||
|
cf_print("__mips_soft_float", "%lld", __mips_soft_float + 0);
|
||||||
|
#endif
|
||||||
|
#if defined(__wasm__)
|
||||||
|
cf_print("__wasm__", "%lld", __wasm__ + 0);
|
||||||
|
#endif
|
||||||
|
#if defined(__wasm32__)
|
||||||
|
cf_print("__wasm32__", "%lld", __wasm32__ + 0);
|
||||||
|
#endif
|
||||||
|
#if defined(__wasm64__)
|
||||||
|
cf_print("__wasm64__", "%lld", __wasm64__ + 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
// OS and libc
|
// OS and libc
|
||||||
#if defined(WINVER)
|
#if defined(WINVER)
|
||||||
cf_print("WINVER", "0x%04llx", WINVER + 0);
|
cf_print("WINVER", "0x%04llx", WINVER + 0);
|
||||||
#endif
|
#endif
|
||||||
#if defined(_WIN32_WINNT)
|
#if defined(_WIN32_WINNT)
|
||||||
cf_print("_WIN32_WINNT", "0x%04llx", _WIN32_WINNT + 0);
|
cf_print("_WIN32_WINNT", "0x%04llx", _WIN32_WINNT + 0);
|
||||||
|
if (initial_win32_winnt != 0 && initial_win32_winnt != _WIN32_WINNT + 0)
|
||||||
|
cf_print("INITIAL_WIN32_WINNT", "0x%04llx", initial_win32_winnt);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__MSVCRT_VERSION__)
|
#if defined(__MSVCRT_VERSION__)
|
||||||
cf_print("__MSVCRT_VERSION__", "0x%04llx", __MSVCRT_VERSION__ + 0);
|
cf_print("__MSVCRT_VERSION__", "0x%04llx", __MSVCRT_VERSION__ + 0);
|
||||||
@@ -544,7 +625,30 @@ void show_sysinfo(const char *options_var) {
|
|||||||
#if defined(__GLIBC_MINOR__)
|
#if defined(__GLIBC_MINOR__)
|
||||||
cf_print("__GLIBC_MINOR__", "%lld", __GLIBC_MINOR__ + 0);
|
cf_print("__GLIBC_MINOR__", "%lld", __GLIBC_MINOR__ + 0);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__wasi__)
|
||||||
|
cf_print("__wasi__", "%lld", __wasi__ + 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
// misc compilation options
|
// misc compilation options
|
||||||
|
#if defined(__PIC__)
|
||||||
|
cf_print("__PIC__", "%lld", __PIC__ + 0, 3);
|
||||||
|
#elif defined(__pic__)
|
||||||
|
cf_print("__pic__", "%lld", __pic__ + 0, 3);
|
||||||
|
#endif
|
||||||
|
#if defined(__PIE__)
|
||||||
|
cf_print("__PIE__", "%lld", __PIE__ + 0, 3);
|
||||||
|
#elif defined(__pie__)
|
||||||
|
cf_print("__pie__", "%lld", __pie__ + 0, 3);
|
||||||
|
#endif
|
||||||
|
#if defined(__SIZEOF_INT128__)
|
||||||
|
cf_print("__SIZEOF_INT128__", "%lld", __SIZEOF_INT128__ + 0, 3);
|
||||||
|
#endif
|
||||||
|
#if defined(__SIZEOF_LONG_LONG__) && (__SIZEOF_LONG_LONG__ + 0 > 8)
|
||||||
|
cf_print("__SIZEOF_LONG_LONG__", "%lld", __SIZEOF_LONG_LONG__ + 0, 3);
|
||||||
|
#endif
|
||||||
|
#if defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ + 0 > 8)
|
||||||
|
cf_print("__SIZEOF_POINTER__", "%lld", __SIZEOF_POINTER__ + 0, 3);
|
||||||
|
#endif
|
||||||
#if defined(UPX_CONFIG_DISABLE_WSTRICT)
|
#if defined(UPX_CONFIG_DISABLE_WSTRICT)
|
||||||
cf_print("UPX_CONFIG_DISABLE_WSTRICT", "%lld", UPX_CONFIG_DISABLE_WSTRICT + 0, 3);
|
cf_print("UPX_CONFIG_DISABLE_WSTRICT", "%lld", UPX_CONFIG_DISABLE_WSTRICT + 0, 3);
|
||||||
#endif
|
#endif
|
||||||
@@ -554,11 +658,13 @@ void show_sysinfo(const char *options_var) {
|
|||||||
#if defined(WITH_THREADS)
|
#if defined(WITH_THREADS)
|
||||||
cf_print("WITH_THREADS", "%lld", WITH_THREADS + 0);
|
cf_print("WITH_THREADS", "%lld", WITH_THREADS + 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UNUSED(cf_count);
|
UNUSED(cf_count);
|
||||||
UNUSED(cf_print);
|
UNUSED(cf_print);
|
||||||
|
UNUSED(initial_win32_winnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// run-time
|
// run-time settings
|
||||||
#if defined(HAVE_LOCALTIME) && defined(HAVE_GMTIME)
|
#if defined(HAVE_LOCALTIME) && defined(HAVE_GMTIME)
|
||||||
{
|
{
|
||||||
auto tm2str = [](char *s, size_t size, const struct tm *tmp) noexcept {
|
auto tm2str = [](char *s, size_t size, const struct tm *tmp) noexcept {
|
||||||
@@ -577,8 +683,9 @@ void show_sysinfo(const char *options_var) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// environment
|
||||||
if (options_var && options_var[0]) {
|
if (options_var && options_var[0]) {
|
||||||
const char *e = getenv(options_var);
|
const char *e = upx_getenv(options_var);
|
||||||
con_fprintf(f, "\n");
|
con_fprintf(f, "\n");
|
||||||
if (e && e[0])
|
if (e && e[0])
|
||||||
con_fprintf(f, "Contents of environment variable %s: '%s'\n\n", options_var, e);
|
con_fprintf(f, "Contents of environment variable %s: '%s'\n\n", options_var, e);
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
+3
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -190,8 +190,7 @@ protected:
|
|||||||
unsigned le_offset = 0;
|
unsigned le_offset = 0;
|
||||||
unsigned exe_offset = 0;
|
unsigned exe_offset = 0;
|
||||||
|
|
||||||
le_header_t ih;
|
le_header_t ih = {}, oh = {};
|
||||||
le_header_t oh;
|
|
||||||
|
|
||||||
le_object_table_entry_t *iobject_table = nullptr;
|
le_object_table_entry_t *iobject_table = nullptr;
|
||||||
le_object_table_entry_t *oobject_table = nullptr;
|
le_object_table_entry_t *oobject_table = nullptr;
|
||||||
|
|||||||
+82
-89
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
static unsigned hex(uchar c) { return (c & 0xf) + (c > '9' ? 9 : 0); }
|
static unsigned hex(uchar c) { return (c & 0xf) + (c > '9' ? 9 : 0); }
|
||||||
|
|
||||||
static bool update_capacity(unsigned size, unsigned *capacity) {
|
static bool grow_capacity(unsigned size, unsigned *capacity) {
|
||||||
if (size < *capacity)
|
if (size < *capacity)
|
||||||
return false;
|
return false;
|
||||||
if (*capacity == 0)
|
if (*capacity == 0)
|
||||||
@@ -40,16 +40,22 @@ static bool update_capacity(unsigned size, unsigned *capacity) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void internal_error(const char *format, ...) attribute_format(1, 2);
|
template <class T>
|
||||||
static void internal_error(const char *format, ...) {
|
static T **realloc_array(T **array, size_t capacity) may_throw {
|
||||||
static char buf[1024];
|
assert_noexcept(capacity > 0);
|
||||||
va_list ap;
|
// NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion)
|
||||||
|
void *p = realloc(array, mem_size(sizeof(T *), capacity));
|
||||||
|
assert_noexcept(p != nullptr);
|
||||||
|
return static_cast<T **>(p);
|
||||||
|
}
|
||||||
|
|
||||||
va_start(ap, format);
|
template <class T>
|
||||||
upx_safe_vsnprintf(buf, sizeof(buf), format, ap);
|
static void free_array(T **array, size_t count) noexcept {
|
||||||
va_end(ap);
|
for (size_t i = 0; i < count; i++) {
|
||||||
|
T *item = upx::atomic_exchange(&array[i], (T *) nullptr);
|
||||||
throwInternalError(buf);
|
delete item;
|
||||||
|
}
|
||||||
|
::free(array); // NOLINT(bugprone-multi-level-implicit-pointer-conversion)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -59,19 +65,19 @@ static void internal_error(const char *format, ...) {
|
|||||||
ElfLinker::Section::Section(const char *n, const void *i, unsigned s, unsigned a)
|
ElfLinker::Section::Section(const char *n, const void *i, unsigned s, unsigned a)
|
||||||
: name(nullptr), output(nullptr), size(s), offset(0), p2align(a), next(nullptr) {
|
: name(nullptr), output(nullptr), size(s), offset(0), p2align(a), next(nullptr) {
|
||||||
name = strdup(n);
|
name = strdup(n);
|
||||||
assert(name != nullptr);
|
assert_noexcept(name != nullptr);
|
||||||
input = malloc(s + 1);
|
input = ::malloc(s + 1);
|
||||||
assert(input != nullptr);
|
assert_noexcept(input != nullptr);
|
||||||
if (s != 0) {
|
if (s != 0) {
|
||||||
assert(i != nullptr);
|
assert_noexcept(i != nullptr);
|
||||||
memcpy(input, i, s);
|
memcpy(input, i, s);
|
||||||
}
|
}
|
||||||
((char *) input)[s] = 0;
|
((char *) input)[s] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ElfLinker::Section::~Section() noexcept {
|
ElfLinker::Section::~Section() noexcept {
|
||||||
free(name);
|
::free(name);
|
||||||
free(input);
|
::free(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -81,11 +87,11 @@ ElfLinker::Section::~Section() noexcept {
|
|||||||
ElfLinker::Symbol::Symbol(const char *n, Section *s, upx_uint64_t o)
|
ElfLinker::Symbol::Symbol(const char *n, Section *s, upx_uint64_t o)
|
||||||
: name(nullptr), section(s), offset(o) {
|
: name(nullptr), section(s), offset(o) {
|
||||||
name = strdup(n);
|
name = strdup(n);
|
||||||
assert(name != nullptr);
|
assert_noexcept(name != nullptr);
|
||||||
assert(section != nullptr);
|
assert_noexcept(section != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ElfLinker::Symbol::~Symbol() noexcept { free(name); }
|
ElfLinker::Symbol::~Symbol() noexcept { ::free(name); }
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// Relocation
|
// Relocation
|
||||||
@@ -94,7 +100,7 @@ ElfLinker::Symbol::~Symbol() noexcept { free(name); }
|
|||||||
ElfLinker::Relocation::Relocation(const Section *s, unsigned o, const char *t, const Symbol *v,
|
ElfLinker::Relocation::Relocation(const Section *s, unsigned o, const char *t, const Symbol *v,
|
||||||
upx_uint64_t a)
|
upx_uint64_t a)
|
||||||
: section(s), offset(o), type(t), value(v), add(a) {
|
: section(s), offset(o), type(t), value(v), add(a) {
|
||||||
assert(section != nullptr);
|
assert_noexcept(section != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -106,17 +112,9 @@ ElfLinker::ElfLinker(const N_BELE_RTP::AbstractPolicy *b) noexcept : bele(b) {}
|
|||||||
ElfLinker::~ElfLinker() noexcept {
|
ElfLinker::~ElfLinker() noexcept {
|
||||||
delete[] input;
|
delete[] input;
|
||||||
delete[] output;
|
delete[] output;
|
||||||
|
free_array(sections, nsections);
|
||||||
unsigned ic;
|
free_array(symbols, nsymbols);
|
||||||
for (ic = 0; ic < nsections; ic++)
|
free_array(relocations, nrelocations);
|
||||||
delete sections[ic];
|
|
||||||
free(sections);
|
|
||||||
for (ic = 0; ic < nsymbols; ic++)
|
|
||||||
delete symbols[ic];
|
|
||||||
free(symbols);
|
|
||||||
for (ic = 0; ic < nrelocations; ic++)
|
|
||||||
delete relocations[ic];
|
|
||||||
free(relocations);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElfLinker::init(const void *pdata_v, int plen, unsigned pxtra) {
|
void ElfLinker::init(const void *pdata_v, int plen, unsigned pxtra) {
|
||||||
@@ -156,7 +154,7 @@ void ElfLinker::init(const void *pdata_v, int plen, unsigned pxtra) {
|
|||||||
input[inputlen] = 0; // NUL terminate
|
input[inputlen] = 0; // NUL terminate
|
||||||
|
|
||||||
output_capacity = (inputlen ? (inputlen + pxtra) : 0x4000);
|
output_capacity = (inputlen ? (inputlen + pxtra) : 0x4000);
|
||||||
assert(output_capacity <= (1 << 16)); // LE16 l_info.l_size
|
assert(output_capacity < (1 << 16)); // LE16 l_info.l_size
|
||||||
output = New(byte, output_capacity);
|
output = New(byte, output_capacity);
|
||||||
outputlen = 0;
|
outputlen = 0;
|
||||||
NO_printf("\nElfLinker::init %d @%p\n", output_capacity, output);
|
NO_printf("\nElfLinker::init %d @%p\n", output_capacity, output);
|
||||||
@@ -186,8 +184,9 @@ void ElfLinker::init(const void *pdata_v, int plen, unsigned pxtra) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ElfLinker::preprocessSections(char *start, char const *end) {
|
void ElfLinker::preprocessSections(char *start, char const *end) {
|
||||||
|
assert_noexcept(nsections == 0);
|
||||||
char *nextl;
|
char *nextl;
|
||||||
for (nsections = 0; start < end; start = 1 + nextl) {
|
for (; start < end; start = 1 + nextl) {
|
||||||
nextl = strchr(start, '\n');
|
nextl = strchr(start, '\n');
|
||||||
assert(nextl != nullptr);
|
assert(nextl != nullptr);
|
||||||
*nextl = '\0'; // a record is a line
|
*nextl = '\0'; // a record is a line
|
||||||
@@ -207,8 +206,9 @@ void ElfLinker::preprocessSections(char *start, char const *end) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ElfLinker::preprocessSymbols(char *start, char const *end) {
|
void ElfLinker::preprocessSymbols(char *start, char const *end) {
|
||||||
|
assert_noexcept(nsymbols == 0);
|
||||||
char *nextl;
|
char *nextl;
|
||||||
for (nsymbols = 0; start < end; start = 1 + nextl) {
|
for (; start < end; start = 1 + nextl) {
|
||||||
nextl = strchr(start, '\n');
|
nextl = strchr(start, '\n');
|
||||||
assert(nextl != nullptr);
|
assert(nextl != nullptr);
|
||||||
*nextl = '\0'; // a record is a line
|
*nextl = '\0'; // a record is a line
|
||||||
@@ -227,7 +227,7 @@ void ElfLinker::preprocessSymbols(char *start, char const *end) {
|
|||||||
else if (sscanf(start, "%x%*8c %1023s %*x %1023s", &offset, section, symbol) == 3)
|
else if (sscanf(start, "%x%*8c %1023s %*x %1023s", &offset, section, symbol) == 3)
|
||||||
#else
|
#else
|
||||||
// work around broken scanf() implementations
|
// work around broken scanf() implementations
|
||||||
// http://bugs.winehq.org/show_bug.cgi?id=10401 (fixed in Wine 0.9.58)
|
// https://bugs.winehq.org/show_bug.cgi?id=10401 (fixed in Wine 0.9.58)
|
||||||
else if (sscanf(start, "%x%*c%*c%*c%*c%*c%*c%*c%*c %1023s %*x %1023s", &offset, section,
|
else if (sscanf(start, "%x%*c%*c%*c%*c%*c%*c%*c%*c %1023s %*x %1023s", &offset, section,
|
||||||
symbol) == 3)
|
symbol) == 3)
|
||||||
#endif
|
#endif
|
||||||
@@ -243,9 +243,10 @@ void ElfLinker::preprocessSymbols(char *start, char const *end) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ElfLinker::preprocessRelocations(char *start, char const *end) {
|
void ElfLinker::preprocessRelocations(char *start, char const *end) {
|
||||||
|
assert_noexcept(nrelocations == 0);
|
||||||
Section *section = nullptr;
|
Section *section = nullptr;
|
||||||
char *nextl;
|
char *nextl;
|
||||||
for (nrelocations = 0; start < end; start = 1 + nextl) {
|
for (; start < end; start = 1 + nextl) {
|
||||||
nextl = strchr(start, '\n');
|
nextl = strchr(start, '\n');
|
||||||
assert(nextl != nullptr);
|
assert(nextl != nullptr);
|
||||||
*nextl = '\0'; // a record is a line
|
*nextl = '\0'; // a record is a line
|
||||||
@@ -302,7 +303,7 @@ ElfLinker::Section *ElfLinker::findSection(const char *name, bool fatal) const {
|
|||||||
if (strcmp(sections[ic]->name, name) == 0)
|
if (strcmp(sections[ic]->name, name) == 0)
|
||||||
return sections[ic];
|
return sections[ic];
|
||||||
if (fatal)
|
if (fatal)
|
||||||
internal_error("unknown section %s\n", name);
|
throwInternalError("unknown section %s\n", name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +312,7 @@ ElfLinker::Symbol *ElfLinker::findSymbol(const char *name, bool fatal) const {
|
|||||||
if (strcmp(symbols[ic]->name, name) == 0)
|
if (strcmp(symbols[ic]->name, name) == 0)
|
||||||
return symbols[ic];
|
return symbols[ic];
|
||||||
if (fatal)
|
if (fatal)
|
||||||
internal_error("unknown symbol %s\n", name);
|
throwInternalError("unknown symbol %s\n", name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,14 +321,11 @@ ElfLinker::Section *ElfLinker::addSection(const char *sname, const void *sdata,
|
|||||||
NO_printf("addSection: %s len=%d align=%d\n", sname, slen, p2align);
|
NO_printf("addSection: %s len=%d align=%d\n", sname, slen, p2align);
|
||||||
if (!sdata && (!strcmp("ABS*", sname) || !strcmp("UND*", sname)))
|
if (!sdata && (!strcmp("ABS*", sname) || !strcmp("UND*", sname)))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (update_capacity(nsections, &nsections_capacity))
|
assert(sname && sname[0]);
|
||||||
sections =
|
|
||||||
static_cast<Section **>(realloc(sections, nsections_capacity * sizeof(Section *)));
|
|
||||||
assert(sections);
|
|
||||||
assert(sname);
|
|
||||||
assert(sname[0]);
|
|
||||||
assert(sname[strlen(sname) - 1] != ':');
|
assert(sname[strlen(sname) - 1] != ':');
|
||||||
assert(findSection(sname, false) == nullptr);
|
assert(findSection(sname, false) == nullptr);
|
||||||
|
if (grow_capacity(nsections, &nsections_capacity))
|
||||||
|
sections = realloc_array(sections, nsections_capacity);
|
||||||
Section *sec = new Section(sname, sdata, slen, p2align);
|
Section *sec = new Section(sname, sdata, slen, p2align);
|
||||||
sec->sort_id = nsections;
|
sec->sort_id = nsections;
|
||||||
sections[nsections++] = sec;
|
sections[nsections++] = sec;
|
||||||
@@ -337,13 +335,11 @@ ElfLinker::Section *ElfLinker::addSection(const char *sname, const void *sdata,
|
|||||||
ElfLinker::Symbol *ElfLinker::addSymbol(const char *name, const char *section,
|
ElfLinker::Symbol *ElfLinker::addSymbol(const char *name, const char *section,
|
||||||
upx_uint64_t offset) {
|
upx_uint64_t offset) {
|
||||||
NO_printf("addSymbol: %s %s 0x%llx\n", name, section, offset);
|
NO_printf("addSymbol: %s %s 0x%llx\n", name, section, offset);
|
||||||
if (update_capacity(nsymbols, &nsymbols_capacity))
|
assert(name && name[0]);
|
||||||
symbols = static_cast<Symbol **>(realloc(symbols, nsymbols_capacity * sizeof(Symbol *)));
|
|
||||||
assert(symbols != nullptr);
|
|
||||||
assert(name);
|
|
||||||
assert(name[0]);
|
|
||||||
assert(name[strlen(name) - 1] != ':');
|
assert(name[strlen(name) - 1] != ':');
|
||||||
assert(findSymbol(name, false) == nullptr);
|
assert(findSymbol(name, false) == nullptr);
|
||||||
|
if (grow_capacity(nsymbols, &nsymbols_capacity))
|
||||||
|
symbols = realloc_array(symbols, nsymbols_capacity);
|
||||||
Symbol *sym = new Symbol(name, findSection(section), offset);
|
Symbol *sym = new Symbol(name, findSection(section), offset);
|
||||||
symbols[nsymbols++] = sym;
|
symbols[nsymbols++] = sym;
|
||||||
return sym;
|
return sym;
|
||||||
@@ -351,18 +347,15 @@ ElfLinker::Symbol *ElfLinker::addSymbol(const char *name, const char *section,
|
|||||||
|
|
||||||
ElfLinker::Relocation *ElfLinker::addRelocation(const char *section, unsigned off, const char *type,
|
ElfLinker::Relocation *ElfLinker::addRelocation(const char *section, unsigned off, const char *type,
|
||||||
const char *symbol, upx_uint64_t add) {
|
const char *symbol, upx_uint64_t add) {
|
||||||
if (update_capacity(nrelocations, &nrelocations_capacity))
|
if (grow_capacity(nrelocations, &nrelocations_capacity))
|
||||||
relocations = static_cast<Relocation **>(
|
relocations = realloc_array(relocations, nrelocations_capacity);
|
||||||
realloc(relocations, (nrelocations_capacity) * sizeof(Relocation *)));
|
|
||||||
assert(relocations != nullptr);
|
|
||||||
Relocation *rel = new Relocation(findSection(section), off, type, findSymbol(symbol), add);
|
Relocation *rel = new Relocation(findSection(section), off, type, findSymbol(symbol), add);
|
||||||
relocations[nrelocations++] = rel;
|
relocations[nrelocations++] = rel;
|
||||||
return rel;
|
return rel;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void ElfLinker::setLoaderAlignOffset(int phase)
|
void ElfLinker::setLoaderAlignOffset(int phase) {
|
||||||
{
|
|
||||||
// assert(phase & 0);
|
// assert(phase & 0);
|
||||||
NO_printf("\nFIXME: ElfLinker::setLoaderAlignOffset %d\n", phase);
|
NO_printf("\nFIXME: ElfLinker::setLoaderAlignOffset %d\n", phase);
|
||||||
}
|
}
|
||||||
@@ -374,6 +367,8 @@ int ElfLinker::addLoader(const char *sname) {
|
|||||||
return outputlen;
|
return outputlen;
|
||||||
|
|
||||||
char *begin = strdup(sname);
|
char *begin = strdup(sname);
|
||||||
|
assert(begin != nullptr);
|
||||||
|
const auto begin_deleter = upx::MallocDeleter(&begin, 1); // don't leak memory
|
||||||
char *end = begin + strlen(begin);
|
char *end = begin + strlen(begin);
|
||||||
for (char *sect = begin; sect < end;) {
|
for (char *sect = begin; sect < end;) {
|
||||||
for (char *tokend = sect; *tokend; tokend++)
|
for (char *tokend = sect; *tokend; tokend++)
|
||||||
@@ -425,7 +420,6 @@ int ElfLinker::addLoader(const char *sname) {
|
|||||||
}
|
}
|
||||||
sect += strlen(sect) + 1;
|
sect += strlen(sect) + 1;
|
||||||
}
|
}
|
||||||
free(begin);
|
|
||||||
return outputlen;
|
return outputlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,10 +468,10 @@ void ElfLinker::relocate() {
|
|||||||
value = rel->value->offset;
|
value = rel->value->offset;
|
||||||
} else if (strcmp(rel->value->section->name, "*UND*") == 0 &&
|
} else if (strcmp(rel->value->section->name, "*UND*") == 0 &&
|
||||||
rel->value->offset == 0xdeaddead)
|
rel->value->offset == 0xdeaddead)
|
||||||
internal_error("undefined symbol '%s' referenced\n", rel->value->name);
|
throwInternalError("undefined symbol '%s' referenced\n", rel->value->name);
|
||||||
else if (rel->value->section->output == nullptr)
|
else if (rel->value->section->output == nullptr)
|
||||||
internal_error("can not apply reloc '%s:%x' without section '%s'\n", rel->section->name,
|
throwInternalError("can not apply reloc '%s:%x' without section '%s'\n",
|
||||||
rel->offset, rel->value->section->name);
|
rel->section->name, rel->offset, rel->value->section->name);
|
||||||
else {
|
else {
|
||||||
value = rel->value->section->offset + rel->value->offset + rel->add;
|
value = rel->value->section->offset + rel->value->offset + rel->add;
|
||||||
}
|
}
|
||||||
@@ -495,7 +489,7 @@ void ElfLinker::relocate() {
|
|||||||
void ElfLinker::defineSymbol(const char *name, upx_uint64_t value) {
|
void ElfLinker::defineSymbol(const char *name, upx_uint64_t value) {
|
||||||
Symbol *symbol = findSymbol(name);
|
Symbol *symbol = findSymbol(name);
|
||||||
if (strcmp(symbol->section->name, "*ABS*") == 0)
|
if (strcmp(symbol->section->name, "*ABS*") == 0)
|
||||||
internal_error("defineSymbol: symbol '%s' is *ABS*\n", name);
|
throwInternalError("defineSymbol: symbol '%s' is *ABS*\n", name);
|
||||||
else if (strcmp(symbol->section->name, "*UND*") == 0) // for undefined symbols
|
else if (strcmp(symbol->section->name, "*UND*") == 0) // for undefined symbols
|
||||||
symbol->offset = value;
|
symbol->offset = value;
|
||||||
else if (strcmp(symbol->section->name, name) == 0) // for sections
|
else if (strcmp(symbol->section->name, name) == 0) // for sections
|
||||||
@@ -506,7 +500,7 @@ void ElfLinker::defineSymbol(const char *name, upx_uint64_t value) {
|
|||||||
value += section->size;
|
value += section->size;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
internal_error("defineSymbol: symbol '%s' already defined\n", name);
|
throwInternalError("defineSymbol: symbol '%s' already defined\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// debugging support
|
// debugging support
|
||||||
@@ -553,7 +547,7 @@ void ElfLinker::alignWithByte(unsigned len, byte b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ElfLinker::relocate1(const Relocation *rel, byte *, upx_uint64_t, const char *) {
|
void ElfLinker::relocate1(const Relocation *rel, byte *, upx_uint64_t, const char *) {
|
||||||
internal_error("unknown relocation type '%s\n'", rel->type);
|
throwInternalError("unknown relocation type '%s\n'", rel->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -563,14 +557,13 @@ void ElfLinker::relocate1(const Relocation *rel, byte *, upx_uint64_t, const cha
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if 0 // FIXME
|
#if 0 // FIXME
|
||||||
static void check8(const Relocation *rel, const byte *location, int v, int d)
|
static void check8(const Relocation *rel, const byte *location, int v, int d) {
|
||||||
{
|
|
||||||
if (v < -128 || v > 127)
|
if (v < -128 || v > 127)
|
||||||
internal_error("value out of range (%d) in reloc %s:%x\n",
|
throwInternalError("value out of range (%d) in reloc %s:%x\n", v, rel->section->name,
|
||||||
v, rel->section->name, rel->offset);
|
rel->offset);
|
||||||
if (d < -128 || d > 127)
|
if (d < -128 || d > 127)
|
||||||
internal_error("displacement target out of range (%d) in reloc %s:%x\n",
|
throwInternalError("displacement target out of range (%d) in reloc %s:%x\n", v,
|
||||||
v, rel->section->name, rel->offset);
|
rel->section->name, rel->offset);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -592,10 +585,10 @@ void ElfLinkerAMD64::relocate1(const Relocation *rel, byte *location, upx_uint64
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(type, "8") == 0) {
|
if (strcmp(type, "8") == 0) {
|
||||||
int displ = (signed char) *location + (int) value;
|
int displ = (upx_int8_t) *location + (int) value;
|
||||||
if (range_check && (displ < -128 || displ > 127))
|
if (range_check && (displ < -128 || displ > 127))
|
||||||
internal_error("target out of range (%d) in reloc %s:%x\n", displ, rel->section->name,
|
throwInternalError("target out of range (%d) in reloc %s:%x\n", displ,
|
||||||
rel->offset);
|
rel->section->name, rel->offset);
|
||||||
*location += value;
|
*location += value;
|
||||||
} else if (strcmp(type, "16") == 0)
|
} else if (strcmp(type, "16") == 0)
|
||||||
set_le16(location, get_le16(location) + value);
|
set_le16(location, get_le16(location) + value);
|
||||||
@@ -688,7 +681,7 @@ void ElfLinkerArm64LE::relocate1(const Relocation *rel, byte *location, upx_uint
|
|||||||
upx_uint32_t const m19 = ~(~0u << 19);
|
upx_uint32_t const m19 = ~(~0u << 19);
|
||||||
upx_uint32_t w = get_le32(location);
|
upx_uint32_t w = get_le32(location);
|
||||||
set_le32(location, (w & ~(m19 << 5)) | ((((w >> 5) + (value >> 2)) & m19) << 5));
|
set_le32(location, (w & ~(m19 << 5)) | ((((w >> 5) + (value >> 2)) & m19) << 5));
|
||||||
} else if (!strcmp(type, "CALL26")) {
|
} else if (!strcmp(type, "CALL26") || !strcmp(type, "JUMP26")) {
|
||||||
value -= rel->section->offset + rel->offset;
|
value -= rel->section->offset + rel->offset;
|
||||||
upx_uint32_t const m26 = ~(~0u << 26);
|
upx_uint32_t const m26 = ~(~0u << 26);
|
||||||
upx_uint32_t w = get_le32(location);
|
upx_uint32_t w = get_le32(location);
|
||||||
@@ -800,12 +793,12 @@ void ElfLinkerPpc32::relocate1(const Relocation *rel, byte *location, upx_uint64
|
|||||||
// Note that original (*location).displ is ignored.
|
// Note that original (*location).displ is ignored.
|
||||||
if (strcmp(type, "24") == 0) {
|
if (strcmp(type, "24") == 0) {
|
||||||
if (3 & value)
|
if (3 & value)
|
||||||
internal_error("unaligned word displacement");
|
throwInternalError("unaligned word displacement");
|
||||||
// FIXME: displacement overflow?
|
// FIXME: displacement overflow?
|
||||||
set_be32(location, (0xfc000003 & get_be32(location)) + (0x03fffffc & value));
|
set_be32(location, (0xfc000003 & get_be32(location)) + (0x03fffffc & value));
|
||||||
} else if (strcmp(type, "14") == 0) {
|
} else if (strcmp(type, "14") == 0) {
|
||||||
if (3 & value)
|
if (3 & value)
|
||||||
internal_error("unaligned word displacement");
|
throwInternalError("unaligned word displacement");
|
||||||
// FIXME: displacement overflow?
|
// FIXME: displacement overflow?
|
||||||
set_be32(location, (0xffff0003 & get_be32(location)) + (0x0000fffc & value));
|
set_be32(location, (0xffff0003 & get_be32(location)) + (0x0000fffc & value));
|
||||||
} else
|
} else
|
||||||
@@ -837,19 +830,19 @@ void ElfLinkerPpc64le::relocate1(const Relocation *rel, byte *location, upx_uint
|
|||||||
|
|
||||||
if (strncmp(type, "14", 2) == 0) { // for "14" and "14S"
|
if (strncmp(type, "14", 2) == 0) { // for "14" and "14S"
|
||||||
if (3 & value)
|
if (3 & value)
|
||||||
internal_error("unaligned word displacement");
|
throwInternalError("unaligned word displacement");
|
||||||
// FIXME: displacement overflow?
|
// FIXME: displacement overflow?
|
||||||
set_le32(location, (0xffff0003 & get_le32(location)) + (0x0000fffc & value));
|
set_le32(location, (0xffff0003 & get_le32(location)) + (0x0000fffc & value));
|
||||||
} else if (strncmp(type, "24", 2) == 0) { // for "24" and "24S"
|
} else if (strncmp(type, "24", 2) == 0) { // for "24" and "24S"
|
||||||
if (3 & value)
|
if (3 & value)
|
||||||
internal_error("unaligned word displacement");
|
throwInternalError("unaligned word displacement");
|
||||||
// FIXME: displacement overflow?
|
// FIXME: displacement overflow?
|
||||||
set_le32(location, (0xfc000003 & get_le32(location)) + (0x03fffffc & value));
|
set_le32(location, (0xfc000003 & get_le32(location)) + (0x03fffffc & value));
|
||||||
} else if (strcmp(type, "8") == 0) {
|
} else if (strcmp(type, "8") == 0) {
|
||||||
int displ = (signed char) *location + (int) value;
|
int displ = (upx_int8_t) *location + (int) value;
|
||||||
if (range_check && (displ < -128 || displ > 127))
|
if (range_check && (displ < -128 || displ > 127))
|
||||||
internal_error("target out of range (%d) in reloc %s:%x\n", displ, rel->section->name,
|
throwInternalError("target out of range (%d) in reloc %s:%x\n", displ,
|
||||||
rel->offset);
|
rel->section->name, rel->offset);
|
||||||
*location += value;
|
*location += value;
|
||||||
} else if (strcmp(type, "16") == 0)
|
} else if (strcmp(type, "16") == 0)
|
||||||
set_le16(location, get_le16(location) + value);
|
set_le16(location, get_le16(location) + value);
|
||||||
@@ -887,19 +880,19 @@ void ElfLinkerPpc64::relocate1(const Relocation *rel, byte *location, upx_uint64
|
|||||||
|
|
||||||
if (strncmp(type, "14", 2) == 0) { // for "14" and "14S"
|
if (strncmp(type, "14", 2) == 0) { // for "14" and "14S"
|
||||||
if (3 & value)
|
if (3 & value)
|
||||||
internal_error("unaligned word displacement");
|
throwInternalError("unaligned word displacement");
|
||||||
// FIXME: displacement overflow?
|
// FIXME: displacement overflow?
|
||||||
set_be32(location, (0xffff0003 & get_be32(location)) + (0x0000fffc & value));
|
set_be32(location, (0xffff0003 & get_be32(location)) + (0x0000fffc & value));
|
||||||
} else if (strncmp(type, "24", 2) == 0) { // for "24" and "24S"
|
} else if (strncmp(type, "24", 2) == 0) { // for "24" and "24S"
|
||||||
if (3 & value)
|
if (3 & value)
|
||||||
internal_error("unaligned word displacement");
|
throwInternalError("unaligned word displacement");
|
||||||
// FIXME: displacement overflow?
|
// FIXME: displacement overflow?
|
||||||
set_be32(location, (0xfc000003 & get_be32(location)) + (0x03fffffc & value));
|
set_be32(location, (0xfc000003 & get_be32(location)) + (0x03fffffc & value));
|
||||||
} else if (strcmp(type, "8") == 0) {
|
} else if (strcmp(type, "8") == 0) {
|
||||||
int displ = (signed char) *location + (int) value;
|
int displ = (upx_int8_t) *location + (int) value;
|
||||||
if (range_check && (displ < -128 || displ > 127))
|
if (range_check && (displ < -128 || displ > 127))
|
||||||
internal_error("target out of range (%d) in reloc %s:%x\n", displ, rel->section->name,
|
throwInternalError("target out of range (%d) in reloc %s:%x\n", displ,
|
||||||
rel->offset);
|
rel->section->name, rel->offset);
|
||||||
*location += value;
|
*location += value;
|
||||||
} else if (strcmp(type, "16") == 0)
|
} else if (strcmp(type, "16") == 0)
|
||||||
set_be16(location, get_be16(location) + value);
|
set_be16(location, get_be16(location) + value);
|
||||||
@@ -925,10 +918,10 @@ void ElfLinkerX86::relocate1(const Relocation *rel, byte *location, upx_uint64_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(type, "8") == 0) {
|
if (strcmp(type, "8") == 0) {
|
||||||
int displ = (signed char) *location + (int) value;
|
int displ = (upx_int8_t) *location + (int) value;
|
||||||
if (range_check && (displ < -128 || displ > 127))
|
if (range_check && (displ < -128 || displ > 127))
|
||||||
internal_error("target out of range (%d,%d,%llu) in reloc %s:%x\n", displ, *location,
|
throwInternalError("target out of range (%d,%d,%llu) in reloc %s:%x\n", displ,
|
||||||
value, rel->section->name, rel->offset);
|
*location, value, rel->section->name, rel->offset);
|
||||||
*location += value;
|
*location += value;
|
||||||
} else if (strcmp(type, "16") == 0)
|
} else if (strcmp(type, "16") == 0)
|
||||||
set_le16(location, get_le16(location) + value);
|
set_le16(location, get_le16(location) + value);
|
||||||
|
|||||||
+8
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
// ElfLinker
|
// ElfLinker
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class ElfLinker : private noncopyable {
|
class ElfLinker /*not_final*/ : private upx::noncopyable {
|
||||||
friend class Packer;
|
friend class Packer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const N_BELE_RTP::AbstractPolicy *const bele; // target endianness
|
const N_BELE_RTP::AbstractPolicy *const bele; // TE - Target Endianness
|
||||||
protected:
|
protected:
|
||||||
struct Section;
|
struct Section;
|
||||||
struct Symbol;
|
struct Symbol;
|
||||||
@@ -68,7 +68,6 @@ protected:
|
|||||||
void preprocessSymbols(char *start, char const *end);
|
void preprocessSymbols(char *start, char const *end);
|
||||||
void preprocessRelocations(char *start, char const *end);
|
void preprocessRelocations(char *start, char const *end);
|
||||||
Section *findSection(const char *name, bool fatal = true) const;
|
Section *findSection(const char *name, bool fatal = true) const;
|
||||||
Symbol *findSymbol(const char *name, bool fatal = true) const;
|
|
||||||
|
|
||||||
Symbol *addSymbol(const char *name, const char *section, upx_uint64_t offset);
|
Symbol *addSymbol(const char *name, const char *section, upx_uint64_t offset);
|
||||||
Relocation *addRelocation(const char *section, unsigned off, const char *type,
|
Relocation *addRelocation(const char *section, unsigned off, const char *type,
|
||||||
@@ -92,6 +91,7 @@ public:
|
|||||||
int getSectionSize(const char *sname) const;
|
int getSectionSize(const char *sname) const;
|
||||||
byte *getLoader(int *llen = nullptr) const;
|
byte *getLoader(int *llen = nullptr) const;
|
||||||
void defineSymbol(const char *name, upx_uint64_t value);
|
void defineSymbol(const char *name, upx_uint64_t value);
|
||||||
|
Symbol *findSymbol(const char *name, bool fatal = true) const;
|
||||||
upx_uint64_t getSymbolOffset(const char *) const;
|
upx_uint64_t getSymbolOffset(const char *) const;
|
||||||
|
|
||||||
void dumpSymbol(const Symbol *, unsigned flags, FILE *fp) const;
|
void dumpSymbol(const Symbol *, unsigned flags, FILE *fp) const;
|
||||||
@@ -114,7 +114,7 @@ protected:
|
|||||||
const char *type);
|
const char *type);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ElfLinker::Section : private noncopyable {
|
struct ElfLinker::Section final : private upx::noncopyable {
|
||||||
char *name = nullptr;
|
char *name = nullptr;
|
||||||
void *input = nullptr;
|
void *input = nullptr;
|
||||||
byte *output = nullptr;
|
byte *output = nullptr;
|
||||||
@@ -128,7 +128,7 @@ struct ElfLinker::Section : private noncopyable {
|
|||||||
~Section() noexcept;
|
~Section() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ElfLinker::Symbol : private noncopyable {
|
struct ElfLinker::Symbol final : private upx::noncopyable {
|
||||||
char *name = nullptr;
|
char *name = nullptr;
|
||||||
Section *section = nullptr;
|
Section *section = nullptr;
|
||||||
upx_uint64_t offset = 0;
|
upx_uint64_t offset = 0;
|
||||||
@@ -137,7 +137,7 @@ struct ElfLinker::Symbol : private noncopyable {
|
|||||||
~Symbol() noexcept;
|
~Symbol() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ElfLinker::Relocation : private noncopyable {
|
struct ElfLinker::Relocation final : private upx::noncopyable {
|
||||||
const Section *section = nullptr;
|
const Section *section = nullptr;
|
||||||
unsigned offset = 0;
|
unsigned offset = 0;
|
||||||
const char *type = nullptr;
|
const char *type = nullptr;
|
||||||
|
|||||||
+48
-31
@@ -1,9 +1,9 @@
|
|||||||
/* main.cpp --
|
/* main.cpp -- main entry
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -37,6 +37,9 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef OPTIONS_VAR
|
#ifndef OPTIONS_VAR
|
||||||
|
// historical note: "UPX_OPTIONS" would be a better name, but back in the old
|
||||||
|
// days environment variables used to be short; and we cannot change that now
|
||||||
|
// because of backward compatibility issues
|
||||||
#define OPTIONS_VAR "UPX"
|
#define OPTIONS_VAR "UPX"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -64,12 +67,9 @@ static void handle_opterr(acc_getopt_p g, const char *f, void *v) {
|
|||||||
static int exit_code = EXIT_OK;
|
static int exit_code = EXIT_OK;
|
||||||
|
|
||||||
#if (WITH_GUI)
|
#if (WITH_GUI)
|
||||||
static noinline void do_exit(void) { throw exit_code; }
|
static noreturn void do_exit() { throw exit_code; }
|
||||||
#else
|
#else
|
||||||
#if defined(__GNUC__)
|
static noreturn void do_exit() {
|
||||||
static void do_exit(void) __attribute__((__noreturn__));
|
|
||||||
#endif
|
|
||||||
static void do_exit(void) {
|
|
||||||
static bool in_exit = false;
|
static bool in_exit = false;
|
||||||
|
|
||||||
if (in_exit)
|
if (in_exit)
|
||||||
@@ -112,7 +112,7 @@ static noinline void e_exit(int ec) {
|
|||||||
do_exit();
|
do_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static noinline void e_usage(void) {
|
static noinline void e_usage() {
|
||||||
if (opt->debug.getopt_throw_instead_of_exit)
|
if (opt->debug.getopt_throw_instead_of_exit)
|
||||||
throw EXIT_USAGE;
|
throw EXIT_USAGE;
|
||||||
show_usage();
|
show_usage();
|
||||||
@@ -214,8 +214,8 @@ static void check_and_update_options(int i, int argc) {
|
|||||||
// misc
|
// misc
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
static void e_help(void) {
|
static void e_help() {
|
||||||
show_help();
|
show_help(0);
|
||||||
e_exit(EXIT_USAGE);
|
e_exit(EXIT_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,7 +340,8 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T, T default_value, T min_value, T max_value>
|
template <class T, T default_value, T min_value, T max_value>
|
||||||
static int getoptvar(OptVar<T, default_value, min_value, max_value> *var, const char *arg_fatal) {
|
static int getoptvar(upx::OptVar<T, default_value, min_value, max_value> *var,
|
||||||
|
const char *arg_fatal) {
|
||||||
T v = default_value;
|
T v = default_value;
|
||||||
int r = getoptvar(&v, min_value, max_value, arg_fatal);
|
int r = getoptvar(&v, min_value, max_value, arg_fatal);
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
@@ -383,6 +384,8 @@ static int do_option(int optc, const char *arg) {
|
|||||||
set_cmd(CMD_HELP);
|
set_cmd(CMD_HELP);
|
||||||
break;
|
break;
|
||||||
case 'h' + 256:
|
case 'h' + 256:
|
||||||
|
case 996:
|
||||||
|
case 997:
|
||||||
#if 1
|
#if 1
|
||||||
if (!acc_isatty(STDOUT_FILENO)) {
|
if (!acc_isatty(STDOUT_FILENO)) {
|
||||||
/* according to GNU standards */
|
/* according to GNU standards */
|
||||||
@@ -390,7 +393,7 @@ static int do_option(int optc, const char *arg) {
|
|||||||
opt->console = CON_FILE;
|
opt->console = CON_FILE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
show_help(1);
|
show_help(optc == 996 ? 1 : (optc == 997 ? 3 : 2));
|
||||||
e_exit(EXIT_OK);
|
e_exit(EXIT_OK);
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
@@ -733,6 +736,12 @@ static int do_option(int optc, const char *arg) {
|
|||||||
case 677:
|
case 677:
|
||||||
opt->o_unix.force_pie = true;
|
opt->o_unix.force_pie = true;
|
||||||
break;
|
break;
|
||||||
|
case 678:
|
||||||
|
opt->o_unix.android_old = true;
|
||||||
|
break;
|
||||||
|
case 679:
|
||||||
|
opt->o_unix.catch_sigsegv = true;
|
||||||
|
break;
|
||||||
// ps1/exe
|
// ps1/exe
|
||||||
case 670:
|
case 670:
|
||||||
opt->ps1_exe.boot_only = true;
|
opt->ps1_exe.boot_only = true;
|
||||||
@@ -789,7 +798,7 @@ static int do_option(int optc, const char *arg) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
#if !defined(DOCTEST_CONFIG_DISABLE)
|
#if !defined(DOCTEST_CONFIG_DISABLE)
|
||||||
case 999: // doctest --dt-XXX option
|
case 999: // [doctest] --dt-XXX option; ignored here, see upx_doctest_check()
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -813,7 +822,7 @@ int main_get_options(int argc, char **argv) {
|
|||||||
// commands
|
// commands
|
||||||
{"best", 0x10, N, 900}, // compress best
|
{"best", 0x10, N, 900}, // compress best
|
||||||
{"brute", 0x10, N, 901}, // compress best, brute force
|
{"brute", 0x10, N, 901}, // compress best, brute force
|
||||||
{"ultra-brute", 0x10, N, 902}, // compress best, brute force
|
{"ultra-brute", 0x10, N, 902}, // compress best, ultra-brute force
|
||||||
{"decompress", 0, N, 'd'}, // decompress
|
{"decompress", 0, N, 'd'}, // decompress
|
||||||
{"fast", 0x10, N, '1'}, // compress faster
|
{"fast", 0x10, N, '1'}, // compress faster
|
||||||
{"fileinfo", 0x10, N, 909}, // display info about file
|
{"fileinfo", 0x10, N, 909}, // display info about file
|
||||||
@@ -831,8 +840,8 @@ int main_get_options(int argc, char **argv) {
|
|||||||
{"force", 0, N, 'f'}, // force overwrite of output files
|
{"force", 0, N, 'f'}, // force overwrite of output files
|
||||||
{"force-compress", 0, N, 'f'}, // and compression of suspicious files
|
{"force-compress", 0, N, 'f'}, // and compression of suspicious files
|
||||||
{"force-overwrite", 0x90, N, 529}, // force overwrite of output files
|
{"force-overwrite", 0x90, N, 529}, // force overwrite of output files
|
||||||
{"link", 0x90, N, 530}, // preserve hard link
|
|
||||||
{"info", 0, N, 'i'}, // info mode
|
{"info", 0, N, 'i'}, // info mode
|
||||||
|
{"link", 0x90, N, 530}, // preserve hard link
|
||||||
{"no-env", 0x10, N, 519}, // no environment var
|
{"no-env", 0x10, N, 519}, // no environment var
|
||||||
{"no-link", 0x90, N, 531}, // do not preserve hard link [default]
|
{"no-link", 0x90, N, 531}, // do not preserve hard link [default]
|
||||||
{"no-mode", 0x10, N, 526}, // do not preserve mode (permissions)
|
{"no-mode", 0x10, N, 526}, // do not preserve mode (permissions)
|
||||||
@@ -923,7 +932,7 @@ int main_get_options(int argc, char **argv) {
|
|||||||
// atari/tos
|
// atari/tos
|
||||||
{"split-segments", 0x90, N, 650},
|
{"split-segments", 0x90, N, 650},
|
||||||
// darwin/macho
|
// darwin/macho
|
||||||
{"force-macos", 0x90, N, 690}, // undocumented temporary until we fix macOS 13+
|
{"force-macos", 0x90, N, 690}, // undocumented temporary option until we do fix macOS 13+
|
||||||
// djgpp2/coff
|
// djgpp2/coff
|
||||||
{"coff", 0x90, N, 610}, // produce COFF output
|
{"coff", 0x90, N, 610}, // produce COFF output
|
||||||
// dos/exe
|
// dos/exe
|
||||||
@@ -947,6 +956,8 @@ int main_get_options(int argc, char **argv) {
|
|||||||
{"preserve-build-id", 0, N, 675},
|
{"preserve-build-id", 0, N, 675},
|
||||||
{"android-shlib", 0, N, 676},
|
{"android-shlib", 0, N, 676},
|
||||||
{"force-pie", 0x90, N, 677},
|
{"force-pie", 0x90, N, 677},
|
||||||
|
{"android-old", 0, N, 678},
|
||||||
|
{"catch-sigsegv", 0, N, 679},
|
||||||
// ps1/exe
|
// ps1/exe
|
||||||
{"boot-only", 0x90, N, 670},
|
{"boot-only", 0x90, N, 670},
|
||||||
{"no-align", 0x90, N, 671},
|
{"no-align", 0x90, N, 671},
|
||||||
@@ -963,7 +974,7 @@ int main_get_options(int argc, char **argv) {
|
|||||||
{"strip-relocs", 0x12, N, 634},
|
{"strip-relocs", 0x12, N, 634},
|
||||||
{"keep-resource", 0x31, N, 635},
|
{"keep-resource", 0x31, N, 635},
|
||||||
|
|
||||||
#if !defined(DOCTEST_CONFIG_DISABLE)
|
#if !defined(DOCTEST_CONFIG_DISABLE) // accept and ignore some doctest --dt-XXX options
|
||||||
// [doctest] Query flags - the program quits after them. Available:
|
// [doctest] Query flags - the program quits after them. Available:
|
||||||
{"dt-c", 0x10, N, 999},
|
{"dt-c", 0x10, N, 999},
|
||||||
{"dt-count", 0x10, N, 999},
|
{"dt-count", 0x10, N, 999},
|
||||||
@@ -1020,7 +1031,7 @@ void main_get_envoptions() {
|
|||||||
// commands
|
// commands
|
||||||
{"best", 0x10, N, 900}, // compress best
|
{"best", 0x10, N, 900}, // compress best
|
||||||
{"brute", 0x10, N, 901}, // compress best, brute force
|
{"brute", 0x10, N, 901}, // compress best, brute force
|
||||||
{"ultra-brute", 0x10, N, 902}, // compress best, brute force
|
{"ultra-brute", 0x10, N, 902}, // compress best, ultra-brute force
|
||||||
{"fast", 0x10, N, '1'}, // compress faster
|
{"fast", 0x10, N, '1'}, // compress faster
|
||||||
|
|
||||||
// options
|
// options
|
||||||
@@ -1086,7 +1097,7 @@ void main_get_envoptions() {
|
|||||||
static const char sep[] = " \t";
|
static const char sep[] = " \t";
|
||||||
char shortopts[256];
|
char shortopts[256];
|
||||||
|
|
||||||
var = getenv(OPTIONS_VAR);
|
var = upx_getenv(OPTIONS_VAR);
|
||||||
if (var == nullptr || !var[0])
|
if (var == nullptr || !var[0])
|
||||||
return;
|
return;
|
||||||
env = strdup(var);
|
env = strdup(var);
|
||||||
@@ -1111,7 +1122,7 @@ void main_get_envoptions() {
|
|||||||
if (targc > 1)
|
if (targc > 1)
|
||||||
targv = (const char **) upx_calloc(targc + 1, sizeof(char *));
|
targv = (const char **) upx_calloc(targc + 1, sizeof(char *));
|
||||||
if (targv == nullptr) {
|
if (targv == nullptr) {
|
||||||
free(env);
|
::free(env);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1150,8 +1161,8 @@ void main_get_envoptions() {
|
|||||||
e_envopt(targv[mfx_optind]);
|
e_envopt(targv[mfx_optind]);
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
free(targv);
|
::free(targv); // NOLINT(bugprone-multi-level-implicit-pointer-conversion)
|
||||||
free(env);
|
::free(env);
|
||||||
#endif /* defined(OPTIONS_VAR) */
|
#endif /* defined(OPTIONS_VAR) */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1169,9 +1180,14 @@ static void first_options(int argc, char **argv) {
|
|||||||
if (strcmp(argv[i], "--version-short") == 0)
|
if (strcmp(argv[i], "--version-short") == 0)
|
||||||
do_option(998, argv[i]);
|
do_option(998, argv[i]);
|
||||||
}
|
}
|
||||||
for (i = 1; i < n; i++)
|
for (i = 1; i < n; i++) {
|
||||||
if (strcmp(argv[i], "--help") == 0)
|
if (strcmp(argv[i], "--help") == 0)
|
||||||
do_option('h' + 256, argv[i]);
|
do_option('h' + 256, argv[i]);
|
||||||
|
if (strcmp(argv[i], "--help-short") == 0) // undocumented and subject to change
|
||||||
|
do_option(996, argv[i]);
|
||||||
|
if (strcmp(argv[i], "--help-verbose") == 0) // undocumented and subject to change
|
||||||
|
do_option(997, argv[i]);
|
||||||
|
}
|
||||||
for (i = 1; i < n; i++)
|
for (i = 1; i < n; i++)
|
||||||
if (strcmp(argv[i], "--no-env") == 0)
|
if (strcmp(argv[i], "--no-env") == 0)
|
||||||
do_option(519, argv[i]);
|
do_option(519, argv[i]);
|
||||||
@@ -1200,6 +1216,7 @@ int upx_main(int argc, char *argv[]) may_throw {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allow serial re-use of upx_main() as a subroutine
|
// Allow serial re-use of upx_main() as a subroutine
|
||||||
|
exit_code = EXIT_OK;
|
||||||
opt->reset();
|
opt->reset();
|
||||||
|
|
||||||
#if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_TOS || ACC_OS_WIN16 || \
|
#if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_TOS || ACC_OS_WIN16 || \
|
||||||
@@ -1236,7 +1253,9 @@ int upx_main(int argc, char *argv[]) may_throw {
|
|||||||
assert(upx_nrv_init() == 0);
|
assert(upx_nrv_init() == 0);
|
||||||
#endif
|
#endif
|
||||||
assert(upx_ucl_init() == 0);
|
assert(upx_ucl_init() == 0);
|
||||||
|
#if (WITH_ZLIB)
|
||||||
assert(upx_zlib_init() == 0);
|
assert(upx_zlib_init() == 0);
|
||||||
|
#endif
|
||||||
#if (WITH_ZSTD)
|
#if (WITH_ZSTD)
|
||||||
assert(upx_zstd_init() == 0);
|
assert(upx_zstd_init() == 0);
|
||||||
#endif
|
#endif
|
||||||
@@ -1269,7 +1288,7 @@ int upx_main(int argc, char *argv[]) may_throw {
|
|||||||
e_exit(EXIT_OK);
|
e_exit(EXIT_OK);
|
||||||
break;
|
break;
|
||||||
case CMD_HELP:
|
case CMD_HELP:
|
||||||
show_help(1);
|
show_help(2);
|
||||||
e_exit(EXIT_OK);
|
e_exit(EXIT_OK);
|
||||||
break;
|
break;
|
||||||
case CMD_LICENSE:
|
case CMD_LICENSE:
|
||||||
@@ -1300,8 +1319,10 @@ int upx_main(int argc, char *argv[]) may_throw {
|
|||||||
|
|
||||||
/* start work */
|
/* start work */
|
||||||
set_term(stdout);
|
set_term(stdout);
|
||||||
if (do_files(i, argc, argv) != 0)
|
if (do_files(i, argc, argv) != 0) {
|
||||||
|
assert(exit_code != 0);
|
||||||
return exit_code;
|
return exit_code;
|
||||||
|
}
|
||||||
|
|
||||||
if (gitrev[0]) {
|
if (gitrev[0]) {
|
||||||
// also see UPX_CONFIG_DISABLE_GITREV in CMakeLists.txt
|
// also see UPX_CONFIG_DISABLE_GITREV in CMakeLists.txt
|
||||||
@@ -1354,11 +1375,7 @@ int __acc_cdecl_main main(int argc, char *argv[]) /*noexcept*/ {
|
|||||||
_set_abort_behavior(_WRITE_ABORT_MSG, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
_set_abort_behavior(_WRITE_ABORT_MSG, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||||
#endif
|
#endif
|
||||||
acc_wildargv(&argc, &argv);
|
acc_wildargv(&argc, &argv);
|
||||||
#if defined(__wasi__)
|
upx_rand_init();
|
||||||
srand((int) time(nullptr));
|
|
||||||
#else
|
|
||||||
srand((int) clock());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// info: main() is implicitly "noexcept", so we need a try block
|
// info: main() is implicitly "noexcept", so we need a try block
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
+6
-6
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2024 Laszlo Molnar
|
Copyright (C) 1996-2025 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -51,7 +51,7 @@ void printClearLine(FILE *f) noexcept {
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
if (f == nullptr)
|
if (f == nullptr)
|
||||||
f = stdout;
|
f = stdout;
|
||||||
con_fprintf(f, "%s", clear_line_msg);
|
con_fprintf(f, "%s", clear_line_msg); // NOLINT(clang-analyzer-unix.Stream)
|
||||||
fflush(f);
|
fflush(f);
|
||||||
printSetNl(0);
|
printSetNl(0);
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ void printErr(const char *iname, const Throwable &e) noexcept {
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
upx_safe_snprintf(buf, sizeof(buf), "%s", prettyName(typeid(e).name()));
|
upx_safe_snprintf(buf, sizeof(buf), "%s", prettyExceptionName(typeid(e).name()));
|
||||||
l = strlen(buf);
|
l = strlen(buf);
|
||||||
if (l < sizeof(buf) && e.getMsg())
|
if (l < sizeof(buf) && e.getMsg())
|
||||||
upx_safe_snprintf(buf + l, sizeof(buf) - l, ": %s", e.getMsg());
|
upx_safe_snprintf(buf + l, sizeof(buf) - l, ": %s", e.getMsg());
|
||||||
@@ -143,8 +143,8 @@ void printWarn(const char *iname, const char *format, ...) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void printUnhandledException(const char *iname, const std::exception *e) noexcept {
|
void printUnhandledException(const char *iname, const std::exception *e) noexcept {
|
||||||
if (e)
|
if (e != nullptr)
|
||||||
printErr(iname, "unhandled exception: %s\n", prettyName(e->what()));
|
printErr(iname, "unhandled exception: %s\n", prettyExceptionName(e->what()));
|
||||||
else
|
else
|
||||||
printErr(iname, "internal error: unhandled exception!\n");
|
printErr(iname, "internal error: unhandled exception!\n");
|
||||||
if (opt->cmd != CMD_COMPRESS) {
|
if (opt->cmd != CMD_COMPRESS) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user